@dialecte/cli 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,41 +17,86 @@ npm i -D @dialecte/cli # provides the `dialecte` binary
17
17
 
18
18
  ## Commands
19
19
 
20
+ `dialecte --help` lists the commands by family; `dialecte <command> --help` prints that command only (its
21
+ verbs, flags, exit codes and one example); `dialecte --help --json` answers every command, verb, flag and exit
22
+ code from the one map the code declares (each command's `verbs` and `flags` derived from its usage lines, and
23
+ `renamed`: every old form with its new one), and `dialecte <command> --help --json` that one command in the same
24
+ shape. Exit codes: 0 an answer or green, 1 nothing found or a failed check,
25
+ 2 usage or refused; a command's help says when it differs.
26
+
20
27
  ```
21
- dialecte coverage # generate complete, schema-driven type-coverage probes
22
- dialecte bench [--check] # measure the type-instantiation cost of your own types (library .d.ts skipped); --check gates CI
23
- dialecte audit # render the public type surface and flag readability issues (C1–C6)
24
- dialecte skills sync # install the agent skills your dependencies ship, for your agents
25
- dialecte skills generate # refresh the generated blocks of this package's skills
26
- dialecte skills check # fail on a skill citing what the code no longer has, or an undocumented public function
27
- dialecte skills changed # per skill touched: hand-written (its evals are due) or generated blocks only (no evals)
28
- dialecte api find "<need>" # find a method by what you need
29
- dialecte api show <path> # read one method's contract
28
+ Discover api members schema explain standard
29
+ Use run fixture new
30
+ Grow lot
31
+ Plan plan
32
+ Check gate tdd rules contrib mutants
33
+ Hand over handover
34
+ Workspace worktree doctor models skills
35
+ Maintain bench coverage narrowing audit text
36
+ ```
37
+
38
+ ```
39
+ dialecte api find "<need>" # find a method by what you need; api show <path>: one method's contract
30
40
  dialecte members <expr> # what an expression of the live types holds
31
41
  dialecte schema <Tag> # what an element may hold and where
32
- dialecte models # which model each tier (fast, standard, strong, frontier) means for your vendor
33
- dialecte doctor # versions, core API generation, skills and station agents in sync, local checkouts
34
- dialecte rules # code-rules self-check of the changed files
42
+ dialecte explain <code> # what an error or diagnostic code means, when it is raised, the usual fix
43
+ dialecte standard index|find|show|eval # index and search the standards kept on this machine, outside every repository
44
+ dialecte run <script.ts> # run a script on an in-memory project of the installed dialecte: one structured outcome
45
+ dialecte fixture <Tag> # the smallest valid XML document holding an element, built by the dialecte's engine
46
+ dialecte new verb <namespace> <query|transaction> <name>
47
+ dialecte lot start <brief.json> # a lot from its brief: the lot folder in the store, the numbered worktree, .dialecte/lot
48
+ dialecte lot status <id> # its state derived from the records, the checks, the exact next command; reads only
49
+ dialecte lot wait <id> [--timeout <seconds>] # until the lot needs someone: ready, a question, failed, a limit
50
+ dialecte lot answer <id> <question> "<answer>" [--by <who>] # answer an open question of the lot, once
51
+ dialecte lot result <id> # the hand-over (card, show and run lines) of a ready lot, or why it stopped; writes nothing
52
+ dialecte lot stop <id> --reason <text> # end the lot: its pending hand-over abandoned first, then canceled
53
+ dialecte inbox # what waits on someone across every lot store: questions, ready hand-overs, failed lots
54
+ dialecte plan next|check|mark <plan.md> # what can start now in a plan's lot block; the block checked; a person's mark
55
+ dialecte lot exempt|accept|revised|gone|mutation # the lot declaration .dialecte/lot.json
56
+ dialecte lot finding|decide|snapshot|choice|standard <id|folder> ... # a lot's review rounds, in its lot or hand-over folder
57
+ dialecte lot delta <id|folder> --round <n> # the fix diff since round n-1; --worktree: the old code to run a test on
58
+ dialecte lot recap <id|folder> # the pull request's expandable part, built from the hand-over's records only
59
+ dialecte lot close <name|index> # a finished lot: node_modules to the pool, its worktree to the trash
35
60
  dialecte gate [--full] # the package's Definition of Done, with the real counts
36
61
  dialecte gate --hook # in a commit hook: the suite, unless a green gate --full of the committed tree answers it
37
62
  dialecte tdd red|green|status # receipts: each new test failed on an assertion before the code, then passed untouched
38
- dialecte new verb <namespace> <query|transaction> <name>
39
- dialecte handover <lots.json> # the guarded commit-by-lots hand-over a human runs (show, run, abandon, list)
40
- dialecte handover --legend # every term of the hand-over card: what it means, whether to look
41
- dialecte worktree add|prune # a worktree ready to work in (sibling links, node_modules checked); what a merge left behind
42
- dialecte record review|decision|snapshot # a lot's findings ledger and round snapshots, in its hand-over folder
43
- dialecte record choice <folder> --by <who> <decision> # a decision made outside the ledger, in decisions.md
44
- dialecte record standard <folder> consulted <note> # the standard check, read by the card's standard line
45
- dialecte recap <folder> # the pull request's expandable part, built from the hand-over's records only
46
- dialecte mutants run|status|schedule|abandon|migrate|judge|record|drop # mutation testing of the declared scope; survivors tracked until handled
63
+ dialecte rules # code-rules self-check of the changed files
64
+ dialecte contrib # the contributor checks, after gate --full and before the hand-over
65
+ dialecte mutants run|status|schedule|abandon|migrate|judge|record|drop # mutation testing of the declared scope
66
+ dialecte handover write <lots.json> # the guarded commit-by-lots hand-over a human runs (handover <lots.json> too)
67
+ dialecte handover show|review|run|abandon|list|--legend
68
+ dialecte worktree add|prune # a worktree ready to work in; what a merge left behind
69
+ dialecte doctor # versions, core API generation, skills and station agents in sync, local checkouts
70
+ dialecte models # which model each tier (fast, standard, strong, frontier) means for your vendor
71
+ dialecte skills sync|generate|check|changed # the agent skills your dependencies ship, and this package's own
72
+ dialecte bench [--check] # measure the type-instantiation cost of your own types; --check gates CI
73
+ dialecte coverage # generate complete, schema-driven type-coverage probes
74
+ dialecte narrowing # assert schema-derived type narrowing still holds
75
+ dialecte audit # render the public type surface and flag readability issues (C1-C6)
47
76
  dialecte text check <file> # the human part of a GitHub text: its fixed headings and its word cap
48
- dialecte review delta <folder> --round <n> # the fix diff since round n-1; --worktree: the old code to run a test on
49
- dialecte run <script.ts> # run a script on an in-memory project of the installed dialecte: one structured outcome
50
- dialecte fixture <Tag> # the smallest valid XML document holding an element, built by the dialecte's engine
51
- dialecte explain <code> # what an error or diagnostic code means, when it is raised, the usual fix
52
- dialecte --help
53
77
  ```
54
78
 
79
+ ### Renamed in 1.0
80
+
81
+ The review rounds' commands moved under `lot`. The old forms run nothing and write nothing: each answers
82
+ `renamed: dialecte <old> is now dialecte <new>` on stderr, exit 2, until 2.0. Its second line is the full new
83
+ command with the same arguments, or, with no arguments, the new form's usage line; `record` or `review`
84
+ without a verb lists every form that replaced it. Asked with `--help`, an old form prints the same answer on
85
+ stdout, with the words given before `--help`, exit 0; with `--help --json` it prints
86
+ `{ renamed: [{ old, new }] }`, the words after `dialecte` (`record` lists its five forms).
87
+
88
+ | 1.0 | Before |
89
+ | ----------------------------------------------------------------------------------------- | -------------------------- |
90
+ | `dialecte lot finding <id\|folder> --round <n> --severity <s> --at <file:line> <finding>` | `dialecte record review` |
91
+ | `dialecte lot decide <id\|folder> <finding> <state>` | `dialecte record decision` |
92
+ | `dialecte lot snapshot <id\|folder> --round <n>` | `dialecte record snapshot` |
93
+ | `dialecte lot choice <id\|folder> --by <who> <decision>` | `dialecte record choice` |
94
+ | `dialecte lot standard <id\|folder> consulted <note> \| not-consulted <reason>` | `dialecte record standard` |
95
+ | `dialecte lot delta <id\|folder> --round <n> [--worktree] [--json]` | `dialecte review delta` |
96
+ | `dialecte lot recap <id\|folder>` | `dialecte recap` |
97
+
98
+ `dialecte handover write <lots.json>` names what `dialecte handover <lots.json>` does; the old form stays.
99
+
55
100
  ## Zero-config
56
101
 
57
102
  A dialect is built by convention: `src/<version>/definition/{constants,definition}.generated.ts`, and
@@ -130,6 +175,31 @@ Every Dialecte package ships the agent skills that describe it in `skills/<name>
130
175
  intent quotes a sentence, since the generated pages republish the JSDoc. A page about several
131
176
  repositories declares `<!-- dialecte-skills workspace -->` and is fully verified with
132
177
  `--workspace <folder>`; a deliberate outside mention goes in `<!-- dialecte-skills ignore: token -->`.
178
+ It also verifies every cli invocation a page cites in code (inline code, fenced blocks tagged `sh`, `bash` or
179
+ `shell`, and in an untagged fence only a line starting `dialecte ` and a command of the map; a fence with any
180
+ other tag - `text`, `mermaid`, a diagram, a sample - is never read; never prose; generated blocks left out): one starting with `dialecte` or `@dialecte/cli`, after `npx`, a
181
+ `$ ` prompt or a shell operator. Its command, its verb and each `--flag` must be in the command map of the
182
+ cli the package uses (the cli's own map in the cli itself, else what the installed `@dialecte/cli` answers to
183
+ `dialecte --help --json`); an unknown one, or an old form of a command renamed in 1.0 (see "Renamed in
184
+ 1.0"), is an error at `page:line` naming the closest valid form, or the new form, on a workspace page too. A quoted word, a
185
+ `<placeholder>` and what follows a bare `--` are not checked; `ignore:` takes the offending word (`record`,
186
+ `--fats`). With no installed cli, or one before the map, the invocations are not checked: one warning says
187
+ why and the summary line says so. Inside a `<placeholder>`, an option group `[...]` or a flag group
188
+ `(--a | --b)` a `|` is no pipe; each kind of group is counted on its own (a `)` never closes a `<`), and a
189
+ process substitution `<(dialecte ...)` is read like any invocation. A versioned `@dialecte/cli@<version>` and
190
+ what follows an unclosed `<`, `[` or `(--` are not read.
191
+
192
+ ## What the cli prints
193
+
194
+ Every text the cli prints passes one boundary: each printed line is escaped once, so a value from a record, a
195
+ brief, an argument or an agent can never forge a line nor act on the terminal. Every C0 control (a tab and a line
196
+ feed included), DEL, the C1 controls, the bidi marks, embeddings, overrides and isolates and the line and
197
+ paragraph separators print as `\u{<hex>}` (`\u{a}` for a line feed, `\u{1b}` for an escape). A lot verb's
198
+ refusal, a recap row, a card line and an error the cli catches all print that way. Quoted source (`lot delta`'s
199
+ diff, `mutants judge`'s window) shows a tab as four spaces. `--json` is never escaped: JSON encodes its control
200
+ characters itself and holds every value as written. The lines the cli relays from its own child processes (a
201
+ gate step's, a hook's, a test runner's) keep their colours (SGR sequences, the conceal parameter dropped);
202
+ every other control in them is escaped.
133
203
 
134
204
  ## Lookups for agents (and people)
135
205
 
@@ -152,10 +222,18 @@ Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage
152
222
  installed dialecte (a dependency built on `@dialecte/core` exporting `./<version>` with its `./<version>/test`
153
223
  entry: its namespace is its name capitalized, `Scl` from `@dialecte/scl/v2019C1`); with several, it lists them and
154
224
  `--package <name>` / `--version <v>` picks one. `--namespace <Name> --entry <module>` override.
155
- - `dialecte schema <Tag> [--package <name>]`: parents, children in order with how often each may appear,
156
- attributes (required, identity, default, fixed, enumeration, pattern), text, xsi:type variants - read
157
- through the readers of the core each installed dialecte depends on (how often a child may appear is core's
158
- `childOccurrences`). An unknown tag answers the closest; a dialecte not built is reported as skipped.
225
+ - `dialecte schema <Tag> [--under <Parent>] [--package <name>]`: parents, children in order with how often each
226
+ may appear, attributes (required, identity, default, fixed, enumeration, pattern), text, xsi:type variants,
227
+ the declared type and documentation - read through the readers of the core each installed dialecte depends on
228
+ (how often a child may appear is core's `childOccurrences`). A tag declared several ways prints each declaration
229
+ with the parents that hold it; `--under <Parent>` prints the one that parent holds (or those it holds, when it
230
+ does not decide), and a tag that is not a child of that parent answers its parents (exit 1). With `--json` each
231
+ element carries `declarations` and `resolved`, and when known `type`, `documentation`, `declaration` (the key
232
+ of the declaration described, when the tag is declared several ways) and `ways` (when unresolved). A dialecte
233
+ names the standard it implements in its `package.json`, `"dialecte": { "standard": "<public name>" }` (the
234
+ usual public name, no part or clause); a value that is not a non-empty string skips the dialecte, naming
235
+ `dialecte.standard`. An unknown tag
236
+ answers the closest; a dialecte not built is reported as skipped.
159
237
  - `dialecte doctor`: installed `@dialecte/*` versions, the core API generation of each dialecte (read from
160
238
  the core it resolves; a dialecte on another core than your app's is a warning), whether the synced skills match node_modules (a skill missing; a copied skill of
161
239
  another version than the one installed - linked skills follow node_modules), local checkouts (siblings,
@@ -174,6 +252,87 @@ Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage
174
252
 
175
253
  Run outside a package (no `package.json`), each answers a usage error.
176
254
 
255
+ ## The standard index
256
+
257
+ `dialecte standard` indexes the standards you hold on your machine and answers from them, in slices of whole
258
+ lines with their original line numbers. The cli ships no standard and never copies one into a repository.
259
+
260
+ **Where the standards are.** `DIALECTE_STANDARD` names one root folder holding one folder per standard; the
261
+ folder's name, lowercased, is the standard's id, and its top-level, non-hidden `.md` files are the standard
262
+ (subfolders are ignored; a symlink to a folder or a file counts). A file's id is `<standard id>/<file name
263
+ without .md>`, lowercased.
264
+
265
+ ```
266
+ $DIALECTE_STANDARD/
267
+ <standard id>/
268
+ <part>.md
269
+ <amendment>.md
270
+ <other standard id>/
271
+ <part>.md
272
+ ```
273
+
274
+ Refused with exit 2, nothing built: `DIALECTE_STANDARD` not set, empty or naming a path that does not exist; a
275
+ root that is a file, that holds `.md` files directly (they are named, with the expected layout) or that holds no
276
+ standard folder; two folders,
277
+ or two files of a folder, whose ids differ only by case (both named); a `--standard <id>` with no folder (the
278
+ known ids named); the root, a standard folder or the cache inside a git work tree. A folder with no `.md` file
279
+ is reported as `no indexable file` and skipped.
280
+
281
+ **Where the index is.** In the cache only: `$XDG_CACHE_HOME/dialecte/standard/<standard id>/<manifest hash>/`
282
+ (else `~/.cache/dialecte/...`), one folder per standard and per set of file contents (the manifest hash is the
283
+ sha256 of the index format and each file's id and sha256). A folder is built into `<hash>.tmp-<pid>/` and renamed
284
+ into place once complete: a file changed during the build aborts it (exit 1, the file named, nothing kept); a
285
+ second builder reuses the first one's folder; a temporary folder left by a process that is gone is removed at the
286
+ next build. A complete folder is reused, never rebuilt, unless `--rebuild` (the old folder is moved aside, the new
287
+ one renamed in, then the old one removed: a reader never sees a half-removed index); the links to the vocabulary of the
288
+ installed dialectes are a file of their own, written beside the rest when the selected dialectes change.
289
+ Old folders are kept. While a build runs, a running line with its elapsed time goes to stderr on a terminal.
290
+
291
+ **The vocabulary.** The tags, attributes and enumeration values of the dialectes installed where the command runs
292
+ (every one, or the one `--package <name>` names) are exact names: case kept, never stemmed, then scored like a
293
+ word (1 per clause or table, doubled in its heading or caption, weighted by the lines naming it). An attribute under three
294
+ characters counts only as `@name`, `name=` or a table cell equal to it, an enumeration value under three
295
+ characters only as a table cell equal to it; a name in lowercase letters only, from three characters, is searched
296
+ as an ordinary word. The tags file is named by the hash of the selected dialectes' `name@version` list. `index`,
297
+ `find` and `eval` print `vocabulary <name@version>[, ...]` (or `vocabulary none (no dialecte installed)`) as their
298
+ first line, and `vocabulary: { packages }` in `--json`. A `--package` that is not installed answers exit 2 with
299
+ the installed ones named.
300
+
301
+ **Words.** Other words are searched by their stem: lowercased, the plural removed, then `-ied` and `-ying` to `-y`,
302
+ a final `-ing` or `-ed` (with its doubled consonant) and a final `e` removed; common English, modal and question
303
+ words are not searched. A word in capitals and digits with two capitals or more (an acronym) is kept from two
304
+ characters, never split nor stemmed; its plural (the acronym and one lowercase `s`) is searched as the acronym.
305
+
306
+ - `dialecte standard index [--standard <id>] [--package <name>] [--rebuild] [--json]`: builds or reuses the index of each standard
307
+ (or of `--standard <id>` only), then per standard `<id> <n> files built|reused in <time> manifest <hash>`,
308
+ per file its lines, quality verdict, noise share, headings kept over candidates, tables and definitions, and
309
+ the lines repeated often enough to be a watermark (information only: nothing is dropped for being repeated).
310
+ Exit 1 when no selected folder holds a `.md` file.
311
+ - `dialecte standard find "<terms>" [--standard <id>] [--package <name>] [--about <Tag>] [--limit <n>] [--json]`:
312
+ the slices that hold the terms, ranked over every selected standard (each slice names its file id): a header
313
+ `<file id>:<from>-<to> <clause> <title> score <s>`, then the normalised text. A slice starts at the first hit
314
+ of its clause's or table's densest run of terms (at most 60 lines holding the most distinct terms, weighted as
315
+ in the score) and runs to the last hit, 60 lines at most; a table starts at its caption when that run ends
316
+ within 60 lines of it. After the `--limit` (10)
317
+ direct slices come the clauses and tables they refer to, marked `[linked]`. `--about <Tag>` adds a tag of the
318
+ installed dialectes (an unknown one answers the closest; none installed is a usage error). Exit 1 when nothing
319
+ matches.
320
+ - `dialecte standard show <file id>:<from>-<to> [--json]`: the normalised text of the logical lines overlapping
321
+ the range, each with its original lines. Exit 1 when the range holds only blank or dropped lines; 2 for a
322
+ malformed range, an unknown file id (the known ones named), a start after its end or an end after the file's
323
+ last line.
324
+ - `dialecte standard eval <gold.jsonl> [--standard <id>] [--package <name>] [--json]`: recall at 5 and at 10 of `find` over a gold
325
+ file you keep, one `{ "question": ..., "about"?: ..., "expected": [{ "file": "<file id>", "quote": ... }] }` per
326
+ line (other fields are ignored). The expected quotes of an item are alternatives: the item is found at the best
327
+ rank of any of them. A quote is matched in plain words: table pipes, `<br>` tags, `**`/`__` and a leading `#`
328
+ run are left out on both sides, then the text is normalised and case is ignored. Each missed item names its
329
+ closest quote and why (`ranked <r>`, `not found by find`, `not in the text`, `unknown file <id>`). Items with
330
+ no expected quote are counted apart. Exit 1 when no item has one; 2 for a gold file that cannot be read or a
331
+ malformed line (its number named).
332
+
333
+ `show`, `find` and `eval` build the index first when it is missing. Every verb answers exit 2 with how to set
334
+ `DIALECTE_STANDARD` when no standard is configured.
335
+
177
336
  ## MCP server
178
337
 
179
338
  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`.
@@ -196,7 +355,17 @@ One field of package.json says what the package is to the cli:
196
355
  the type bench and the release guard, and `skills sync` installs the contributor skills (`--no-contributing`
197
356
  is refused). A contributor never names the tools that consume it: list them once on the machine with
198
357
  `git config --global dialecte.consumerNames "<name>, <name>"` (never committed, so the names stay out of the
199
- repository) and `rules` and `handover` refuse them as whole words (`consumer tool name`).
358
+ repository) and `rules` and `handover` refuse them as whole words (`consumer tool name`). The words a
359
+ contributor never commits at all are listed on the machine the same way, never in the repository:
360
+ `git config --global dialecte.forbiddenWords "<word>, <word>"` and the user file
361
+ `$XDG_CONFIG_HOME/dialecte/forbidden-words` (else `~/.config/dialecte/forbidden-words`; one word per line,
362
+ `#` comments, blank lines skipped), both read and merged. `rules`, `contrib` (its rules row) and the hand-over's
363
+ `references` guard (lot messages and files) refuse them as whole words, whatever the case (`forbidden word`).
364
+ With no list anywhere the check is not run and `rules` says so in one line,
365
+ `forbidden words: no list (git config dialecte.forbiddenWords or <the user file>)`, and passes (a CI machine has
366
+ no list); a user file that cannot be read (a folder at its path, no read permission) is an error, never no list.
367
+ A gate or contrib record of a run that checked the rules is keyed with a hash of the consumer names and the
368
+ forbidden words (never the words), so a list set or changed after a green record runs the check again.
200
369
  - Any other value is refused by every command that reads it:
201
370
  `dialecte.profile: "<value>" is not a profile; profiles: contributor, consumer`.
202
371
 
@@ -238,7 +407,7 @@ The hand-over follows the profile:
238
407
  install, the linked dependencies), no record can answer the real run: the rehearsal says which part, and
239
408
  does not run contrib.
240
409
  - Both profiles get the card's `standard` line (see the hand-over card below) and
241
- `dialecte record standard <folder> consulted <note> | not-consulted <reason>`.
410
+ `dialecte lot standard <id|folder> consulted <note> | not-consulted <reason>`.
242
411
 
243
412
  ## Contributing to a Dialecte package
244
413
 
@@ -254,17 +423,36 @@ the answer.
254
423
  its root (`tmpdir()` handed to a call that lists or scans a folder, or given as `root` / `cwd` /
255
424
  `scratchRoot`...: other tests and processes share it; `mkdtempSync(join(tmpdir(), '<prefix>-'))`
256
425
  gives the test a folder of its own); positional parameters (beyond a leading `query` / `tx`, a
257
- symmetric pair aside) and abbreviated names are warnings. Without file arguments it records its result
258
- in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the files, the errors
259
- and warnings), which `dialecte recap` reads; a run on named files records nothing.
426
+ symmetric pair aside) and abbreviated names are warnings. A file it cannot read (a file given that is not
427
+ there, no read permission) or a script that does not parse is an error of that file (`unreadable-file`),
428
+ never a silent skip. Without file arguments it reads the changed list a scoped gate step hands
429
+ (`DIALECTE_GATE_CHANGED`: its text files still on disk; a list it cannot read is an error) and writes the
430
+ gate's selection (the files it checked); outside a gate, the files changed against HEAD and the new ones,
431
+ that result recorded in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the
432
+ files, the errors and warnings), which `dialecte lot recap` reads; a run on named files records nothing.
260
433
  - `dialecte gate [--fast | --full] [--base <ref>] [--no-reuse] [--declare <path>]... [--json]` runs the Definition of Done: `--fast` (default) `check`,
261
434
  `skills:check` and the tests of the changed files; `--full` adds `build` and the whole suite (the
262
- runner's defaults: every file in parallel). The docs build and the type bench are contributor checks:
435
+ runner's defaults: every file in parallel), then the steps derived from the package's scripts after its
436
+ own (declared or default): `type-narrowing` (`npm run type-narrowing`, a check a publish workflow runs)
437
+ when the package has that script and no step runs it; without the script, one line
438
+ `skip type-narrowing no npm script "type-narrowing"` and no step of the record. The docs build and the type bench are contributor checks:
263
439
  `dialecte contrib` runs them (see [Profiles](#profiles)). Each step runs unfiltered, with
264
440
  `GIT_OPTIONAL_LOCKS=0` (a `git status` inside it never takes the index lock), and is judged on its exit
265
441
  code and on the counts it printed: a step exiting non-zero fails whatever it says, a test step that
266
442
  counts no test fails - except `--fast` on a change that touches no test (a doc edit): the changed-tests
267
- step passes with the note "no test file is affected by the change". A step whose npm script the package lacks is skipped. While a hand-over
443
+ step passes with the note "no test file is affected by the change". A step running an npm script the package lacks
444
+ is _not wired_, judged for the whole list before any step runs (every wiring problem shows at once, and a
445
+ failed one leaves every other step unrun): a step of the default list (the package declares no list for the
446
+ mode) fails `gate --full` and `--release` (`FAIL skills not wired (no npm script "skills:check")`, then the
447
+ line `add the script, or opt out with dialecte.gate.skip: "dialecte": { "gate": { "skip": { "skills": "<reason>" } } }` under it;
448
+ `dialecte contrib` names `"contrib"` there) and is skipped by `--fast` (`skip skills not wired (...)`, the gate stays green); a step the package declares
449
+ fails in every mode, `--fast` included (`declared but not wired (no npm script "<x>")`). The fix is the
450
+ script, the step removed from the list, or, for a default step, an opt-out with a reason (below). The
451
+ hand-over card shows `✗ <step> not wired (no npm script; or dialecte.gate.skip)` for a full or release record
452
+ (`dialecte.contrib.skip` for a contrib one) and `! <step> not
453
+ wired (no npm script)` for a fast one, and `! <step> opted out: <reason>` for an opt-out (a warning). The
454
+ `type-narrowing` step is derived from the package's scripts and is never unwired. A gate record written
455
+ before this check is not reused for a package with an unwired or opted-out step (the key changes). While a hand-over
268
456
  holds the repository (`dialecte handover <lots.json>` wrote its lock), the gate runs only under the
269
457
  hand-over written for this repository - the script the lock names exists and the `lots.json` beside it
270
458
  names this repository, real paths compared - and says so in one line with the command that refreshes
@@ -307,7 +495,12 @@ the answer.
307
495
  serial rerun is green: it is reused with its `flaky in parallel` note. `--no-reuse` runs the steps
308
496
  whatever the store holds. The key leaves out the Node version and the environment (a path given
309
497
  through an environment variable); a `file:` dependency edited and restored to the same size within
310
- the same modification time is not seen either.
498
+ the same modification time is not seen either. `--full` and `--release` hold the machine awake while they
499
+ run (on macOS a `caffeinate -i -w <the cli's pid>` started at their start, detached, ending with the cli;
500
+ nothing on another system, nor when `caffeinate` is not on `PATH`, nor with `DIALECTE_KEEP_AWAKE=0`), and
501
+ measure their wall and monotonic time: a run whose wall time passed its monotonic time by over 60 s spanned
502
+ a sleep of the machine all the same, its record keeps `sleptMs`, and the hand-over card's gates print
503
+ `! slept <duration> during gate --full` for a record of the tree it checks.
311
504
  - `dialecte gate --hook [--no-reuse]` runs in a commit hook: the test steps of `--full` (its steps counting
312
505
  tests), unless a green `--full` record of what is committed answers them. Its key is the one a `--full` run of
313
506
  that state stores - the tree, what npm installed, the `file:` dependencies, the full gate's command hash - with
@@ -339,7 +532,7 @@ the answer.
339
532
  terminal (and never with `NO_COLOR`); the `✓` `!` `✗` marks read the same without it. The command
340
533
  follows the box whole on one line, to copy: `cd <folder> && bash commit.sh`, or
341
534
  `node <this cli> handover run <folder>` when the repository's own cli does not answer
342
- `handover run --probe` within 10 s. "This cli" is the script that runs: when it is a temporary one
535
+ `handover run --probe` within 60 s. "This cli" is the script that runs: when it is a temporary one
343
536
  (`npx` from the registry, `tsx` on the sources), install `@dialecte/cli` in the repository so the
344
537
  card names its own bin.
345
538
  - No runner hangs silently. Every child that `dialecte gate` (its steps), `tdd` (its vitest runs) and
@@ -362,8 +555,11 @@ the answer.
362
555
  `contributor`, after `gate --full` and before `dialecte handover`, one line per row: `rules` on the files
363
556
  changed against HEAD (recorded as `dialecte rules` records it), the package's `dialecte.contrib.steps`
364
557
  (default: `docs`, `npm run doc:build` with the `generatedDocs` restored, and `type-bench`,
365
- `npm run type-bench:check`; `[]` keeps the built-in rows only) run as the gate runs its steps (a missing
366
- npm script skips the step), `release` (no dependency named by a local folder), then `mutation` when the
558
+ `npm run type-bench:check`; `[]` keeps the built-in rows only) run as the gate runs its steps (a default
559
+ step whose npm script is missing fails the run before any row, the built-in `rules` and `release` rows
560
+ included, unless `dialecte.contrib.skip` opts it out with a reason; a declared one fails too), `type-narrowing` (`npm run type-narrowing`) when the package has that script and
561
+ none of its steps runs it (without the script, one line `skip type-narrowing no npm script
562
+ "type-narrowing"` before `release`, no row), `release` (no dependency named by a local folder), then `mutation` when the
367
563
  package declares a mutation scope (read from the mutation store now, never recorded). A package step a
368
564
  green `gate --full` record of this tree and install passed with the same name and command is not run
369
565
  again: its row says `reused from gate --full at <time>`. The run is recorded as `dialecte-gate-contrib.json`
@@ -387,12 +583,27 @@ the answer.
387
583
  still waiting for its green whose test file, or test code it imports, changed since its red ("test
388
584
  code changed since its red and it passes"); a failure on a missing export, a type or syntax error, a
389
585
  timeout, a stub thrown at import or before the assertion; a file holding `.only` or `only: true`. A
390
- case the same as at the base is marked unchanged; a case the lot accepts is marked accepted; a green
586
+ case the same as at the base is marked unchanged; a case the lot accepts is marked accepted, unless
587
+ it is proven red then green at its current test call (an acceptance never overrides a proof: it goes
588
+ the normal path, no accepted receipt, and the line adds `acceptance not needed (proven red → green): it
589
+ can be removed from the lot file`); a green
391
590
  case whose test code changed around it is kept and flagged `test code changed around it` (the next
392
591
  step adding a case to a green file); a case never proven green (only unchanged, accepted or revised)
393
592
  is kept without a flag, and no receipt. A file with a refusal still records its other cases'
394
- receipts, the refusals kept as evidence, but is not frozen: the gate fails on it until no case of
395
- it is refused.
593
+ receipts, the refusals kept as evidence; it is frozen when one of its cases is red (those need no re-red;
594
+ the refused case stays unproven), else not frozen; the gate fails on it until no case of it is refused.
595
+ - Two cases of one run sharing a file, a project and a name share one id, and a receipt names one case: every
596
+ case of such a group is refused (`red` and `green`), whatever its state, with `2 cases share this id
597
+ (lines 12, 12): <hint>` (a case without a location prints `?`). The hint is `rename one` for two plain
598
+ calls; for a case of an `.each` / `.for` table (or under one) it says to spell each title in full:
599
+ vitest cuts a `$` field of an each-title at its `truncateThreshold` and prints any array as `[ Array(n) ]`, so
600
+ two rows can read the same; `truncateThreshold: 0` in the package's vitest config is the other fix. A member
601
+ the run does not judge (skipped, filtered out by `-t`, not targeted by `green`) gets a `duplicate <case>
602
+ <reason>` line and no receipt. The cases of the group stay out of the move matching, the rest of the file is
603
+ judged as usual, and the exit is 1. `--json` holds `duplicates: [{ file, project, name, lines }]` (empty when
604
+ none). The `gate`'s tdd step fails (`duplicate case ids in <n> file(s): <files>`) and the card's tdd section
605
+ lists `✗ duplicate id <file>::<name> lines 12, 12` per group, so the hand-over is BLOCKED. A receipt
606
+ recorded before under an id now shared never counts.
396
607
  - A red records the case (file, full name, project), the hashes of its test file, of its own test call
397
608
  and of the production files, the failing message and the time. It is flagged `rollback` at a
398
609
  production state the case, or the lot, had already left: a production file moved back from the
@@ -420,15 +631,51 @@ the answer.
420
631
  into production, never further, and the module itself is production), its own snapshot. Every
421
632
  dependency found by import is followed in turn, and one found by a name written with its folder
422
633
  (`fixtures/scan.ts`, a full path): it brings the files it imports (`import type` included). A bare
423
- file name (`index.ts`) may be another file: the changed file it names is a dependency, not followed. A
424
- helper no red covers stays unfrozen, and the gate fails on it, unless a `revised` entry names it
425
- (below). An import that looks local (`@/`, `~/`,
426
- `#`, a `paths` or alias prefix) and resolves nowhere refuses its file, naming the import.
634
+ file name (`index.ts`) may be another file: the changed file it names is a dependency, not followed. The
635
+ `setupFiles` of the package's vite or vitest configs (test code no test imports) are a dependency of every
636
+ test file, followed as an import: a red freezes a changed one, a `revised` entry naming it lets a red
637
+ freeze it. A helper no red covers stays unfrozen, and the gate fails on it, unless a `revised` entry names it
638
+ (below). A Vite import query or fragment (`./x.worker?worker&url`, `?raw`, `?url`, `?inline`, `#part`) is
639
+ left out of the file the import names; a specifier starting with `#` is a subpath import. The files of
640
+ the change an `import.meta.glob(...)` of its test code matches (a pattern relative to the file, `/` for
641
+ the package root, or a vite alias; a negated `!pattern` leaves its files out and names none) are
642
+ dependencies too, followed like an import. An import that looks local (`@/`, `~/`,
643
+ `#`, a `paths` or alias prefix) and resolves nowhere refuses its file, naming the import as written.
644
+ - A test-code file moved with its bytes as at the base (git's R100: a deleted path and a new one,
645
+ added or untracked, holding the same blob) is no change: a moved test file's cases are `unchanged`
646
+ with no receipt to hold, its old path lists no deleted case, a moved helper or fixture waits for no
647
+ freeze. A move stays within one kind (a test file to a test file, other test code to other test code;
648
+ an empty file never pairs): a test file renamed off (`a.test.ts.off`) lists its cases deleted, one
649
+ renamed on is a new file. A move with an edit is a new file and a deleted one. A change that only
650
+ deletes test files lists their cases `deleted` in the gate's `tdd` step.
651
+ - Cases moved out of a test file (a file split in several, a case cut out into another file) keep the
652
+ base's proof with no declaration. A case of a new or changed test file is `moved` when its test call,
653
+ by tokens (those its case hash reads), under the same describe path, is in the base text of a test
654
+ file the change deletes, or of a changed one that no longer holds that call under that path, and its
655
+ own file's base did not hold it; a case of the same name and project matched in two files is moved
656
+ from neither (`ambiguous <case> in <files>: moved from none of them`). A moved case is a case of the
657
+ base: `tdd red` records it `unchanged` when it passes (and freezes the helpers its file depends on),
658
+ and with no receipt yet `status`, the gate and the card read it `unchanged`. `status` and the gate's
659
+ details print one line per source file, `moved <n> case(s) <old file> → <k> file(s)`, with
660
+ ` · test code changed around them` when a target's code outside its test calls (imports, hooks, helpers,
661
+ under the describe paths it keeps) differs from the source's base, read by the same tokens; the card's
662
+ tdd section shows the line, and a deleted source is reported by it instead of as deleted. A case a
663
+ helper registers (the call at its location is no test call: `checkRow(row)`) is `moved by name` when a
664
+ test file the change deletes, or that registers fewer cases now, registered one case of the same name
665
+ and project through a runner at the base:
666
+ `moved by name <n> case(s) <old file> → <k> file(s) · runner changed: <base call> → <new call>`. Those
667
+ base names come from one collect-only run of the base files (no test executes), paid only when a split
668
+ is detected statically (a test file deleted, or a changed one whose base ran a registering statement
669
+ outside its test calls, by tokens, that it no longer runs; a row added to a table is no split), in a
670
+ scratch copy of the base tree outside the worktree removed after it, bounded
671
+ at 5 minutes; `status` prints its duration (`base collect <n> file(s) <duration>`).
427
672
  - `green` runs the changed test files: each case needs a red receipt, its file, its test call and its
428
673
  test code as frozen, production changed since its red ("nothing in production changed since red"),
429
674
  and a pass.
430
675
  - `status` prints each case (red, green, unchanged, accepted, missing receipt, test edited after red,
431
- with its flags), the test code changed outside `tdd red`, and the cases the change deletes. A test
676
+ with its flags), one `skipped <case> <receipts>` line per case with receipts the read rule skips
677
+ (below; the gate's details too), the test code changed outside `tdd red`, and the cases the change
678
+ deletes. A test
432
679
  call of the base gone without a title (an `it(name, ...)` whose title is a variable: an edited call
433
680
  looks deleted) prints `deleted <file> a test call of the base is gone`; when a `gone` entry of
434
681
  `.dialecte/lot.json` names its file (a path or a glob), it prints
@@ -471,14 +718,24 @@ the answer.
471
718
  red when it fails) and freezes its file and the changed test code it depends on. A file or glob entry
472
719
  may also name a test helper (test code that is not a test file: a helper, a fixture, a constant beside
473
720
  the tests) edited at review while its dependent cases stay green: the next `tdd red` freezes it at its
474
- new hash and prints `revised <helper> <reason>`, when every changed test file depending on it (at
475
- least one) is in the run and frozen by it with no case red (a refused file, a red still waiting for
476
- its green, or no dependent file in the run leaves it unfrozen; a changed dependent outside a targeted
477
- run too, named on an `unfrozen <helper>` line). The new freeze makes the dependent
721
+ new hash and prints `revised <helper> <reason>`, when every changed test file depending on it
722
+ is in the run and frozen by it with no case red (a refused file, a red still waiting for
723
+ its green, or a changed dependent outside a targeted run leaves it unfrozen, named on an
724
+ `unfrozen <helper>` line). A helper that no changed test file depends on (its dependents are all
725
+ unchanged since the base) is frozen by any `tdd red` whatever its files, with the entry's reason. The new freeze makes the dependent
478
726
  cases' earlier green stale: `tdd green` proves them again. Without that red run the gate fails on the
479
727
  edit; `status` lists the revised cases, the gate and the hand-over card list the revisions (cases
480
728
  and helpers) with their reason, an entry (exact, file or glob) no revised case or helper used as a
481
- note.
729
+ note. A `revised` entry covering a proven case nothing changed since its proof (same test call, test
730
+ code as frozen) records nothing: the line reads `kept <case> proven before (<kind>) revision not
731
+ needed (nothing changed since its proof): <reason>`, and the entry stays unused.
732
+ - A receipt counts only while its declaration holds (the read rule of `tdd red`, `tdd green`,
733
+ `tdd status`, the gate and the card): an `accepted` receipt whose `accept` entry the lot file no longer
734
+ holds, or that a red then a green of the same test call precede, and a `revised` receipt no `revised`
735
+ entry (exact, file or glob) covers any more, are skipped, and the case reads from its earlier proof (a
736
+ case whose file was frozen again after its green owes a fresh `tdd green`). Nothing in the ledger is
737
+ rewritten; the flags are read from every receipt. A skipped receipt is named:
738
+ `skipped <case> 1 accepted receipt (no longer declared)`, or `(proven red → green before it)`.
482
739
  - What it cannot see: the receipts can be written by an agent with a shell; a deliberate throw in
483
740
  production looks like a stub; code written first, hidden, then a red taken at the base state, cannot
484
741
  be told from an honest red (at the first step the red's production is the base's). The flags and the
@@ -489,9 +746,13 @@ the answer.
489
746
  iterating, run the case with `npx vitest run <file> -t "<case>"`), its barrel export and, for a new
490
747
  namespace, the namespace module and its registration. Its JSDoc summary and `@intent` start with
491
748
  `FILL:`, which `skills check` refuses until written; the command prints every placeholder left.
492
- - `dialecte handover <lots.json> [--out <dir>] [--rehash] [--json]` prepares the commit-by-lots
493
- hand-over a human runs. The lots file names the repository, the branch and HEAD expected, and the lots
494
- (paths, message):
749
+ - `dialecte handover write <lots.json> [--release] [--target <branch>] [--out <id|folder>] [--rehash] [--json]` (or `dialecte handover <lots.json>`) prepares the commit-by-lots
750
+ hand-over a human runs. `--target <branch>` names the branch the hand-over must not be behind (default: the
751
+ [base branch](#the-base-branch)); it is written as `target` in the lots file. A branch with no ref, local or on
752
+ origin (`--target nope: no such branch, local or on origin`), a `--target` with no branch after it, or no base
753
+ branch to default to, is refused (exit 2, nothing written). `--release` marks it a release hand-over (`"release": true` in the lots file): its card
754
+ then holds a required `gate release` row, green only with a green `gate --release` record of the tree it commits.
755
+ The lots file names the repository, the branch and HEAD expected, and the lots (paths, message):
495
756
 
496
757
  ```json
497
758
  {
@@ -517,28 +778,45 @@ the answer.
517
778
  `commit.sh` that runs
518
779
  `npx --no-install @dialecte/cli handover run <folder>` (bash, also run with `sh`; when the repository
519
780
  installs no cli that can, it says so in one line with the fix) - and prints the hand-over card, the
520
- command with its absolute `cd` under it. The folder is the lots file's, or `--out <dir>`. Every hand-over
781
+ command with its absolute `cd` under it. The folder is the lots file's, or `--out <id|folder>`: a lot (its
782
+ index, full name, a path to its folder or `.dialecte/lot`) writes into the lot folder, any other word is a
783
+ folder; either way the folder is taken by its real path (a folder not made yet: the real path of its nearest
784
+ existing ancestor, then the rest) before anything is written, so `commit.sh`, the lock, the card, `--json`'s
785
+ `folder` and the registry all hold it. A word naming both an existing folder and a lot is the folder: the
786
+ card's output starts with the note saying so (`outNote` in `--json`). Refused (exit 2, nothing written), when the folder is a lot folder, in
787
+ this order: a damaged lot (`<name> is damaged (<reason>): ...`, naming `lot stop`), a simulated lot (`a simulated lot has no hand-over`), a `canceled` or `failed` lot, an open
788
+ question (`answer q<k> first: dialecte lot answer <full name> q<k> "<answer>" ...`), a lots file whose
789
+ repository is not the lot's worktree or whose branch is not the lot's (both named); and for any folder whose
790
+ registered hand-over is `committed` (`<name> is committed: a committed hand-over is never rewritten`). Every hand-over
521
791
  written is registered in the repository's store, `<git common dir>/dialecte-handover/`: shared by every
522
792
  worktree of the repository, kept when a worktree is removed, never in the working tree. The store holds
523
- one entry per hand-over, `<name>.json` = `{ folder, branch, worktree, written, state }` (the folder's
524
- absolute path, the lots file's branch and repository, when it was written, and its state as last
793
+ one entry per hand-over, `<name>.json` = `{ folder, branch, worktree, index, written, state }` (the folder's
794
+ absolute path, the lots file's branch and repository, the worktree's index when its folder is numbered
795
+ (`0171` for `.worktrees/0171-cli-x`, absent otherwise), when it was written, and its state as last
525
796
  recorded: `pending` when written, `committed` by a real run that commits every lot, `abandoned` by
526
797
  `handover abandon`); the folder stays where it was written. The name is `<yyyy-mm-dd>-<branch slug>[-<n>]` -
527
798
  the local date, the branch with every run of characters outside `[A-Za-z0-9._-]` (the `/` included)
528
799
  turned into one `-`, then `-2`, `-3`... when that name has an entry already. A folder registered already
529
- (the same real path) keeps its name: `--rehash` updates its entry, never a second one. A rehearsal and
530
- `show` write no entry. `--json` answers the card as data: the verdict, `profile`,
800
+ (the same real path) keeps its name: `--rehash` updates its entry, never a second one, and never one
801
+ recorded `committed`. An entry is written whole (a reader sees the old entry or the new one; on a file
802
+ system without hard links a new entry is written exclusively instead) and stays writable, so an older cli
803
+ can still record its state. A rehearsal and `show` write no entry. `--json` answers the card as data: the verdict, `profile`,
531
804
  `failedGates`, `otherTreeGates`, `declarations` (the entries to read), `gates` (the gate lines: name,
532
805
  status, detail), `contrib` (a contributor's contrib rows, one per row: name, status, detail, and `stale`
533
806
  or `source` - `rehearsal`, `from <commit>` - when they apply), `tdd` (the tdd lines as the text a person reads, no layout and no padding), `notes`, `name` (the
534
- hand-over's registered name; absent for a folder with no entry), and each lot with
807
+ hand-over's registered name; absent for a folder with no entry), `worktree` (absolute), `index` (a
808
+ numbered worktree's), and each lot with
535
809
  `pending` until it is committed. Edited a file after the review? `--rehash` (also after
536
810
  editing `lots.json`). The repository stays held until every lot is committed: `dialecte gate` runs
537
811
  only under this hand-over (see `gate`), and a hand-over of another folder is refused, naming the script
538
812
  that holds the repository and its lock.
539
813
 
540
814
  - The hand-over card is what a person reads before running the hand-over, and again at its end. Its title
541
- is `hand-over: <repository folder> <branch>`; the repository and worktree paths are not in it. Its
815
+ is `hand-over: <repository folder> <branch>`, with the worktree's index first from a numbered worktree
816
+ (`hand-over: 0171 cli feat/x`: the repository's own folder name, so the number is shown once). The commit
817
+ section ends with the `worktree` line: the worktree the lots are committed in, relative to the workspace
818
+ when it is inside it (`.worktrees/0171-cli-x`, `cli` for the main checkout), else its absolute path; both
819
+ compared by real path, so a side reached through a link (`/var` and `/private/var`) reads the same. Its
542
820
  first line is the verdict: `READY` when no gate line failed and none ran on another tree, `BLOCKED` with
543
821
  `<n> gates failed: <names>` and `gates ran on another tree: <names>`, `DONE` once a real run committed
544
822
  every lot; then the lots, files and `+<added> −<removed>` (`all gates green` when nothing blocks), and
@@ -551,8 +829,16 @@ the answer.
551
829
  - `gates`: one line per gate step from the gate records (the latest record of each step over `--fast`,
552
830
  `--full` and the commit hook's record, a line of the hook's ending with `commit hook`:
553
831
  `✓ test:run 1214/1214 · commit hook`; a gate record newer than the hook's replaces its lines whole,
554
- since the hook names its own scripts, not the gate's steps), then, in a consumer, `mutation` when the
555
- package declares a mutation scope (below), then
832
+ since the hook names its own scripts, not the gate's steps; the other way round, a hook record of the
833
+ tree the hand-over commits, not dropped by a newer gate record of that tree, replaces the lines of
834
+ every gate record of another tree it answers - a step of the same name, or a step counting tests when
835
+ the hook counts tests: a merge hand-over rehearsed or committed reads the hook's lines of the merged
836
+ tree, the worktree's `tests` of its tree before the merge left out. No check leaves silently: a step
837
+ the hook did not run reads `! skills not run on the merged tree` (a warning, not of another tree), a
838
+ failed one stays `✗ ... (the tree changed since)`, and `tdd` stays the worktree's: on the DONE card of a
839
+ merge hand-over the tdd verdict is judged on the worktree's own lot tree (the tree its first merge lot
840
+ merged onto), current while the hook record of the merged tree stands, so no `gates ran on another tree`
841
+ for it), then, in a consumer, `mutation` when the package declares a mutation scope (below), then
556
842
  `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots, then `standard`. `✓`
557
843
  passed; `!` to look at (a step not run here, with its reason, or not run after a failure; no
558
844
  findings ledger, or one holding no row yet: `no findings recorded`; only nits open); `✗` failed (a
@@ -566,7 +852,10 @@ the answer.
566
852
  history of HEAD ends `· from <sha>` (the branch commit's hook record read for a merge on main; a
567
853
  record of an earlier commit of this line carries none), a rehearsal's record `· rehearsal`. A record
568
854
  of another tree than the one checked ends with `(the tree changed since)`: its line turns `!` and
569
- blocks the hand-over; a failed step stays `✗`.
855
+ blocks the hand-over; a failed step stays `✗`. The `tdd` line is the worktree's: it is stale only when
856
+ its record is of another tree than the worktree's now, never because the tree checked is a merge's;
857
+ once a merge hand-over is committed, its card keeps `! tdd ... (the tree changed since)` and `gates ran
858
+ on another tree: tdd`, since the worktree took the merge after its tdd verdict.
570
859
  The `mutation` line is what the package still owes its mutation runs, read from the mutation store when
571
860
  the card is written. `✗` (blocks): `new` survivors or died runs of the package, whatever their lot
572
861
  (`2 new survivors · 1 died run: dialecte mutants status`); a run of the branch still running when the
@@ -584,10 +873,14 @@ the answer.
584
873
  The `standard` line says whether the standard was consulted. A standard is configured when
585
874
  `DIALECTE_STANDARD` names a file or folder that exists (the environment only: no committed file names
586
875
  it). `✓ standard consulted · <note>` when one is configured and the station recorded a consultation;
587
- `✗ standard configured, not consulted: dialecte record standard <folder> consulted <note>` (blocks) when
876
+ `✗ standard configured, not consulted: dialecte lot standard <folder> consulted <note>` (blocks) when
588
877
  one is configured and none is recorded; `! standard not consulted: none configured (DIALECTE_STANDARD)`
589
- otherwise, with the recorded not-consulted reason when there is one: a warning that never blocks. The station records it
590
- with `dialecte record standard <folder> consulted <note>` or `not-consulted <reason>`.
878
+ otherwise, with the recorded not-consulted reason when there is one: a warning that never blocks. A DONE card
879
+ (committed) shows the state recorded on the lot, never one read from the shell that ran the hand-over:
880
+ `✓ standard consulted · <note>`, `! standard not consulted · <reason>`, or
881
+ `! standard not consulted: none recorded on the lot`. The station records it
882
+ with `dialecte lot standard <id|folder> consulted <note>` or `not-consulted <reason>` (the card's line
883
+ names the hand-over's folder).
591
884
  - `contrib` (a contributor's): the rows of the `dialecte contrib` record of the tree the hand-over commits,
592
885
  read as gate lines (`rules` with its errors and warnings, the package's steps, `release`), then the live
593
886
  `mutation` row. A stored record counts when its key is the one the `contrib` guard asks for: a run at
@@ -606,12 +899,13 @@ the answer.
606
899
  (`<n> proven red → green · <m> unchanged`, and `· <k> kept` when any); the accepted cases: a head
607
900
  line `<n> accepted`, then one row per reason of the lot file (`<count> <reason>`, the largest group
608
901
  first, a tie in the lot file's order, each reason wrapped under itself); the accepted and revised receipts
609
- of earlier lots, which the lot file no longer names, on one line
902
+ of earlier lots (cases outside the change), which the lot file no longer names, on one line
610
903
  (`earlier lots: 410 accepted, 12 revised (not in the lot file)`); then
611
- `<n> revised · <m> gone · <k> unused` with `to read ↓` at its right edge and one entry each: a revised case `<file> › <title>` (named by the lot file exactly, or by a file or glob entry)
904
+ `<n> revised · <m> gone · <k> unused · <j> skipped` with `to read ↓` at its right edge and one entry each: a revised case `<file> › <title>` (named by the lot file exactly, or by a file or glob entry)
612
905
  with its reason under it, a helper a red run froze for a `revised` entry as `revised <helper>` with its
613
906
  reason under it, a `gone` entry with its reason (whether one covers a finding is the gate's
614
- to say), an `accept` or `revised` entry no case used. Then one line per kind of flag with its count of
907
+ to say), an `accept` or `revised` entry no case used, a case of the change whose receipts the read
908
+ rule skips (`skipped <file> › <title>: 1 accepted receipt (no longer declared)`). Then one line per kind of flag with its count of
615
909
  cases (`dialecte tdd status --flags` lists them); cases whose only flag is `test code changed around it`
616
910
  and whose receipts are otherwise only unchanged are counted apart (a case flagged rollback or red after
617
911
  green never is), as
@@ -627,7 +921,33 @@ the answer.
627
921
  rehearsal's. The command stays under the box until every lot is committed. `dialecte handover --legend` prints every term the card can
628
922
  print, each in two lines: what it means, and whether to look.
629
923
 
630
- - `dialecte handover run <folder>` is what `commit.sh` runs. Each guard prints one line with its result
924
+ - `dialecte handover run <folder>` (and `--rehearse`) holds the machine awake while it runs, as `gate --full`
925
+ does, and writes `last-run.json` in the hand-over folder when it ends (before the card of a real run):
926
+ `sleptMs` when its wall time passed its monotonic time by over 60 s; the DONE card then prints
927
+ `! slept <duration> during handover run` in its gates.
928
+ - A hand-over written behind its target branch is not run. The card (READY or BLOCKED, `handover show <one>`)
929
+ prints `! main moved: merge main first (3 commit(s) on main, now 1a2b3c4d)` under its verdict, which reads
930
+ BLOCKED (`--json`: `targetMoved: { branch, ref, tip, behind }`). The target is held when its tip is an
931
+ ancestor of the lots file's HEAD or of a merge lot's tip. When some lots are committed already the line adds
932
+ `: write a new hand-over on the current HEAD with a merge lot of main`. A hand-over onto the target itself, a
933
+ committed one and an abandoned one are not judged; a lots file written before `target` existed is judged
934
+ against the base branch; a `target` that names no ref gives a `!` line with the refusal and BLOCKED.
935
+ - The card also lists the processes working in the worktree (`handover show <one>`, READY or BLOCKED; `lot
936
+ result`, the run picker and `handover list` never look): `✗ processes 2 left running in the worktree: 4123 node
937
+ …vitest --watch, 4177 npm run dev (stop them: kill 4123 4177)` blocks, `! processes open on the worktree:
938
+ code, zsh` and `! processes not known (<why>)` warn (`--json`: `processes: { leftBehind, tools, unknown? }`).
939
+ The run itself, its shell or agent, what it started and every process of its own process group (the other
940
+ commands of its pipeline, such as a `| grep` after it) are never listed: a leftover started in the same process
941
+ group as the cli (the same non-interactive shell command) therefore counts as the run's own. A process with a terminal, one
942
+ whose command (or an ancestor's) is a known editor or the one `git config dialecte.editor` names, and one
943
+ named in `git config dialecte.personProcesses` (a comma list of command names, never committed) is one of the
944
+ person's tools; every other process is left behind.
945
+ - `dialecte handover run <folder>` is what `commit.sh` runs. Two of its guards, `target` (the target branch's tip is held, as above) and
946
+ `processes` (read at run time, never from the card: a process left behind, or a list that cannot be read,
947
+ refuses; tools only pass with `!`), come after the merges guard. Either refusal
948
+ exits 2 with nothing committed, where every other guard exits 1; `--rehearse` prints `!` for each and goes
949
+ on. The merges guard's note for a merge lot of the target that moved reads `lot <n>: merges main at <sha>; main
950
+ is now <sha> (see target)`. Each guard prints one line with its result
631
951
  and its time (`✓ snapshot 110 file(s) 0.4 s`): repository, the lots file as reviewed, hooks
632
952
  folder, branch, HEAD, empty index, the files against the snapshot, deleted files, files outside the
633
953
  lots, references (citations, declared patterns, and the tags of a contributor), `contrib` in a contributor
@@ -677,8 +997,11 @@ the answer.
677
997
  `hook ✗`) and the log's path; a repository with no commit hook prints none of it (in husky's `.husky/_`,
678
998
  which holds a wrapper for every hook name, a hook counts only when its script exists in `.husky/`). Then the commit with
679
999
  its stat; the total time and the card at the end. A lot whose `git add` or commit fails is unstaged again: once the cause is fixed, the same command
680
- finds the lots already committed on top of the recorded HEAD (same message, same paths, same content)
681
- and resumes at the next one; anything else on top of HEAD is refused with what was found. It never
1000
+ finds the lots already committed on top of the recorded HEAD (same message, same paths, the bytes of the
1001
+ reviewed snapshot `files.sha256`, not the working tree) and resumes at the next one; anything else on top
1002
+ of HEAD is refused with what was found. When every lot is committed, the `head` line says the hand-over is
1003
+ already committed and the guards after it (they read the working tree, which later work may change) are
1004
+ not run: the run exits 0. It never
682
1005
  pushes. `--rehearse` first decides, per lot and before any clone, whether rehearsing it can find
683
1006
  something new, and prints one line per lot: `lot <n>/<N> reused <reason>` or
684
1007
  `lot <n>/<N> rehearse <reason>`. A plain lot is reused when the store holds a green `gate --full` of
@@ -715,7 +1038,11 @@ the answer.
715
1038
  repository's package.json that leaves the repository, to the folder the same path reaches from the
716
1039
  repository (`file:../core`: `<rehearsal folder>/core` -> the repository's `../core`), so the clone
717
1040
  resolves it as the checkout does; one line names the links, and a path that leaves the rehearsal
718
- folder too, or whose target is missing, is not linked (a line says why). The whole rehearsal folder is
1041
+ folder too, or whose target is missing, is not linked (a line says why). In a workspace (the
1042
+ repository's parent holds `.worktrees/`) the clone stays fresh but its `node_modules` is taken from the
1043
+ pool when an entry matches its lockfile (`node_modules: pooled _pool-<repository>-<n>`), parked back at
1044
+ the end, and the rehearsal folder goes to `.worktrees/_trash/`, removed in the background (removed here
1045
+ when the trash is on another file system). Elsewhere the whole rehearsal folder is
719
1046
  removed at the end - its links unlinked, never what they reach - (`--keep` keeps it and names it:
720
1047
  `kept the rehearsal folder: <path>`), and on Ctrl-C or SIGTERM, with the hook and every process it
721
1048
  started stopped. The clone's git folder holds a marker naming the process that made it
@@ -768,7 +1095,10 @@ the answer.
768
1095
  folder (the lots file, the snapshot) and the records - the lots found committed from the lots file's HEAD
769
1096
  to the tip of its branch, `DONE` when every lot is - and writes nothing: not in the folder, the store,
770
1097
  the worktree or its index, nor a lock or a run marker. A word without a path separator that names an
771
- entry of the store is that entry's folder; anything else is a path (relative to the current folder), and
1098
+ entry of the store is that entry's folder; else a number (`0171`, or unpadded `171`) names the newest
1099
+ entry of the worktree of that index (ranked by name as below, never by when it was written) - `run` and
1100
+ `abandon` take it the same way; anything else is a path (relative to the current folder: `./0171` is a
1101
+ folder), and
772
1102
  a registered folder given by its path still gets its name on the card. Without an argument: the newest
773
1103
  registered hand-over of the current branch (the latest date, then the highest counter, from the name),
774
1104
  whatever its state; none for the branch: the store's entries, one `name branch state` line each, exit
@@ -781,17 +1111,36 @@ the answer.
781
1111
  card. An unknown name, or a folder that is no hand-over: exit 2, naming it. `--json` answers the card
782
1112
  as data with its `folder` and `name`, as `dialecte handover --json` does, and `changedSinceReview` (the
783
1113
  count of that line).
1114
+ - `dialecte handover review <name|index|folder> [--json] [--print]` opens the hand-over's worktree (the lots
1115
+ file's `repository`) in one new editor window and returns at once: the editor is started detached, its output
1116
+ ignored, never waited for. The hand-over is named as `show` names it. For a hand-over holding a merge lot it
1117
+ first writes `<hand-over folder>/review/lot.diff`, the lot's own change against the lots file's `head` (what is
1118
+ committed on top of it, staged, unstaged, and the untracked files git would add; ignored files left out; no
1119
+ colour whatever the git config), read through a scratch index so the repository is left as it was, and opens it
1120
+ in the same window. The editor: the worktree's `git config dialecte.editor` when set (its words, split as a
1121
+ shell splits them, then the paths; no flag added), else the first editor of a fixed list the cli knows found as
1122
+ an executable file on `PATH` (searched by the cli, no shell; opened with its new-window flag), else
1123
+ `code --new-window`; `$EDITOR` and `$VISUAL` are never read. `--print` prints the command line it would run (each word that needs it shell-quoted, so
1124
+ it runs as copied) and starts nothing; with `--json` too it prints that answer and starts nothing; `--json` answers `{ editor, command, opened }`. Exit 2: no
1125
+ argument, an unknown hand-over, a worktree that is gone (naming it), or an editor that is no executable file
1126
+ (`editor <word> not found: set git config dialecte.editor`), nothing started; with `--json` a refusal answers
1127
+ `{ error }`, the message as written. Every READY card gets a `review`
1128
+ section after the gates, `dialecte handover review <name> (opens <editor>)` (`review: { command, editor }` in
1129
+ `--json`), read from `PATH` when the card is built; BLOCKED, DONE and ABANDONED cards have none.
784
1130
  - `dialecte handover run` without a folder runs the one registered hand-over still to run (its folder
785
1131
  pending or partly committed; `--rehearse` too): an abandoned, committed, stale or gone one is skipped.
786
1132
  Two or more: refused, nothing run and no run marker, one `name branch verdict` line each (`READY` or
787
1133
  `BLOCKED`, computed as `show` does), exit 2; none: says so, exit 1. `handover run <name>` runs that
788
- registered hand-over (a gone one: exit 2, naming its folder).
1134
+ registered hand-over (a gone one: exit 2, naming its folder). A hand-over in the folder of a `canceled` lot
1135
+ is not run, however it is named (exit 2 before any guard, naming the lot, nothing written).
789
1136
  - `dialecte handover abandon [<name|folder>]` gives up a hand-over that will not run: it writes
790
1137
  `abandoned.json` (when) in its folder, records its entry `abandoned`, then removes the lock of its worktree when the lock names this
791
1138
  folder's `commit.sh` (a lock naming another hand-over is left, said in one line). Without an argument:
792
1139
  the hand-over the current worktree's lock names; no lock: says nothing is held, exit 1. Refused (exit 2,
793
1140
  nothing written) while a real run of it is in progress, and once every lot is committed; a partly
794
- committed one may be abandoned, its commits stay. It never touches the index, a ref or a commit. An
1141
+ committed one may be abandoned, its commits stay. A lot folder is refused too (exit 2, nothing written):
1142
+ `<full name> is a lot: its hand-over is redone with dialecte handover write --rehash --out <full name>; to
1143
+ end the lot: dialecte lot stop <full name>`. It never touches the index, a ref or a commit. An
795
1144
  abandoned hand-over is `abandoned` in `list` and `show`'s listing, `ABANDONED` on its card (no run
796
1145
  command); `run` without a folder skips it, `run <it>` refuses (exit 2, naming the marker); abandoning it
797
1146
  again says it already is (exit 0), and `dialecte handover <lots.json> --rehash` of its folder is refused
@@ -803,14 +1152,41 @@ the answer.
803
1152
  its state - pending, partly committed, committed, abandoned, or stale when something else moved the branch. A
804
1153
  folder holding a hand-written `commit*.sh` and no lots file shows as "legacy script, state unknown".
805
1154
  - `dialecte worktree add <repository> <branch> [--from <ref>] [--json]` makes a worktree under the
806
- workspace's `.worktrees/<repository>-<branch tail>` (the last segment of the branch: `core-depth` for
807
- `feat/depth`; a new branch starts from `--from`, else the base
808
- branch): it copies the hooks folder `core.hooksPath` names (husky's `.husky/_` is ignored by git, so a
809
- plain worktree misses it), copies the main checkout's `node_modules` copy-on-write where the file system
1155
+ workspace's `.worktrees/<index>-<repository>-<branch tail>` (the last segment of the branch:
1156
+ `0171-core-depth` for `feat/depth`; a new branch starts from `--from`, else the base
1157
+ branch; a `<repository>` that is no folder, or a folder in no git repository, is refused in one line, exit
1158
+ 2): it copies the hooks folder `core.hooksPath` names (husky's `.husky/_` is ignored by git, so a
1159
+ plain worktree misses it), takes a `node_modules` from the workspace's pool when one matches (below), else
1160
+ copies the main checkout's `node_modules` copy-on-write where the file system
810
1161
  can (links kept, a relative link to a sibling re-pointed so it still reaches it) - from the worktree that
811
1162
  has the `--from` branch checked out when it has one, else from the main checkout - lists `.dialecte/`
812
1163
  once in the exclude file of the repository's common git folder (so for the main checkout and every
813
1164
  worktree of it), and writes the hygiene baseline `gate --fast` compares with; it prints a card.
1165
+ The index is 4 digits at least (`0001`, past `9999` it grows), one counter per workspace so the latest
1166
+ worktree sorts last: 1 + the highest of the claims in `.worktrees/.index/` (one empty file per index ever
1167
+ taken) and the numbered folders and links of `.worktrees/`. A claim is created only where none exists,
1168
+ so two runs at the same moment, of any repositories, never take the same index (the other takes the
1169
+ next), and a number stays taken after its worktree is removed. Unnumbered folders and the sibling links
1170
+ (`.worktrees/core`) count for nothing and are never renamed. `--json` carries `index`.
1171
+ The pool: a finished checkout's `node_modules` waits in `.worktrees/_pool-<repository>-<n>/node_modules`,
1172
+ with a `pool.json` beside it (`{ repository, lockHash, parkedAt }`, `lockHash` the sha256 of the
1173
+ `package-lock.json` it was checked against), at most two entries per repository (parking a third sends
1174
+ the oldest to the trash). A park (`lot close`, the end of a rehearsal) takes only a `node_modules` that
1175
+ matches its `package-lock.json` (as `worktree add` reads it), rewrites absolute, in place, every link inside
1176
+ it whose relative target leaves its checkout (a sibling repository; a link into the checkout itself, an npm
1177
+ workspace package, stays relative and reaches the taker's own package), renames the folder into a new entry (no file is copied),
1178
+ sends `node_modules/.vite` and `node_modules/.cache` to the trash (or leaves them in the folder already
1179
+ going there), then writes `pool.json`; a `_pool-*` folder without one is a park that never finished,
1180
+ never taken, and `worktree prune` names it as left over. `worktree add` takes the newest entry of the
1181
+ repository whose `lockHash` is the new worktree's `package-lock.json` hash (a rename: two takers never
1182
+ share one, the second goes on to the next entry), then reads it against the lockfile as it reads a copy.
1183
+ No match, an empty pool or a rename across file systems: the copy. The card's `node_modules` row says
1184
+ which and how long (`pooled _pool-cli-1 0.1 s`, `copy-on-write 46.2 s`); `--json` carries
1185
+ `nodeModules: { method, from?, seconds }`. The trash: `.worktrees/_trash/` - a worktree goes there by
1186
+ `git worktree move` (git keeps it registered) then a background `git worktree remove --force`, a folder
1187
+ by a rename then a background `rm -rf` of that one path; nobody waits for either. A folder left there (a
1188
+ sleep, a crash) stays for you to look at. The pool and the trash are used only where the repository's
1189
+ parent holds `.worktrees/`.
814
1190
  Before the copy it makes the links the worktree's `file:` and `link:` dependencies need (`dependencies`,
815
1191
  `devDependencies`, `optionalDependencies`, `peerDependencies`): a relative path that leaves the worktree
816
1192
  into the workspace's `.worktrees/` (`file:../core` from `.worktrees/cli-x` reaches `.worktrees/core`)
@@ -838,6 +1214,143 @@ the answer.
838
1214
  (`lockfile`, `notChecked`, `problems`: `package`, `problem`; `command` when there are problems). The
839
1215
  exit code stays 0 whatever the links and the lockfile say: the worktree exists, and its card says what
840
1216
  to run.
1217
+ - `dialecte lot start <brief.json> [--effort low|medium|high] [--dry-run] [--simulate <scenario>] [--json]` starts a lot from its brief
1218
+ (`schema`, `feature`, `repository`, `branch`, `base`, `goal`, `plan`, `scope`, `steps`, `lots`, `effort`).
1219
+ Every check runs first and every refusal is printed at once (`<field>: <rule> - <detail>`, `{ refused }` with
1220
+ `--json`, exit 2), before anything is created: the fields, the repository's main checkout, a new valid branch,
1221
+ a base that resolves to a commit, the plan and each step's heading in it, the scope and the lots covering it
1222
+ (a lot path is inside a scope entry by path segments: `lib/x` is inside `lib/`, `lib-other/x` and `libx` are
1223
+ not; an entry whose glob cuts a name, `src/data*`, compares by string prefix), no
1224
+ overlap with an open lot of the same store. Then it claims the next worktree index, publishes the lot folder
1225
+ `<git common folder>/dialecte-lots/<index>-<repository>-<branch tail>/` (the brief, a copy of the plan, the
1226
+ first transition, `identity.json` last; every record written once, read-only), makes the numbered worktree at
1227
+ the recorded base commit and its `.dialecte/lot` link to the lot folder. The store is appended to the user's
1228
+ store list (`$XDG_STATE_HOME/dialecte/lot-stores`, else `~/.local/state/dialecte/lot-stores`), refused when
1229
+ that list sits inside a git work tree. `--dry-run` runs the checks (the store-list refusal included, no
1230
+ hard-link probe), names the lot and the start to run next (`next: dialecte lot start <brief path as given>`),
1231
+ writing and claiming nothing. A worktree that cannot be made leaves the lot
1232
+ `failed` (exit 1), nothing removed, with `next: dialecte lot stop <full name> --reason <text>`; a link that
1233
+ cannot be made leaves the lot working (exit 0, a `note:` line, `notes` in JSON; `lot status` reports the link
1234
+ missing). Every `--json` exit is JSON: `{ lot, folder, worktree, runner, notes, next }` started,
1235
+ `{ dryRun: true, lot, worktree, next }` dry run, `{ lot, folder, state, reason, next }` failed,
1236
+ `{ refused, next: null }` a refused brief, `{ error, usage, next: null }` a usage error (exit 2),
1237
+ `{ error, next: null }` any other exit before a lot exists.
1238
+ - `dialecte lot status <id> [--json]` derives the lot's state from its records (`working`, `input-required`,
1239
+ `ready`, `committed`, `canceled`, `failed`), with the worktree and link checks and the exact next command (the
1240
+ text form adds an `also:` line when there is one, five lines at most); it
1241
+ reads files only, runs no git and writes nothing. A damaged lot (a folder of the store whose name has a lot
1242
+ name's shape and whose records do not hold: no readable `identity.json`, one naming another folder, or a record
1243
+ that fails its check) answers `<name> damaged: <reason>` then `next: dialecte lot stop <name> --reason <text>`
1244
+ (`{ lot, state: "damaged", reason, next }` with `--json`), exit 6, never `no lot`; the reason is a fixed word
1245
+ of the cli, never a field of the record, and a lot with an unreadable identity is named by its folder. Exit 0 for a lot found, 2 for an unknown or ambiguous id
1246
+ (`{ error, next: null }` with `--json`) or a usage error (`{ error, usage, next: null }`). An
1247
+ `<id>` is an index (`171` = `0171`), a full name, a lot folder or `.dialecte/lot`; a word naming an existing
1248
+ folder is that folder; a damaged lot is named by its id (index or full name), a path to it does not find it. The review rounds' verbs take `<id|folder>` the same way (a write needs an index
1249
+ unique across every store of the list), and a lot folder is accepted as their hand-over folder although it
1250
+ sits in the git folder. Two workspaces of the store list may give the same full name (the same index,
1251
+ repository folder name and branch tail): that name is then ambiguous (exit 2 listing both); give the lot
1252
+ folder instead.
1253
+ - The host loop: `lot start -> lot wait -> (lot answer -> lot wait)* -> lot result`. Every output names the exact
1254
+ next command with the lot's full name, and the exit code says what the host does next (section below). Every
1255
+ answer of `status`, `wait`, `answer`, `result` and `stop` goes to standard output, whatever its exit code; only
1256
+ a usage error or a refusal (exit 2), and an answer hook that threw (exit 1 of `answer`), go to standard error.
1257
+ `inbox` follows the same rule (its exit 1, nothing waits, is an answer). `lot start` stays outside it: a
1258
+ refused start (exit 2) or a failed one (exit 1, the lot `failed`) is an error on standard error, naming the lot
1259
+ and its next command. The answer line of a caller's question carries no `--by` (it defaults to `caller`); a person's names
1260
+ `--by <who>`.
1261
+ - `dialecte lot wait <id> [--timeout <seconds>] [--json]` returns the status as soon as the lot needs someone:
1262
+ exit 0 `ready` or `committed`, 1 `failed` or `canceled`, 3 `input-required` (at once, every time, costing
1263
+ nothing), 4 when the last transition is a limit (run again), 5 when `--timeout` is reached while the lot still
1264
+ works. A real lot is looked at every second, by a stat of its folders and of the registry, and read again only
1265
+ when one changed, nothing written; on a terminal a `waiting <name> (<state>,
1266
+ <elapsed>)` line refreshes (never under `--json`). A simulated lot is played up to its next blocking point; one
1267
+ with nothing left to play (no `scenario.json`, or every step played) never waits: it answers its state at once,
1268
+ as `lot result` does (a working lot: exit 5), whatever `--timeout`. A damaged lot answers at once with exit 6,
1269
+ as `lot status` prints it.
1270
+ - `dialecte lot answer <id> <question> "<answer>" [--by <who>] [--json]` records the answer to an open question
1271
+ once, then prints the status with `next: dialecte lot wait <name>`. The answer is one line; a question with
1272
+ options takes one of them (compared trimmed, case-folded, recorded as the option is written); the same answer
1273
+ again is `already`, another one is refused. A person's question needs `--by <who>` (not `caller`); a caller's
1274
+ defaults to `caller`. `--by` is one line, not empty, checked before the lot is read (exit 2 naming `--by`).
1275
+ A refusal's text form escapes the options, answer and `--by` it quotes (a line feed in them prints as
1276
+ `\u{a}`, the refusal stays one line); `--json` carries them as stored. A damaged lot takes no answer (exit 2,
1277
+ naming the lot, its damage and the stop to run; nothing written).
1278
+ - `dialecte lot result <id> [--json]` never blocks and writes nothing. A `ready` or `committed` lot exits 0 with
1279
+ `{ lot, state, handover: { name, folder, state, card, show, run }, worktree, branch, questions, simulated }`:
1280
+ the card is the one `handover show --json` computes, `handover.state` the hand-over's own state read from git
1281
+ (`committed` once its lots are committed, even before the registry says so), `questions` the answered ones
1282
+ (`{ id, text, answer, by }`); a simulated lot's `handover` is `{ simulated: true }`, nothing to show or run.
1283
+ `failed` and `canceled` exit 1 with `{ state, reason, at, position }` of the last transition, `input-required`
1284
+ exits 3 with the open questions, `working` exits 5, a damaged lot exits 6 (as `lot status` prints it). The text
1285
+ form prints agent text escaped.
1286
+ - `dialecte lot stop <id> --reason <text> [--by <who>] [--json]` ends a lot. A `committed` lot is refused
1287
+ (exit 2). A pending hand-over is abandoned first, as `handover abandon` does (`abandoned.json`, the registry
1288
+ entry `abandoned`, the lock released when it names that hand-over); while its run is in progress, or once it is
1289
+ committed, the stop is refused (exit 2) and publishes nothing. Then a `canceled` transition (cause `stop`, the
1290
+ reason, `--by` or `caller`), and the registry is read once more: a hand-over registered meanwhile is abandoned
1291
+ at once. A lot already `canceled` exits 0 writing nothing; one whose entry is still `pending` (a crash inside an
1292
+ earlier stop) is repaired. It moves no worktree and deletes nothing; `lot close` and `worktree prune` let the
1293
+ worktree go once the lot is canceled. The reason and `--by` are one line, not empty (exit 2). A damaged lot is
1294
+ stopped by moving its folder aside, never deleted and nothing written into its broken records first: to
1295
+ `<git common folder>/dialecte-lots-aside/<name>` (`-2`, `-3`, ... appended when the name is taken, an empty
1296
+ folder included), with a `stopped.json` (`reason`, `by`, `at`, `damage`) inside the moved folder (a lot folder
1297
+ that is a symbolic link: the link is moved, never its target, and the record is `<aside name>.stopped.json`
1298
+ beside it). It prints `stopped <name>: damaged (<reason>); its folder is now <path>` (`{ lot, state:
1299
+ "moved-aside", damage, folder }` with `--json`). Its index stays claimed, its worktree and branch stay; refused
1300
+ (exit 2, nothing moved) while a live run marker holds the folder or a pending registry entry names it (first:
1301
+ `handover abandon <entry>`); a stop that finds the folder gone (another
1302
+ stop moved it) says `no lot <id>`. Until it is moved aside, a damaged lot holds its paths: the scope of its
1303
+ `brief.json` when that reads as a list of texts, else every path, so `lot start` refuses an overlap with it
1304
+ (`overlap with <name> (damaged: <reason>): ...`, or `its scope cannot be read: it holds every path`); one whose
1305
+ identity reads simulated holds none.
1306
+ - `dialecte lot start --simulate <scenario>` starts a simulated lot that plays one of the scenarios (`ready`,
1307
+ `question`, `person`, `two-questions`, `limit`, `failure`, `slow`) under `lot wait`, publishing the records a
1308
+ real run would: it writes only its lot folder, one line of the store list and one index claim, never a branch,
1309
+ a worktree or a registry entry, and never blocks a real lot. A host proves its loop on it before a real run.
1310
+ With `--dry-run` it is the dry run of that simulated start: exit 0, the findings a real start would refuse for
1311
+ listed (`wouldRefuse` in JSON, `worktree: null`), no worktree named, and `next` the same start with
1312
+ `--simulate <scenario>`; nothing claimed or written.
1313
+ - `dialecte inbox [--repository <name>] [--simulated] [--json]` lists what waits on someone across every store of
1314
+ the store list and the store of the current folder: one line per open question (person questions first, then
1315
+ caller questions), then the ready lots, then the failed ones, by index within a group, each line
1316
+ `<index> <repository> <branch> <what> <next command>`, where `<what>` is `question q<k> (person|caller)
1317
+ <question text>`, `READY` or `FAILED <reason>` and the next command is the lot's own (the answer line of that
1318
+ question, `handover show`, `lot result` or `lot stop`); then `working <n> · simulated <m> (listed with
1319
+ --simulated)`. `--repository` keeps the lots whose repository folder has that name, `--simulated` lists the
1320
+ simulated lots that wait. A lot folder whose `identity.json` does not read, or whose records do not hold, is a
1321
+ `damaged <folder>: <reason>; next: dialecte lot stop <name> --reason <text>` line (a `.tmp-` folder being built,
1322
+ or a folder whose name has no lot name's shape, is no lot). The records are checked once, on read: a question id is `q<k>` (k 1 or
1323
+ more), an audience `caller` or `person`, a position's step, of and round non-negative integers, a transition's
1324
+ `at` a time, an answer file's question its file's `q<k>`. Every lot verb names such a lot damaged (exit 6 for
1325
+ `status`, `wait`, `result`; `answer` refuses, exit 2), so no forged field reaches a line or a `next`. It reads files only (each registry once per store), runs no process, writes nothing. `--json`:
1326
+ `{ waiting: [<status of each waiting lot>], working, simulated, damaged }`. Exit 0 when something waits or is
1327
+ damaged, 1 when nothing does, 2 for a usage error.
1328
+ - `dialecte plan next <plan.md> [--json] [--all]` reads a plan's lot block (one fenced block with the info string
1329
+ `json dialecte-lots` in the plan, or `<plan without .md>.lots.json` beside it; both or neither is refused) and proposes what can
1330
+ start now; it starts, claims and writes nothing. Each entry declares an `id`, a `kind` (`lot`, `fix`, `spec`,
1331
+ `person`), `dependsOn`, a `scope` per repository (`"."` is the whole repository), extra `heavy` steps
1332
+ (`mutation`, `browser`, `release`), a `brief`, and a `match` (`branch`, `handover`, `feature`) by which its
1333
+ records are found; the block's `shared` files (the changelog, the README, the command map) never hold a lot back.
1334
+ An entry's state is read, never declared: done by a committed hand-over or store lot, open by a store lot, a
1335
+ pending hand-over or a worktree on its branch, else ready, waiting, parked, or unknown with the reason when its
1336
+ repository cannot be read (files only: the stores, the registries, `worktrees/*/HEAD`; no git process). The text
1337
+ says the counts, the open lots (and open work no entry accounts for: its repository's proposals are
1338
+ `unverified`), the lots that can start in critical-path order (`unblocks 7 (chain 4)`, `after <id>`, `merge:
1339
+ <open lots>`, `next: dialecte lot start <brief>` or the brief to write), the ready lots held by an open one with
1340
+ each scope pair met, person entries without a mark, the spec work (a spec missing or `DRAFT`), what each entry
1341
+ waits for, the parked ones, then the machine: the live heavy steps with their worktree and age, the load against
1342
+ twice the cores, the free and inactive memory against 2 GB (`vm_stat` on macOS, `/proc/meminfo` on Linux); a
1343
+ proposal whose heavy steps would run beside a live one says `stacks:`, and on a short machine its heavy steps
1344
+ would wait (advice only). `--all` lists the done entries; `--json` answers `{ plan, repositories, counts,
1345
+ entries, proposals, held, specWork, heavy, unknown }`. Exit 0 when a lot or fix can start, 1 when none can, 2
1346
+ for a usage error, no block or an invalid one (every fault listed), or a repository that is not a git checkout.
1347
+ `dialecte plan check <plan.md> [--json]` checks the block alone: one line when valid, else every fault (exit
1348
+ 2). `dialecte plan mark <plan.md> <id> done --by <who> [--reason <text>]` records a person entry's mark once in
1349
+ the machine's state folder (`<state>/dialecte/plans/`); a `lot` entry's state comes from its records and is
1350
+ refused.
1351
+ - `.dialecte/lot` reaches the lot folder, whose `round-<n>/` snapshots hold copies of the lot's files, tests
1352
+ included. Leave `.dialecte/` out of every tool that walks the worktree: a test runner whose globs include dot
1353
+ folders, a formatter, a linter. Git already leaves it out (`worktree add` excludes it).
841
1354
  - `dialecte lot exempt <reason>`, `lot accept <case> <reason>`, `lot revised <case|file|glob> <reason>`,
842
1355
  `lot gone <file|glob> <reason>` write the lot declaration `.dialecte/lot.json` at the package root (the
843
1356
  nearest package.json above the current folder) as tab-indented JSON, keeping what it holds; the same
@@ -846,11 +1359,175 @@ the answer.
846
1359
  - `dialecte lot mutation <off|changed|audit|gate>` writes the lot's mutation switch (`"mutation"`, no
847
1360
  reason). Without it, `dialecte mutants run` mutates the changed lines when the lot's diff touches the
848
1361
  declared scope and nothing otherwise; `audit` mutates the whole scope; `gate` runs as `changed`.
1362
+ - `dialecte lot standard <id|folder> consulted <note> | not-consulted <reason>` writes `<folder>/standard.json`
1363
+ (`{ state, note, at }`, the note's words joined by single spaces) for the card's `standard` line; the line
1364
+ references of what was read stay in the findings ledger. Another state, or no note, is a usage error
1365
+ (exit 2); a folder inside a repository is refused as below.
1366
+ - `dialecte lot finding`, `decide`, `snapshot`, `choice` and `delta` keep a lot's review rounds in its
1367
+ lot folder, or in a hand-over folder (`_commit-plan/<topic>-<date>/`) that stays outside every repository:
1368
+ each refuses any other folder inside a git work tree or a git folder (`.git/`, a bare repository). `--` ends the options: the
1369
+ words after it are taken as they are, so a finding or a reason may start with `--`. Each writes its file
1370
+ whole (a temporary file renamed over it), so a reader never sees half a ledger.
1371
+ - `lot finding <id|folder> --round <n> --severity <blocking|should-fix|nit> --at <file:line> <finding>`
1372
+ appends the row `| R<n>-<k> | <n> | <severity> | <file:line> | <finding> | open |` to
1373
+ `<folder>/findings-ledger.md` (the folder, the file and its table made when absent; k one past the
1374
+ highest of the round). A `|` is written `\|`; a line break is refused. A hand-written ledger keeps
1375
+ every other byte.
1376
+ - `lot decide <id|folder> <finding> <state>` rewrites that row's state cell: `open`, `fix-to-verify`,
1377
+ `fixed <round> [note]` (a round after the one that raised it), `accepted <reason>`, `logged <where>`.
1378
+ An id not in the ledger is refused, naming the ids it holds.
1379
+ - `lot choice <id|folder> --by <who> <decision>` appends `| <decision> | <who> | <yyyy-mm-dd> |` to
1380
+ `<folder>/decisions.md` (made with its title and table when absent): a decision made outside the
1381
+ findings ledger, the user's above all. A `|` is written `\|`; an empty `--by`, a line break, or more
1382
+ than one decision word (quote it) is refused.
1383
+ - `lot snapshot <id|folder> --round <n>` copies every file `git status --porcelain -z
1384
+ --untracked-files=all` lists at the worktree root (the old path of a rename included) to
1385
+ `round-<n>/` at its repository-relative path - bytes, mode, a symlink as a symlink; a path gone from
1386
+ disk (or now a folder) that HEAD holds goes in `round-<n>.deleted`, NUL-separated, sorted; HEAD in
1387
+ `round-<n>.base`. An existing round, an untracked nested repository and a submodule (a gitlink in the
1388
+ index or at HEAD) are refused; a run that
1389
+ stops part-way leaves only `.partial` names, which the next run removes. `.dialecte/lot.json` is
1390
+ never part of it.
1391
+ - `lot delta <id|folder> --round <n> [--worktree] [--json]` (n ≥ 2) prints, for each file of
1392
+ `round-<n-1>/`, of `round-<n-1>.deleted` or of the worktree's status, what changed since round n-1,
1393
+ in the form that fits where the file is: the snapshot copy against the worktree file (or
1394
+ `/dev/null` when it is gone), `/dev/null` against a file deleted then and back now or new and absent
1395
+ from the base, `git diff HEAD` for a file round n-1 had at the base. Files unchanged since round n-1
1396
+ are left out; colour, external diff and textconv settings never apply. It refuses when HEAD moved
1397
+ since `round-<n-1>.base`, and refuses a nested repository or a submodule as `lot snapshot` does. `--worktree` adds a throwaway worktree on the branch
1398
+ `<lot branch>-round-<n-1>` from the lot's branch tip, in `.worktrees/<index>-<repository>-<branch
1399
+ tail>-round-<n-1>` with the lot's own index when its worktree is numbered (no new claim; else the
1400
+ workspace's next): the deletions applied with `git rm
1401
+ --pathspec-from-file`, then `round-<n-1>/` copied over, so a new test can run on the old code; it
1402
+ prints its path and the removal command with its absolute `cd`. The lot's worktree is never
1403
+ changed. Its `node_modules` comes from the pool, or a copy, as for `worktree add`.
1404
+ - `lot close <hand-over name|index>... [--json]` closes finished lots: for each hand-over of the registry
1405
+ named (by its name or its worktree's index) whose state is `committed` or `abandoned`, its worktree (the
1406
+ path the registry entry holds) is closed: every decision first, for every argument with every rule, its
1407
+ own state and branch included (one worktree reached by several names or indexes closes only when every
1408
+ one of them may close, and then once, the other arguments answered "the same worktree as ..."; when one
1409
+ keeps it, every one of them is kept, each line with the reason), its
1410
+ `node_modules` read against the lockfile where it is; then the links of its `node_modules`
1411
+ made absolute where they are, the worktree moved to the trash (`.worktrees/_trash/`, by
1412
+ `git worktree move`), its `node_modules` parked in the pool (`.worktrees/_pool-<repository>-<n>`) from
1413
+ there, its caches (`.vite`, `.cache`) sent to their own `_trash/` entries, and last the trashed worktree
1414
+ removed in the background by `git worktree remove` without `--force`: git refuses a worktree written into
1415
+ since the check, which then stays registered in `.worktrees/_trash/` for you to look at (one line says so
1416
+ when something closed). Paths are compared by their real path as spelled on disk (a path typed in another
1417
+ case on a case-insensitive volume matches). Before the move, the lot's final record is kept: the card line
1418
+ of its `cards.log` (the one `handover run` wrote when it committed; else a recomputed one, marked
1419
+ `recomputed`, built without the probe), read back and parsed, then a `removing` line naming the worktree,
1420
+ its branch and the branch tip; after the move a `removed` line says `trashed` or `kept`. Kept also, with
1421
+ why: `final record not kept: <reason>` when the record cannot be written or read back, and `the lot's
1422
+ commit is not known` (with where to look and how to remove the worktree by hand) when a committed lot's
1423
+ commit can be found neither among its lot commits nor in the worktree's hook record (read only when no
1424
+ other committed hand-over shares the worktree). Every other hand-over of the worktree gets its card line
1425
+ too, `head` its last lot commit or `null`. Kept,
1426
+ with why and nothing done for that hand-over: first, a worktree a lot of the repository's store names
1427
+ (by real path) while the lot is not `committed` nor `canceled`, reason `lot <full name> <state>` (the
1428
+ store read once, no git process per lot); a hand-over still `pending`; its worktree is the main
1429
+ checkout (never parked, moved or trashed); no registered worktree at that path (closed already, or one
1430
+ in the trash or the pool: never a target again); a worktree on another branch than the hand-over's
1431
+ (both branches named: it holds other work now); a `locked` worktree (`git worktree lock`); another
1432
+ hand-over registered for the same worktree that is neither `committed` nor `abandoned` (named); a mutation
1433
+ run started from it that still runs or died before reporting; `lot close` itself run from inside it
1434
+ (run it from another folder); a process whose working folder is in it;
1435
+ the processes not known (`lsof` failed or took longer than 20 s); a link from outside the worktree
1436
+ pointing into it (`the link <path> points to it`: the links directly in the workspace, `.worktrees/`,
1437
+ `_commit-plan/` and the scratch roots, and those in `node_modules/` and `node_modules/@*/` of every
1438
+ worktree and main checkout of the workspace's repositories, read once per call; the worktree's own links
1439
+ never count); a `dirty` worktree (anything
1440
+ `git status --porcelain --untracked-files=normal` lists, untracked files included whatever
1441
+ `status.showUntrackedFiles` says); a HEAD reflog reaching commits that neither the hand-over's branch, the
1442
+ base branch nor a remote-tracking ref holds (a commit made on a detached HEAD: the reflog goes with the
1443
+ worktree); ignored files its removal would delete that nothing else holds (`ignored files git worktree
1444
+ remove would delete: .env`, the first three named past three): rebuilt folders (`node_modules/`, `dist/`,
1445
+ the VitePress caches, the hooks folder, the `dialecte.rebuiltIgnored` folders), `.DS_Store`, the
1446
+ `.dialecte/lot` link, a `.dialecte/lot.json` that is empty or byte-equal to the one archived by a
1447
+ committed hand-over of this worktree, and files byte-equal, mode included, to the same path in the main
1448
+ checkout go; anything else keeps it, `.dialecte/notes.md` included. The branch is never touched (`worktree prune` still lists the merged
1449
+ ones). Each line names the folder it moved and where `node_modules` went (`closed <name>: 0007-cli-x;
1450
+ node_modules pooled in _pool-cli-1`, or `trashed: <why it was not parked>`); a failure part-way keeps
1451
+ that hand-over with the error and what was already moved, the others go on. A hand-over it closes gets
1452
+ `closed` (the time) on its registry entry; closing it again prints `<name> already closed`, nothing
1453
+ decided nor moved (an entry without it, a worktree removed by hand, is still kept: `nothing to close`).
1454
+ Exit 0 when every named hand-over closed (or was already closed), 1 when one was kept, 2 for a name or
1455
+ index the registry does not hold (then nothing is closed); `--json` prints
1456
+ `[{ handover, closed: true, already?: true } | { handover, kept }]`.
1457
+ - Recording a lot. Every record below is appended to a file, never rewritten; a reader skips a half line and a line
1458
+ it cannot parse, and counts them.
1459
+ - `dialecte lot station <id> start <station> [flags]` and `lot station <id> end <station> [--run <run>] [flags]`
1460
+ append one station event to the lot's `events.jsonl` (`by: host`): the host says which station ran, with
1461
+ which step, round, attempt, agent, vendor, model, tier, effort, session and skills (`--skill` seen,
1462
+ `--skill-asked` asked by the brief), and, at its end, tokens (`--tokens-in`, `--tokens-out`,
1463
+ `--tokens-cache-read`, `--tokens-cache-write`, `--tokens-total`), `--money <amount> <currency>`,
1464
+ `--duration`, `--exit`, `--verdict` and `--suite <name>=<runs>` for suites the agent ran itself. Nothing but
1465
+ the station is required; a field nobody gave stays unknown. `start` answers a `run` and the `end` command to
1466
+ run; `end` pairs with `--run`, else with the one open start of its station whose step, round and attempt match
1467
+ the ones it gives (several: refused), else is recorded alone. `--event <id>` makes a retry safe: the same id
1468
+ with the same fields answers the first event (`already`) and writes nothing, other fields are refused.
1469
+ `start` is refused on a committed, canceled or failed lot, `end` is accepted in every state. The station
1470
+ names `shared` and `outside` are the report's own labels and are refused. `lot station <id> --from
1471
+ <file.json>` takes the same fields as one JSON object, plus `phase` (`start` or `end`); an unknown key
1472
+ is refused, every fault at once. A line over 4,096 bytes is refused. Exit 1 when the event cannot be written, 2
1473
+ for a usage error or a refusal.
1474
+ - Step events: the cli writes `step.start` and `step.end` events (`by: cli`) into the lot's `events.jsonl` for
1475
+ `gate --fast`, `--full`, `--release` and `--hook`, `contrib`, `tdd red`, `tdd green`, `mutants run`,
1476
+ `handover run` (real and rehearsal), `lot delta --worktree` and `worktree add`: the step, whether it is heavy,
1477
+ its exit, its time, whether a gate reused records, and per gate step its status, counts, time and selection. A
1478
+ step in a worktree that links no lot, or none matching, writes nothing. A write that fails prints one
1479
+ `events: not recorded: <reason>` line and never changes the step's exit; a step killed after its start writes
1480
+ its end as interrupted where it can. Long lists are cut, failing parts first. A step run in a worktree whose
1481
+ link names a lot that lives elsewhere (a copied or moved worktree) is written to that lot as `step.foreign`.
1482
+ - `dialecte.stepEvents` in the cli's own `package.json` (`"stepEvents": 1`) tells a host that this cli writes step
1483
+ events. Each event notes the capability of the cli installed in the lot's worktree; a cli without it (an
1484
+ older release or source) writes none, so the report shows the step counts of such a lot as unknown rather
1485
+ than 0.
1486
+ - Heavy steps (`gate --full`, `--release`, `contrib`, `mutants run`, a rehearsal, a gate step the package
1487
+ declares heavy, and for the last only while that part runs) write a live marker in
1488
+ `<state folder>/dialecte/heavy/` (`$XDG_STATE_HOME`, else `~/.local/state`): the step, the lot, the
1489
+ worktree, the process and its start time. The step removes it at its end; a marker whose process is gone, or
1490
+ runs with another start time, is dead and ignored. A person's run outside any lot writes the marker too, and
1491
+ no event. This is how a host sees which heavy step runs now, and since when.
1492
+ - `dialecte lot report <id> [--json]` reads files only (no git, no process, nothing written) and prints one lot:
1493
+ its state, feature, effort, steps and rounds; per station run the agent, tier, model, tokens, time, suites
1494
+ and skills; totals for tokens (each field with how many stations did not report it, a lower bound when a
1495
+ total is not exact), money per currency (with how many stations reported none), and time (the lot's elapsed time as agents, cli steps, waiting for
1496
+ answers, waiting for the machine and the rest); the suites per step family with their counts, reuse and
1497
+ reruns, attributed to the station whose time holds the step (`shared` when several, `outside stations`
1498
+ when none, and always for the steps the orchestration runs; a step a person runs by hand during a
1499
+ station lands on that station); the heavy steps, the folders (worktree add, throwaways, trash), the review
1500
+ rounds from the findings ledger, the events counted (damaged, duplicates, unknown kinds) and the next
1501
+ command. A number nobody reported is `unknown` in the text and `null` in `--json`, never 0. A step family
1502
+ reads unknown, with the reason, when the worktree's cli writes no step events, when a record of a step has
1503
+ no run in the events, or when nothing of the lot's steps left a trace. `dialecte lot report --feature <name>
1504
+ [--simulated] [--json]` gives one line per lot of the feature, in every store of the store list and the
1505
+ current folder, then the totals by station and by tier; simulated lots are counted apart and listed by
1506
+ `--simulated`; a lot whose folder is gone is listed from its `cards.log` line. Exit 1 when the feature names
1507
+ no lot, 2 for an unknown or ambiguous id.
1508
+ - The hand-over card gains a `usage` row (tokens, agents, runs, agent time, and the report's command) when the
1509
+ hand-over folder is a lot folder holding a station event; `handover show --json` carries `usage`. A folder
1510
+ with no station event shows no row.
1511
+ - `cards.log`, in `<git common folder>/dialecte-handover/`, one per repository: one JSON line per record,
1512
+ appended in one write, never rewritten, never rotated. A `card` line is a lot's final record: its hand-over
1513
+ card, usage and the times of its gate, tdd and hook records (a worktree's records go with it), written by
1514
+ `handover run` once a commit is recorded, or by `lot close` when none exists. A `removing` line is written
1515
+ before a worktree moves (its path, branch, branch tip and record times), a `removed` line after it (the same
1516
+ id; `trashed` or `kept`). A `removing` without its `removed` reads as unknown. The report reads these lines
1517
+ for lots whose worktree or folder is gone.
1518
+ - `dialecte lot export <id> <dir> [--json]` copies a lot folder to `<dir>/<full name>/`, `asks/` left out, links
1519
+ kept as links (one pointing outside the folder is named), with the lot's `cards.log` lines and registry
1520
+ entry added as `cards.log` and `registry.json`. It is refused (exit 2, nothing written) for an unknown or
1521
+ ambiguous id, for a `<dir>` inside a git work tree or a git folder, and when `<dir>/<full name>` exists.
1522
+ The copy is made into a temporary folder beside it and each file's size and checksum compared with the
1523
+ source's (`events.jsonl` as a prefix, since a running lot appends); a difference makes one more copy of
1524
+ that file, a second one removes the temporary folder and exits 1 naming the file; a match renames it. The
1525
+ source is never written; another run's temporary folder is named, never removed.
849
1526
  - `dialecte mutants run [--mode changed|audit] [--base <ref>]` runs StrykerJS (resolved from the package,
850
1527
  its devDependency) on the scope `package.json` declares:
851
1528
  `"dialecte": { "mutation": { "scope": [...], "exclude": [...], "errorFactories": [...], "fast": { "vitestConfig": "..." }, "full": { "command": "..." } } }`.
852
- `changed` mutates the scope lines changed since the merge base with the base branch (`dialecte.baseBranch`,
853
- `main` when not said; then the remote's default branch, `refs/remotes/origin/HEAD`; with neither the run
1529
+ `changed` mutates the scope lines changed since the merge base with the base branch (found as
1530
+ [the base branch](#the-base-branch) is; with none found, or a `dialecte.baseBranch` naming no branch, the run
854
1531
  is refused, exit 2, naming `dialecte.baseBranch` and `--base`) or `--base <ref>`, untracked scope files
855
1532
  whole; `audit` the whole scope (no base needed). Without `--mode` the lot's switch decides; with no switch,
856
1533
  `changed` when the change touches the scope, else `mutation off for this lot` and exit 0. A detached HEAD is
@@ -924,7 +1601,9 @@ the answer.
924
1601
  earlier cli versions made in the system's temporary folder, each judged by its marker - with the
925
1602
  command that removes each (its absolute `cd` first).
926
1603
  `--yes` runs them after a confirmation on a terminal; without a terminal it refuses, so hand the
927
- commands (or the `--yes` command) to a person. Kept, each with why: an unmerged branch; the branch the
1604
+ commands (or the `--yes` command) to a person. Kept, each with why: first, a worktree a lot of the
1605
+ repository's store names (by real path) while the lot is not `committed` nor `canceled`
1606
+ (`<branch>: lot <full name> <state>`; the store read once per repository, no git process per lot); an unmerged branch; the branch the
928
1607
  main checkout is on; a worktree a mutation run was started from while that run still runs
929
1608
  (`mutation run <id> still running (pid <pid>)`) or after it died before reporting
930
1609
  (`mutation run <id> died before reporting: rerun or dialecte mutants abandon <id>`; a reported or
@@ -944,47 +1623,11 @@ the answer.
944
1623
  checkout, a link's too: while a registered worktree of the repository is a link, a worktree deleted
945
1624
  from disk is kept, naming that link, and no `git worktree prune` is offered. The sibling links
946
1625
  `worktree add` makes (`.worktrees/core -> ../core`) are in no item. It reads each worktree with
947
- `git --no-optional-locks`, so it never rewrites an index. `handover list` follows a link to a hand-over
948
- folder and lists a folder reached by its path and through a link once.
949
- - `dialecte record standard <folder> consulted <note> | not-consulted <reason>` writes `<folder>/standard.json`
950
- (`{ state, note, at }`, the note's words joined by single spaces) for the card's `standard` line; the line
951
- references of what was read stay in the findings ledger. Another state, or no note, is a usage error
952
- (exit 2); a folder inside a repository is refused as below.
953
- - `dialecte record review|decision|snapshot` and `dialecte review delta` keep a lot's review rounds in its
954
- hand-over folder (`_commit-plan/<topic>-<date>/`), which stays outside every repository: each refuses a
955
- folder inside a git work tree or a git folder (`.git/`, a bare repository). `--` ends the options: the
956
- words after it are taken as they are, so a finding or a reason may start with `--`.
957
- - `record review <folder> --round <n> --severity <blocking|should-fix|nit> --at <file:line> <finding>`
958
- appends the row `| R<n>-<k> | <n> | <severity> | <file:line> | <finding> | open |` to
959
- `<folder>/findings-ledger.md` (the folder, the file and its table made when absent; k one past the
960
- highest of the round). A `|` is written `\|`; a line break is refused. A hand-written ledger keeps
961
- every other byte.
962
- - `record decision <folder> <id> <state>` rewrites that row's state cell: `open`, `fix-to-verify`,
963
- `fixed <round> [note]` (a round after the one that raised it), `accepted <reason>`, `logged <where>`.
964
- An id not in the ledger is refused, naming the ids it holds.
965
- - `record choice <folder> --by <who> <decision>` appends `| <decision> | <who> | <yyyy-mm-dd> |` to
966
- `<folder>/decisions.md` (made with its title and table when absent): a decision made outside the
967
- findings ledger, the user's above all. A `|` is written `\|`; an empty `--by`, a line break, or more
968
- than one decision word (quote it) is refused.
969
- - `record snapshot <folder> --round <n>` copies every file `git status --porcelain -z
970
- --untracked-files=all` lists at the worktree root (the old path of a rename included) to
971
- `round-<n>/` at its repository-relative path - bytes, mode, a symlink as a symlink; a path gone from
972
- disk (or now a folder) that HEAD holds goes in `round-<n>.deleted`, NUL-separated, sorted; HEAD in
973
- `round-<n>.base`. An existing round, an untracked nested repository and a submodule (a gitlink in the
974
- index or at HEAD) are refused; a run that
975
- stops part-way leaves only `.partial` names, which the next run removes. `.dialecte/lot.json` is
976
- never part of it.
977
- - `review delta <folder> --round <n> [--worktree] [--json]` (n ≥ 2) prints, for each file of
978
- `round-<n-1>/`, of `round-<n-1>.deleted` or of the worktree's status, what changed since round n-1,
979
- in the form that fits where the file is: the snapshot copy against the worktree file (or
980
- `/dev/null` when it is gone), `/dev/null` against a file deleted then and back now or new and absent
981
- from the base, `git diff HEAD` for a file round n-1 had at the base. Files unchanged since round n-1
982
- are left out; colour, external diff and textconv settings never apply. It refuses when HEAD moved
983
- since `round-<n-1>.base`, and refuses a nested repository or a submodule as `record snapshot` does. `--worktree` adds a throwaway worktree on the branch
984
- `<lot branch>-round-<n-1>` from the lot's branch tip: the deletions applied with `git rm
985
- --pathspec-from-file`, then `round-<n-1>/` copied over, so a new test can run on the old code; it
986
- prints its path and the removal command with its absolute `cd`. The lot's worktree is never
987
- changed.
1626
+ `git --no-optional-locks`, so it never rewrites an index. Each hand-over's repository is read once for
1627
+ the whole workspace, and its state once, never once per repository. `handover list` follows a link to a
1628
+ hand-over folder and lists a folder reached by its path and through a link once. The pool entries and the
1629
+ trash (a worktree in `_trash/` included) are never listed nor touched: one line each,
1630
+ `pool: 2 entries (cli 1, core 1)` and `trash: 3 folders, being deleted or left over`.
988
1631
 
989
1632
  `gate --fast` starts with the hygiene of the worktree: nothing staged; no stash entry pushed on this
990
1633
  worktree's branch since `worktree add` made it (the baseline keeps every stash entry it saw, so another
@@ -999,7 +1642,9 @@ on its exit code or its counts is run once more with `--no-file-parallelism`, on
999
1642
  run named (through `npm run <script>` after one `--`; the whole step when the output names no file). The
1000
1643
  rerun passes when it exits 0, counts no failed test and at least one passed: the step then passes,
1001
1644
  flagged - `serial rerun of <n> file(s): exit 0, <counts> flaky in parallel` on its line, one
1002
- `flaky <file>` line under it per file, the note kept in the gate record. Otherwise the step fails as a
1645
+ `flaky <file>` line under it per file, the note kept in the gate record; the hand-over card's row of such a step,
1646
+ or of a hook's test step `gate --hook` flagged so, reads `✓ <step> <passed> passed · <n> flaky, passed serially`
1647
+ (n the flaky files), never a failed count. Otherwise the step fails as a
1003
1648
  `real failure: <why>`, each file listed under it as `failed <file>` when it failed again or `flaky <file>`
1004
1649
  when it passed serially, the rerun's last lines as the tail. While the rerun runs, the step's line still
1005
1650
  shows its own command. A step that stalled, counts no tests, runs no vitest, or already runs one file at a time
@@ -1012,9 +1657,14 @@ changed since the base (test files, helpers, fixtures, snapshots) must be as the
1012
1657
  others fail the gate with the list. The flags of the receipts and the deleted cases are printed under the
1013
1658
  step. The lot file may also accept cases without a red - a new test of behaviour that already exists, an honest
1014
1659
  cut of an assertion: `"accept": [{ "case": "<file>::<name> [project]", "reason": "..." }]`. An accepted
1015
- case passes `tdd red` as accepted and does not block its file; the gate lists each acceptance with its
1660
+ case passes `tdd red` as accepted and does not block its file (a case already proven red then green keeps
1661
+ its proof: an acceptance never overrides one, and an accepted receipt counts only while its entry stays in
1662
+ the file); the gate lists each acceptance with its
1016
1663
  reason, the hand-over card counts them by reason from the receipts (those of earlier lots, which the file
1017
- no longer names, counted on one line), and both report an acceptance or a `revised` entry no case used. The card
1664
+ no longer names, counted on one line), and both report an acceptance or a `revised` entry no case used (the
1665
+ gate's `unused accept` line adds `; the closest: <file>::<name>` when a case title of the change is close). An
1666
+ entry names a title with its quotes folded: a straight `'` or `"` matches a curly one (`’`, `‘`, `“`, `”`) and
1667
+ the reverse; nothing else (a backtick, a prime, the letter case) compares alike. The card
1018
1668
  lists every `gone` entry with its reason; only the gate reports a `gone` entry that covers no finding. The file is strict: an unknown key, at the top or in
1019
1669
  an `accept` entry, and an exemption without a reason are refused, naming what is wrong. A lot the orchestrator declares exempt - a wording, rename or doc-only lot - passes with its reason
1020
1670
  and what the change touches: `{ "tdd": "exempt: <reason>" }` in `.dialecte/lot.json` at the package root
@@ -1040,15 +1690,20 @@ A package tunes them in its package.json:
1040
1690
  "generatedDocs": [".vitepress/data/elements-catalog.json"],
1041
1691
  "referencePatterns": ["SPEC-[0-9]+"],
1042
1692
  "allowReferences": ["ticket number"],
1043
- "baseBranch": "main"
1693
+ "baseBranch": "main",
1694
+ "rebuiltIgnored": ["coverage/"]
1044
1695
  }
1045
1696
  ```
1046
1697
 
1047
1698
  `gate.fast` / `gate.full` replace the default steps of that mode (`counts: "tests"` makes a step fail
1048
1699
  when it counts no test; `changedOnly: true` marks a step that runs only the tests the change affects,
1049
1700
  so "No test files found" passes with a note instead of failing; `restoresGeneratedDocs: true` restores the `generatedDocs` byte for byte after
1050
- it); `baseBranch` is the branch
1051
- `worktree add` starts from and `worktree prune` compares with (default `main`); `referencePatterns` adds the package's own patterns (extended regular expressions) to the
1701
+ it); `baseBranch` optionally names
1702
+ [the base branch](#the-base-branch); `rebuiltIgnored` lists ignored
1703
+ folders a build or a run rebuilds, which `lot close` may delete with a worktree: each a folder ending with `/`,
1704
+ relative to the package root, read from the `package.json` of the main checkout nearest the ignored path (a
1705
+ worktree's own declaration counts for nothing); an invalid entry (empty, absolute, holding `.` or `..`, without its
1706
+ trailing `/`, not a string) is ignored, and an ignored folder nobody declares keeps the worktree; `referencePatterns` adds the package's own patterns (extended regular expressions) to the
1052
1707
  citations (and, in a contributor, the tags) `rules` and `handover` refuse; `allowReferences` is the contributor's
1053
1708
  opt-out: it lifts generic tags a contributor commits on purpose - `ticket number`, `acceptance criterion`,
1054
1709
  `plan tag` - and refuses any other label in either profile: a citation of a standard is never allowed. A consumer
@@ -1056,13 +1711,89 @@ allows every tag already, so `allowReferences` changes nothing there (`dialecte
1056
1711
  folder included: it is hashed and scanned as its target text and committed as a link, the way git stores it (a
1057
1712
  rehearsal copies it as the same relative link).
1058
1713
 
1059
- ### GitHub text: recap and text check
1714
+ **Scoped steps, heavy steps, the release list.** A step of `fast`, `full` or `release` may say `"scoped": true`
1715
+ (never with `changedOnly`, never in `contrib.steps`): the gate resolves one base per run - `--base <ref>`, else the
1716
+ merge-base of HEAD and [the base branch](#the-base-branch), else the empty tree (everything changed) - and hands the
1717
+ step `DIALECTE_GATE_BASE`, `DIALECTE_GATE_TREE`, `DIALECTE_GATE_CHANGED` (a file of the changed paths byte for byte,
1718
+ NUL-separated, both paths of a rename, relative to the repository top as `git diff --name-only` names them, while a
1719
+ declared `failing` path is relative to the package root) and `DIALECTE_GATE_SELECTION` (a path to write). The step writes there
1720
+ `{ "schema": 1, "base", "tree", "changed": <paths judged>, "selected": [{ "id", "reasons": [...] }], "skipped": [{ "id", "reason" }] }`:
1721
+ `selected` and `skipped` are both required lists, each selected id has at least one reason, the file is at most 1 MiB
1722
+ and an id matches `[A-Za-z0-9][A-Za-z0-9._-]{0,63}`. A missing or invalid selection, another base or tree, or another
1723
+ count fails the step. An empty selection should exit 0 without starting vitest: it passes with
1724
+ `nothing selected since <base> (<n> paths changed)` (`1 path changed` for one); a non-empty selection on a
1725
+ `counts: "tests"` step that runs no test fails (`no test ran`). The step selects from the working files (never
1726
+ `git show <tree>:`), so what it selects and what it runs are the same code. A failing step counting tests is rerun
1727
+ once, serially, with its failing files appended as plain arguments (after one added `--` only when the step runs
1728
+ through `npm run` and its command holds none), then `--no-file-parallelism`, with the same base, tree and changed file
1729
+ and a new selection path: the rerun must select the same ids, and a script running vitest more than once passes
1730
+ `--passWithNoTests` to each invocation (or runs one). A scoped step whose command (or the npm script it runs) does not
1731
+ name vitest is rerun whatever runs it, when it exited non-zero on a test failure (a failed test counted, a `FAIL` line,
1732
+ vitest's `Unhandled Errors` or `Errors <n> error` summary); for such a step a plain script error fails as itself. A
1733
+ scoped step that names vitest keeps the rule of any vitest step: rerun on any failure. A first run whose selection is
1734
+ not valid is never rerun.
1735
+ The selection may declare `"failing": ["<path>", ...]` (relative to the package root, no `..`, no backslash; a leading
1736
+ `./` and repeated `/` are normalised away): a failed step records those files with the ones its output names
1737
+ (`failing` in the record and in `--json`; the card's row ends `· failing <n>: <first 3>`).
1738
+ Run outside the gate (no `DIALECTE_GATE_SELECTION`), a scoped script selects everything. The base enters the record's
1739
+ key, so a run at another base never reuses. `"heavy": true` marks a heavy suite (a browser suite); it is outside the
1740
+ command hash. `gate.release` is the list `gate --release` runs (default: the `full` steps, derived ones included),
1741
+ every scoped step against the empty tree (`--base` with `--release` feeds only the tdd step); it _covers full_ when
1742
+ every `full` step is in it with the same `name`, `run`, `counts` and `changedOnly`, and only then does its green
1743
+ record answer a commit hook, a rehearsal, contrib and the card. An environment switch that changes what runs belongs
1744
+ in the step's `run`. A gate config the cli cannot run (a list that
1745
+ is no list of steps, a step without `name` or `run`, a `scoped` or `heavy` that is no boolean, `scoped` with
1746
+ `changedOnly`) is refused naming the list and the step: `gate`, `contrib` and `handover run` exit 2, `gate --hook`
1747
+ exits 1, the card prints `✗ gate invalid gate config: <message>`.
1748
+
1749
+ **Opting out of a default step.** A package that has no use for a default step (no skills folder, no type
1750
+ benchmark yet) says so, with a reason, instead of wiring a script:
1751
+
1752
+ ```json
1753
+ "dialecte": {
1754
+ "gate": { "skip": { "skills": "no skills folder in this package" } },
1755
+ "contrib": { "skip": { "type-bench": "no type benchmark yet" } }
1756
+ }
1757
+ ```
1758
+
1759
+ `dialecte.gate.skip` serves the default steps of `fast`, `full` and the release list that follows `full`;
1760
+ `dialecte.contrib.skip` the default `contrib` steps (`docs`, `type-bench`) when `contrib.steps` is not declared.
1761
+ A skip is only for a default step the package cannot run: an `npm run <x>` step whose script `x` is missing. A reason
1762
+ is a non-empty string of one line and at most 200 characters. A name that is no default step of a mode with no
1763
+ declared list, a step the package can run (its script is there, or it runs no npm script, as the default `tests`:
1764
+ `"tests": skip is for a step the package cannot run; remove the skip`), an empty or too long reason, or a `skip`
1765
+ that is no map is refused like any gate config (exit 2, naming the key and the name): an opt-out cannot go stale
1766
+ unseen, and adding the script makes its skip refused until it is removed. An opted-out step runs in no mode (`skip skills
1767
+ opted out: <reason>`; the card warns, never blocks), and a step the package declares has no opt-out: remove it or add its
1768
+ script. Adding or removing an opt-out changes the gate record's key, so the gate runs again.
1769
+
1770
+ ### The base branch
1771
+
1772
+ Every command that reads the base branch (the gate's base, `mutants`, `tdd`, `worktree add` and `worktree prune`,
1773
+ `lot close`, the hand-over's target) finds it the same way, the first rule that answers winning:
1774
+
1775
+ 1. `dialecte.baseBranch` when set (an optional override): the local branch, else origin's. Set to a branch that
1776
+ exists nowhere, it is refused, never replaced by another: exit 2 for the gate's base, `mutants`, `handover write`
1777
+ and `handover run`, exit 1 for `worktree add` of a new branch without `--from`; the commit hook fails, and the
1778
+ tdd step of `gate --full` fails with the same text.
1779
+ 2. The branch `origin/HEAD` names (recorded at clone), when that branch exists; the local one is preferred.
1780
+ 3. `main`, local, else origin's.
1781
+ 4. `master`, local, else origin's.
1782
+ 5. Nothing found: refused with `no base branch found (no dialecte.baseBranch, no origin/HEAD, no main, no master):
1783
+ name it as dialecte.baseBranch in package.json`. The gate alone keeps selecting everything (with a note) in that
1784
+ case; `worktree add` without `--from` refuses, `worktree prune` skips the repository with the text, `lot close`
1785
+ holds nothing through the base, and `tdd` measures from HEAD.
1786
+
1787
+ The repository field of `package.json` is a URL and is never read for this. `mutants` finds `origin/<b>` through
1788
+ the same rule and no longer takes a tag named like the base branch.
1789
+
1790
+ ### GitHub text: lot recap and text check
1060
1791
 
1061
1792
  Text written with an assistant tends to retell the diff and grow long. The pull request splits in two:
1062
1793
  an expandable part made from records, and a short human part that is checked before it is posted. Both
1063
1794
  commands only print; the user posts.
1064
1795
 
1065
- - `dialecte recap <hand-over folder>` prints the expandable part (`<details>`) as GitHub markdown, from the
1796
+ - `dialecte lot recap <id|folder>` prints the expandable part (`<details>`) as GitHub markdown, from the
1066
1797
  records only: the commits of the lots (or `not committed yet`), the test cases the newest gate record of the
1067
1798
  current tree judged red then green, counted per test file, the gate and rules lines (and `mutation`), the
1068
1799
  lot's mutation runs (`Mutation`: each run of the branch and of the branches it merges, oldest first, with
@@ -1070,7 +1801,9 @@ commands only print; the user posts.
1070
1801
  on those branches and scheduled, with its follow-up; `No mutation run.`, or `No mutation scope declared.`
1071
1802
  for a package without one), the review rounds from
1072
1803
  the findings ledger, the decisions (accepted findings, the lot declaration's `accept` and `revised` entries,
1073
- the rows of `decisions.md`), the logged findings as follow-ups, and who reviewed and posted it (`git config
1804
+ the rows of `decisions.md`, then, in a lot folder, one row per answer `answers/q<k>.json` in `k` order:
1805
+ `q<k> <question text> -> <answer>`, by who answered, on the UTC day of the answer; an answer is never copied
1806
+ into `decisions.md`), the logged findings as follow-ups, and who reviewed and posted it (`git config
1074
1807
  user.name`; no name set is refused). Every section is always there, saying so in one line when empty; a
1075
1808
  branch that does not hold the lots on top of the recorded base lists none as committed and says so. Each
1076
1809
  finding is printed with its id, its text without one leading reviewer tag `[...]`. The ledger is read whole:
@@ -1253,6 +1986,14 @@ runs with git's `GIT_DIR`, `GIT_INDEX_FILE` and the commit's identity set: the s
1253
1986
  (`test/git-environment.setup.ts`, vitest `setupFiles`) clears them before any test, so a test's git acts on
1254
1987
  its scratch repository only, and the cli clears git's repository variables at its start.
1255
1988
 
1989
+ The cli gates itself with its own `dialecte.gate` (package.json). `--fast`: `check`, a scoped `tests` step
1990
+ (`node src/scoped-tests.ts`: `vitest related` over the paths changed between the gate base and the tree that a
1991
+ test can import, and an empty selection exits 0 without starting vitest) and a scoped `rules` step on the same
1992
+ changed list. `--full`: the default full steps (`check`, `skills`, `build`, the whole suite), then `rules` on the
1993
+ changes since the gate base. The suite's setup file also points `XDG_CONFIG_HOME` at a folder that does not exist
1994
+ (no person's forbidden words list is read) and sets `DIALECTE_KEEP_AWAKE=0` (no run of the suite holds the machine
1995
+ awake); a case that wants either sets it itself.
1996
+
1256
1997
  The suite leaves no temporary folder behind: every test removes what it makes in its own teardown, also
1257
1998
  when it fails. A vitest global setup (`test/suite-guard/temp-folder-guard.setup.ts`, `globalSetup`) gives
1258
1999
  the run one short folder of its own (`dlt-<random>` under the system's temporary folder) and sets it as