@dialecte/cli 0.6.0 → 0.8.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
@@ -24,79 +24,9 @@ code from the one map the code declares (each command's `verbs` and `flags` deri
24
24
  shape. Exit codes: 0 an answer or green, 1 nothing found or a failed check,
25
25
  2 usage or refused; a command's help says when it differs.
26
26
 
27
- ```
28
- Discover api members schema explain standard facts
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
40
- dialecte members <expr> # what an expression of the live types holds
41
- dialecte schema <Tag> # what an element may hold and where
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 facts list|show|forget # the facts recorded in your data folder: their state now, their history; forget one
45
- dialecte run <script.ts> # run a script on an in-memory project of the installed dialecte: one structured outcome
46
- dialecte fixture <Tag> # the smallest valid XML document holding an element, built by the dialecte's engine
47
- dialecte new verb <namespace> <query|transaction> <name>
48
- dialecte lot start <brief.json> # a lot from its brief: the lot folder in the store, the numbered worktree, .dialecte/lot
49
- dialecte lot status <id> # its state derived from the records, the checks, the next station and its exact command; reads only
50
- dialecte lot wait <id> [--timeout <seconds>] # until the lot needs someone: ready, a question, failed, a limit
51
- dialecte lot answer <id> <question> "<answer>" [--by <who>] # answer an open question of the lot, once
52
- dialecte lot result <id> # the hand-over (card, show and run lines) of a ready lot, or why it stopped; writes nothing
53
- dialecte lot stop <id> --reason <text> # end the lot: its pending hand-over abandoned first, then canceled
54
- dialecte inbox # what waits on someone across every lot store: questions, ready hand-overs, failed lots
55
- dialecte plan next|check|mark <plan.md> # what can start now in a plan's lot block; the block checked; a person's mark
56
- dialecte lot exempt|accept|revised|gone|mutation # the lot declaration .dialecte/lot.json
57
- dialecte lot finding|decide|snapshot|choice|standard|verify <id|folder> ... # a lot's review rounds and late fixes, in its lot or hand-over folder
58
- dialecte lot delta <id|folder> --round <n> # the fix diff since round n-1; --worktree: the old code to run a test on
59
- dialecte lot recap <id|folder> # the pull request's expandable part, built from the hand-over's records only
60
- dialecte lot close <name|index> # a finished lot: node_modules to the pool, its worktree to the trash
61
- dialecte gate [--full] # the package's Definition of Done, with the real counts
62
- dialecte gate --hook # in a commit hook: the suite, unless a green gate --full of the committed tree answers it
63
- dialecte tdd red|green|status # receipts: each new test failed on an assertion before the code, then passed untouched
64
- dialecte rules # code-rules self-check of the changed files
65
- dialecte contrib # the contributor checks, after gate --full and before the hand-over
66
- dialecte mutants run|status|schedule|abandon|migrate|judge|record|drop # mutation testing of the declared scope
67
- dialecte handover write <lots.json> # the guarded commit-by-lots hand-over a human runs (handover <lots.json> too)
68
- dialecte handover show|review|run|abandon|list|--legend
69
- dialecte worktree add|prune # a worktree ready to work in; what a merge left behind
70
- dialecte doctor # versions, core API generation, skills and station agents in sync, local checkouts
71
- dialecte models # which model each tier (fast, standard, strong, frontier) means for your vendor
72
- dialecte skills sync|generate|check|changed # the agent skills your dependencies ship, and this package's own
73
- dialecte bench [--check] # measure the type-instantiation cost of your own types; --check gates CI
74
- dialecte coverage # generate complete, schema-driven type-coverage probes
75
- dialecte narrowing # assert schema-derived type narrowing still holds
76
- dialecte audit # render the public type surface and flag readability issues (C1-C6)
77
- dialecte text check <file> # the human part of a GitHub text: its fixed headings and its word cap
78
- ```
79
-
80
- ### Renamed in 1.0
81
-
82
- The review rounds' commands moved under `lot`. The old forms run nothing and write nothing: each answers
83
- `renamed: dialecte <old> is now dialecte <new>` on stderr, exit 2, until 2.0. Its second line is the full new
84
- command with the same arguments, or, with no arguments, the new form's usage line; `record` or `review`
85
- without a verb lists every form that replaced it. Asked with `--help`, an old form prints the same answer on
86
- stdout, with the words given before `--help`, exit 0; with `--help --json` it prints
87
- `{ renamed: [{ old, new }] }`, the words after `dialecte` (`record` lists its five forms).
88
-
89
- | 1.0 | Before |
90
- | ----------------------------------------------------------------------------------------- | -------------------------- |
91
- | `dialecte lot finding <id\|folder> --round <n> --severity <s> --at <file:line> <finding>` | `dialecte record review` |
92
- | `dialecte lot decide <id\|folder> <finding> <state>` | `dialecte record decision` |
93
- | `dialecte lot snapshot <id\|folder> --round <n>` | `dialecte record snapshot` |
94
- | `dialecte lot choice <id\|folder> --by <who> <decision>` | `dialecte record choice` |
95
- | `dialecte lot standard <id\|folder> consulted <note> \| not-consulted <reason>` | `dialecte record standard` |
96
- | `dialecte lot delta <id\|folder> --round <n> [--worktree] [--json]` | `dialecte review delta` |
97
- | `dialecte lot recap <id\|folder>` | `dialecte recap` |
98
-
99
- `dialecte handover write <lots.json>` names what `dialecte handover <lots.json>` does; the old form stays.
27
+ Every command has its page in [`doc/commands/`](doc/commands/index.md): the help the cli prints, generated from the
28
+ command map (`npm run doc:generate`), then what the command does in full. The index lists the commands by family
29
+ and the forms renamed in 1.0.
100
30
 
101
31
  ## Zero-config
102
32
 
@@ -114,87 +44,6 @@ Everything is overridable per `package.json` `"dialecte"` field (odd layouts) or
114
44
 
115
45
  Env: `RUNS=5 dialecte bench` (repetitions kept as the min); `COVERAGE_CHILD_CAP=N` (cap child edges).
116
46
 
117
- ## Agent skills
118
-
119
- Every Dialecte package ships the agent skills that describe it in `skills/<name>/SKILL.md` (open
120
- [Agent Skills](https://agentskills.io) format), versioned with its code.
121
-
122
- - **In an app**: `npx @dialecte/cli skills sync` links the consumer skills of your `@dialecte/*` (and any
123
- other) dependencies into `.claude/skills` and `.agents/skills` (Codex, Cursor, Gemini CLI, Copilot read the
124
- latter; add `--agent copilot` for `.github/skills`). Links follow your installed versions; rerun after
125
- adding a dependency. `--copy` writes copies instead of links.
126
- - **Consumer and contributor skills**: a skill whose frontmatter says `metadata:` / `audience: contributor` is
127
- for changing a dialecte package (core's `dialecte-contributing`, `dialecte-lot`); a skill without one is a
128
- consumer skill. A sync installs the consumer skills only and names the contributor skills it left out;
129
- `--contributing` installs them too and is remembered (`contributing` in `.dialecte-skills.json`) until
130
- `--no-contributing` removes them. `dialecte doctor` expects the skills of the audience the manifest says;
131
- `skills check` refuses another audience value.
132
- - **Station agents (Claude Code)**: when Claude Code is a target (the default), the contributor skills are
133
- installed and the project's model vendor is anthropic, `skills sync` also writes one agent per station of `dialecte-lot` into
134
- `.claude/agents/dialecte-<station>.md`: `implementer` and `fixer` (standard tier), `implementer-strong` and
135
- `reviewer` and `grader` (strong), `eval-runner` and `standard-reader` (standard), `searcher` (fast). Each file
136
- sets the model (from the `dialecte models` map, as the alias Claude Code accepts: `sonnet`, `opus`,
137
- `haiku`) and the tools: the reviewer holds the read tools and Bash (it runs the tests) and no Write or Edit,
138
- the searcher and the grader hold read tools only. These files are adapters: a station's tier and access
139
- (`read`, `review`, `edit`) are the cli's, its definition is the `dialecte-lot` skill's `references/stations.md`
140
- (one `### <station>` section with a `- Tier:` and an `- Access:` line), and the Claude tool names are only the
141
- Claude form of the access. The body is a few lines naming the station and its section in the installed
142
- `.claude/skills/dialecte-lot/references/stations.md`, the skills to load and the never-list; it never copies a skill.
143
- The `eval-runner` and the `grader` read neither the page nor a lot skill (they judge the skill under test): their
144
- brief carries their definition and names the only skill text they read. `skills check`, in a package shipping `dialecte-lot`, refuses a
145
- `references/stations.md` that is missing, lacks a station, has an unknown section or a `Tier:` / `Access:` line out of
146
- line with the cli. The files are owned through the manifest: replaced on
147
- every sync, removed when no longer produced, and a file of your own with the same name is reported, never
148
- overwritten. `dialecte doctor` warns about a stale or missing one. Other hosts (Copilot / VS Code, Codex,
149
- Gemini) get no agent files from this command yet: the tier of each station comes from `dialecte models`
150
- there, as the `Tier:` line of a brief says.
151
- - **Session-start check, every agent**: when `dialecte-lot` is installed by the sync (whatever the targets),
152
- `skills sync` writes a section in the project's root `AGENTS.md`, between `<!-- dialecte-skills:session-check -->`
153
- and `<!-- /dialecte-skills:session-check -->`, telling the agent to run `npx --no-install @dialecte/cli doctor --brief`
154
- at a session start. It is written with a blank line inside each marker, the form a markdown formatter keeps, so a
155
- formatted `AGENTS.md` stays formatted. An existing `AGENTS.md` gets it appended after one blank line; the body
156
- between the markers is compared tolerantly (whitespace does not matter: line ends, blank lines, a wrapped
157
- sentence), and only the marked block is replaced when an older release wrote another sentence: every byte outside
158
- it stays, line ends included. A missing `AGENTS.md` is created only when you answer yes on a terminal or pass `--agents-file`; without
159
- either, the sync says it was not created. The section and the file are never removed nor deleted by a sync:
160
- `--no-session-check`, `--no-contributing` or a sync without `dialecte-lot` leave them in place (delete the section
161
- by hand if you do not want it). `--no-agents-file` leaves `AGENTS.md` alone altogether (it excludes
162
- `--agents-file`). A marker without its pair, or a doubled one, leaves the file alone with a warning.
163
- An `AGENTS.md` holding only the section is no evidence of a vendor.
164
- - **Session-start check (Claude Code)**: the same check as an adapter: `skills sync` adds a `SessionStart` hook running
165
- `npx --no-install @dialecte/cli doctor --brief` (the installed cli: no download at a session start) to
166
- `.claude/settings.json`, inserted by a minimal text edit (the rest of your file stays byte for byte), never
167
- duplicated, removed when you drop the claude target. If you edited the hook's text since, removal cuts only
168
- our handler (a comment right next to it may go with it) and writes nothing when anything else would change. Agents and hook are written only when `dialecte-lot`
169
- is installed for Claude Code. `doctor --brief` prints nothing when the skills, the
170
- versions and the station agents are in sync, otherwise one line per problem with its fix, and always exits 0.
171
- `--no-session-check` leaves the hook out (and removes the one a sync added). Elsewhere, the `dialecte` skill
172
- tells the agent to run `doctor` first.
173
- - **Working on Dialecte**: `npx @dialecte/cli skills sync --from ../ --contributing` takes them from your local
174
- checkouts, the contributor skills included.
175
- - **In a package**: `dialecte skills generate` rewrites the `<!-- dialecte-skills:generated <kind> -->`
176
- blocks (`extensions`, `core-methods`, `hooks`, `api`, `intents`) from the source; the `api` block lists
177
- the methods, then one section per package entry (each `exports` subpath shipping a `.d.ts`) with the
178
- functions it exports.
179
- `dialecte skills check` verifies every API, path and npm script a page cites, and that every public
180
- method and every function an entry exports (not `@internal`) has a JSDoc summary and an `@intent` tag; it warns when a summary or an
181
- intent quotes a sentence, since the generated pages republish the JSDoc. A page about several
182
- repositories declares `<!-- dialecte-skills workspace -->` and is fully verified with
183
- `--workspace <folder>`; a deliberate outside mention goes in `<!-- dialecte-skills ignore: token -->`.
184
- It also verifies every cli invocation a page cites in code (inline code, fenced blocks tagged `sh`, `bash` or
185
- `shell`, and in an untagged fence only a line starting `dialecte ` and a command of the map; a fence with any
186
- other tag - `text`, `mermaid`, a diagram, a sample - is never read; never prose; generated blocks left out): one starting with `dialecte` or `@dialecte/cli`, after `npx`, a
187
- `$ ` prompt or a shell operator. Its command, its verb and each `--flag` must be in the command map of the
188
- cli the package uses (the cli's own map in the cli itself, else what the installed `@dialecte/cli` answers to
189
- `dialecte --help --json`); an unknown one, or an old form of a command renamed in 1.0 (see "Renamed in
190
- 1.0"), is an error at `page:line` naming the closest valid form, or the new form, on a workspace page too. A quoted word, a
191
- `<placeholder>` and what follows a bare `--` are not checked; `ignore:` takes the offending word (`record`,
192
- `--fats`). With no installed cli, or one before the map, the invocations are not checked: one warning says
193
- why and the summary line says so. Inside a `<placeholder>`, an option group `[...]` or a flag group
194
- `(--a | --b)` a `|` is no pipe; each kind of group is counted on its own (a `)` never closes a `<`), and a
195
- process substitution `<(dialecte ...)` is read like any invocation. A versioned `@dialecte/cli@<version>` and
196
- what follows an unclosed `<`, `[` or `(--` are not read.
197
-
198
47
  ## What the cli prints
199
48
 
200
49
  Every text the cli prints passes one boundary: each printed line is escaped once, so a value from a record, a
@@ -212,206 +61,10 @@ every other control in them is escaped.
212
61
  Each answers in a few lines, the same with or without the Dialecte repositories, and takes `--json`.
213
62
  Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage error.
214
63
 
215
- - `dialecte api find "<need>" [--package <name>] [--limit 5]` searches the `api.json` every installed
216
- package ships next to its skill's `api.md` (written by `skills generate`): one line per method - route,
217
- `q | tx | doc | project | export`, the intent that matched, the package. Ranking, in order: how many words of the
218
- need the method's `@intent` tags hold, then its summary, then its name - one intent word beats any number
219
- of summary words; stop words dropped, word forms reduced to a light stem (`copied`, `copies`, `copying`
220
- → `copy`); ties put a dialecte's verb before core's, then sort by route.
221
- - `dialecte api find --source "<need>"` also searches the exported functions of the package you are in (the
222
- nearest `package.json` at or above the folder): every exported function declaration, arrow or function-expression
223
- `const` of its tracked and untracked-not-ignored `src/**/*.ts` files, tests left out, read from the syntax alone
224
- (a local `export { name }` counts, a re-export does not; an overload set is one function, at its first overload).
225
- A source row prints `<file>#<name> source <file>:<line>`, then the intent that matched, its summary or
226
- `(no summary)`. A function without `@intent` ranks on the words its summary and name hold together; at equal
227
- hits an indexed method comes first, and a function the package's `api.json` already lists is shown once, by its
228
- route. A file that does not parse is left out with a `note:` line. What each file holds is cached by its content
229
- hash in `dialecte-source-index.json` in the worktree's git folder, shared by the packages of the repository and
230
- rebuilt by another cli version (outside a git work tree, every file is read).
231
- `dialecte api show <file>#<name>` (`src/lib/git.ts#readGit`) prints one source function's signature, summary,
232
- intents and declaration, with or without `--source`; an unknown name in a file that was read names up to five of
233
- that file's functions, the closest first; an unknown file names the closest source paths, or the
234
- `api find --source` call that lists them.
235
- - `dialecte api show <path>` (`info.of`, `doc.query.info.of`, `tx.reference.applyUuidRemap`): signature as
236
- declared, summary, intents, other routes, where it is declared in its repository, and one call: the
237
- method's JSDoc `@example` when it is short and calls the method, else a call from the test next to it
238
- whose arguments a caller can copy (written-out values first; never a test case field, a fixture constant
239
- or a cast). No such call, no example.
240
- - `dialecte members <expression>` (`doc.query`, `doc.query.reference`, `tx.lifecycle.extract`): the
241
- IntelliSense walk on demand, from the live types of the package where it runs. In an app it reads the
242
- installed dialecte (a dependency built on `@dialecte/core` exporting `./<version>` with its `./<version>/test`
243
- entry: its namespace is its name capitalized, `Scl` from `@dialecte/scl/v2019C1`); with several, it lists them and
244
- `--package <name>` / `--version <v>` picks one. `--namespace <Name> --entry <module>` override.
245
- - `dialecte schema <Tag> [--under <Parent>] [--package <name>]`: parents, children in order with how often each
246
- may appear, attributes (required, identity, default, fixed, enumeration, pattern), text, xsi:type variants,
247
- the declared type and documentation - read through the readers of the core each installed dialecte depends on
248
- (how often a child may appear is core's `childOccurrences`). A tag declared several ways prints each declaration
249
- with the parents that hold it; `--under <Parent>` prints the one that parent holds (or those it holds, when it
250
- does not decide), and a tag that is not a child of that parent answers its parents (exit 1). With `--json` each
251
- element carries `declarations` and `resolved`, and when known `type`, `documentation`, `declaration` (the key
252
- of the declaration described, when the tag is declared several ways) and `ways` (when unresolved). A dialecte
253
- names the standard it implements in its `package.json`, `"dialecte": { "standard": "<public name>" }` (the
254
- usual public name, no part or clause); a value that is not a non-empty string skips the dialecte, naming
255
- `dialecte.standard`. An unknown tag
256
- answers the closest; a dialecte not built is reported as skipped.
257
- - `dialecte doctor`: installed `@dialecte/*` versions, the core API generation of each dialecte (read from
258
- the core it resolves; a dialecte on another core than your app's is a warning), whether the synced skills match node_modules (a skill missing; a copied skill of
259
- another version than the one installed - linked skills follow node_modules), local checkouts (siblings,
260
- `$DIALECTE_ROOT`); each warning with the one command that fixes it.
261
-
262
- - `dialecte models [--vendor <id>] [--json]`: the model each tier means for the vendor the project uses
263
- (`anthropic`, `openai`, `google`), one line per tier, the date the rows were checked and what each tier
264
- is for. Agents name a tier (`standard`) and ask this command which model that is. The vendor is the one
265
- `dialecte skills sync` remembered as `vendor` in `.dialecte-skills.json`, in every skill folder of the
266
- project. Sync detects it from the project (`.claude/`, `AGENTS.md` + `.codex/`, `.gemini/`; a folder holding
267
- only the skills a sync wrote is no evidence) and asks on a terminal when several agents, a multi-vendor host
268
- (Copilot, Cursor) or none are found. Without a terminal, a sync that cannot tell installs the skills without a vendor (`models` stays
269
- unset: the skills need none) and says how to set it: `--vendor <id>`, which also sets it without asking. When manifests disagree, `models` warns on stderr, naming them, and uses the
270
- most recently written; an unknown vendor id in a manifest is ignored with a warning. Exit 1 for an unknown
271
- `--vendor`, 2 when no vendor is known.
64
+ The lookups: [`api`](doc/commands/api.md), [`members`](doc/commands/members.md), [`schema`](doc/commands/schema.md), [`explain`](doc/commands/explain.md), [`doctor`](doc/commands/doctor.md), [`models`](doc/commands/models.md).
272
65
 
273
66
  Run outside a package (no `package.json`), each answers a usage error.
274
67
 
275
- ## The standard index
276
-
277
- `dialecte standard` indexes the standards you hold on your machine and answers from them, in slices of whole
278
- lines with their original line numbers. The cli ships no standard and never copies one into a repository.
279
-
280
- **Where the standards are.** `DIALECTE_STANDARD` names one root folder holding one folder per standard; the
281
- folder's name, lowercased, is the standard's id, and its top-level, non-hidden `.md` files are the standard
282
- (subfolders are ignored; a symlink to a folder or a file counts). A file's id is `<standard id>/<file name
283
- without .md>`, lowercased.
284
-
285
- ```
286
- $DIALECTE_STANDARD/
287
- <standard id>/
288
- <part>.md
289
- <amendment>.md
290
- <other standard id>/
291
- <part>.md
292
- ```
293
-
294
- Refused with exit 2, nothing built: `DIALECTE_STANDARD` not set, empty or naming a path that does not exist; a
295
- root that is a file, that holds `.md` files directly (they are named, with the expected layout) or that holds no
296
- standard folder; two folders,
297
- or two files of a folder, whose ids differ only by case (both named); a `--standard <id>` with no folder (the
298
- known ids named); the root, a standard folder or the cache inside a git work tree. A folder with no `.md` file
299
- is reported as `no indexable file` and skipped.
300
-
301
- **Where the index is.** In the cache only: `$XDG_CACHE_HOME/dialecte/standard/<standard id>/<manifest hash>/`
302
- (else `~/.cache/dialecte/...`), one folder per standard and per set of file contents (the manifest hash is the
303
- sha256 of the index format and each file's id and sha256). A folder is built into `<hash>.tmp-<pid>/` and renamed
304
- into place once complete: a file changed during the build aborts it (exit 1, the file named, nothing kept); a
305
- second builder reuses the first one's folder; a temporary folder left by a process that is gone is removed at the
306
- next build. A complete folder is reused, never rebuilt, unless `--rebuild` (the old folder is moved aside, the new
307
- one renamed in, then the old one removed: a reader never sees a half-removed index); the links to the vocabulary of the
308
- installed dialectes are a file of their own, written beside the rest when the selected dialectes change.
309
- Old folders are kept. While a build runs, a running line with its elapsed time goes to stderr on a terminal.
310
-
311
- **The vocabulary.** The tags, attributes and enumeration values of the dialectes installed where the command runs
312
- (every one, or the one `--package <name>` names) are exact names: case kept, never stemmed, then scored like a
313
- word (1 per clause or table, doubled in its heading or caption, weighted by the lines naming it). An attribute under three
314
- characters counts only as `@name`, `name=` or a table cell equal to it, an enumeration value under three
315
- characters only as a table cell equal to it; a name in lowercase letters only, from three characters, is searched
316
- as an ordinary word. The tags file is named by the hash of the selected dialectes' `name@version` list. `index`,
317
- `find` and `eval` print `vocabulary <name@version>[, ...]` (or `vocabulary none (no dialecte installed)`) as their
318
- first line, and `vocabulary: { packages }` in `--json`. A `--package` that is not installed answers exit 2 with
319
- the installed ones named.
320
-
321
- **Words.** Other words are searched by their stem: lowercased, the plural removed, then `-ied` and `-ying` to `-y`,
322
- a final `-ing` or `-ed` (with its doubled consonant) and a final `e` removed; common English, modal and question
323
- words are not searched. A word in capitals and digits with two capitals or more (an acronym) is kept from two
324
- characters, never split nor stemmed; its plural (the acronym and one lowercase `s`) is searched as the acronym.
325
-
326
- - `dialecte standard index [--standard <id>] [--package <name>] [--rebuild] [--json]`: builds or reuses the index of each standard
327
- (or of `--standard <id>` only), then per standard `<id> <n> files built|reused in <time> manifest <hash>`,
328
- per file its lines, quality verdict, noise share, headings kept over candidates, tables and definitions, and
329
- the lines repeated often enough to be a watermark (information only: nothing is dropped for being repeated).
330
- Exit 1 when no selected folder holds a `.md` file.
331
- - `dialecte standard find "<terms>" [--standard <id>] [--package <name>] [--about <Tag>] [--limit <n>] [--json]`:
332
- the slices that hold the terms, ranked over every selected standard (each slice names its file id): a header
333
- `<file id>:<from>-<to> <clause> <title> score <s>`, then the normalised text. A slice starts at the first hit
334
- of its clause's or table's densest run of terms (at most 60 lines holding the most distinct terms, weighted as
335
- in the score) and runs to the last hit, 60 lines at most; a table starts at its caption when that run ends
336
- within 60 lines of it. After the `--limit` (10)
337
- direct slices come the clauses and tables they refer to, marked `[linked]`. `--about <Tag>` adds a tag of the
338
- installed dialectes (an unknown one answers the closest; none installed is a usage error). Exit 1 when nothing
339
- matches.
340
- - `dialecte standard show <file id>:<from>-<to> [--json]`: the normalised text of the logical lines overlapping
341
- the range, each with its original lines. Exit 1 when the range holds only blank or dropped lines; 2 for a
342
- malformed range, an unknown file id (the known ones named), a start after its end or an end after the file's
343
- last line.
344
- - `dialecte standard eval <gold.jsonl> [--standard <id>] [--package <name>] [--json]`: recall at 5 and at 10 of `find` over a gold
345
- file you keep, one `{ "question": ..., "about"?: ..., "expected": [{ "file": "<file id>", "quote": ... }] }` per
346
- line (other fields are ignored). The expected quotes of an item are alternatives: the item is found at the best
347
- rank of any of them. A quote is matched in plain words: table pipes, `<br>` tags, `**`/`__` and a leading `#`
348
- run are left out on both sides, then the text is normalised and case is ignored. Each missed item names its
349
- closest quote and why (`ranked <r>`, `not found by find`, `not in the text`, `unknown file <id>`). Items with
350
- no expected quote are counted apart. Exit 1 when no item has one; 2 for a gold file that cannot be read or a
351
- malformed line (its number named).
352
-
353
- `show`, `find` and `eval` build the index first when it is missing. Every verb answers exit 2 with how to set
354
- `DIALECTE_STANDARD` when no standard is configured.
355
-
356
- ## The facts ledger
357
-
358
- `dialecte facts` reads the facts an agent recorded when it answered a question about a dialecte or a standard,
359
- and retires the ones that no longer hold. A fact is a question (its words, its subject, its kind), its answer,
360
- where the answer comes from (`schema`, `dialecte`, `standard`, `person` or `outside`), the effort it took, the
361
- evidence and the sources it rests on. One question has one current fact; a better answer replaces it (an answer
362
- checked against the documents always replaces an unchecked one, whatever the efforts), and the replaced fact is
363
- kept, marked `superseded by F-<n>`.
364
-
365
- **Where the ledger is.** In your data folder only: `$XDG_DATA_HOME/dialecte/facts/` (else
366
- `$HOME/.local/share/dialecte/facts/`), one ledger per person, shared by every repository you work in. Each fact is a
367
- file `F-<n>.json` and its history `F-<n>.history.jsonl`, one line per event (`created`, `reused`, `stale`,
368
- `superseded`, `forgotten`, `rechecked`); `by-key/` holds one pointer per question to its current fact. Nothing is
369
- ever deleted: a fact file is written once, afterwards only its state, its `supersededBy` and its sources change,
370
- and its history only grows (a history line is at most 4,096 bytes: longer lists and strings in it are cut, and
371
- a line still too long has each list replaced by its length, `fromCount` for `from`; the line marked `cut`, the
372
- fact file always holding its sources whole). Every verb refuses (exit 2, nothing written) a ledger inside a git work tree, naming
373
- the folder, the work tree and the fix: set `XDG_DATA_HOME` to a folder outside the repository. Only the data
374
- folder counts, never the folder the command runs in.
375
-
376
- **States.** A fact's state is the state now, checked on every read:
377
-
378
- - `valid` - its sources still hold;
379
- - `stale` - a source moved since it was recorded: the files of the standard it quotes (any file changed, added or
380
- removed), or the definition of the dialecte it read. Written to the fact once, with a `stale` line holding why
381
- (the source that failed and the fix), which every later read shows;
382
- - `unverifiable` - a source cannot be compared now (no standard configured, its folder gone, the dialecte not
383
- installed). Shown only, never written;
384
- - `unchecked` - an answer from outside the documents; a person's answer given without them is `valid` and marked
385
- `unchecked` on its line;
386
- - `forgotten` - retired by `facts forget`.
387
-
388
- A person's fact is never checked. A fact file no question points to (a record a crash stopped) is an `orphan`; a
389
- file that is not readable JSON is `unreadable`. A read repairs what a crash or two writers at once left: the
390
- previous fact of a question gets its `supersededBy`, with a `superseded` line marked `repaired`.
391
-
392
- - `dialecte facts list [--about <Tag>] [--state <state>|all] [--json]`: one line per question, its current fact
393
- whatever its state: `<id> <state> <effort> <source> <question>` (the question cut). A `stale` fact (found by
394
- this read, or by an earlier one: the reason its `stale` line keeps) or one this read found `unverifiable` ends
395
- its line with `- <why>`: the source that failed and the fix (for example: set `DIALECTE_STANDARD`, the expected
396
- layout of a refused standard root, run from the package that installs the dialecte). `--state valid`, `stale`, `unverifiable`,
397
- `unchecked` or `forgotten`: the current facts in that state now; `--state orphan`: the fact files no question
398
- points to; `--state all`: every fact file, superseded, orphan and unreadable ones (with their path) included, a
399
- superseded fact's line holding `superseded by F-<n>` before its question:
400
- `<id> <state> <effort> <source> superseded by F-<n> <question>`. `--about <Tag>`: the facts whose subject
401
- holds that tag. `--json` answers `{ facts: [{ id, path, fact?, state, current, reason? }] }` (no `fact` for an
402
- unreadable file). An unknown state is
403
- a usage error naming the states. The schema sources are compared with the dialectes installed in the folder the
404
- command runs in; run from a folder with no `package.json`, they are `unverifiable`, never an error.
405
- - `dialecte facts show <id> [--json]`: the fact's question, answer, source, effort, state now (with `- <why>` when
406
- stale or unverifiable), sources and number of pieces of evidence, then its history in order; `--json` answers
407
- `{ fact, state, current, reason?, history }`.
408
- - `dialecte facts forget <id> --reason <text> [--json]`: marks the fact `forgotten` and appends a `forgotten` line
409
- holding the reason (cut at 200 characters, the line then marked `cut`); the file is kept. Forgetting it again says so and writes nothing.
410
- `--json` answers `{ id, state, already }`. No reason, or a blank one, is a usage error.
411
-
412
- `show` and `forget` answer exit 1 for an id with no fact (the closest ids named) or a fact file that is not
413
- readable JSON (its path named).
414
-
415
68
  ## MCP server
416
69
 
417
70
  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`.
@@ -486,1674 +139,44 @@ The hand-over follows the profile:
486
139
  install, the linked dependencies), no record can answer the real run: the rehearsal says which part, and
487
140
  does not run contrib.
488
141
  - Both profiles get the card's `standard` line (see the hand-over card below) and
489
- `dialecte lot standard <id|folder> consulted <note> | not-consulted <reason>`.
142
+ `dialecte lot standard <id|folder> consulted <note> | not-consulted <reason> | outside <note>`.
490
143
 
491
144
  ## Contributing to a Dialecte package
492
145
 
493
- Twelve commands for whoever changes a Dialecte package, a person or an agent. Each answers the same way
146
+ Fourteen commands for whoever changes a Dialecte package, a person or an agent. Each answers the same way
494
147
  every time: exit 0 when green, 1 when a check fails, 2 on a usage error; `--json` where a program reads
495
148
  the answer.
496
149
 
497
- - `dialecte rules [<files...>] [--json]` checks the code rules on the syntax tree of the changed files
498
- (or the files given): exported types outside a `*.types.ts` file, module constants outside a
499
- `*.constants.ts` file, functions declared as `const`, an `await` inside an argument, standard
500
- citations and the package's `referencePatterns` (and, in a contributor, plan tags, acceptance criteria
501
- and ticket numbers: see [Profiles](#profiles)) are errors, and so is a test that takes the system's temporary folder itself as
502
- its root (`tmpdir()` handed to a call that lists or scans a folder, or given as `root` / `cwd` /
503
- `scratchRoot`...: other tests and processes share it; `mkdtempSync(join(tmpdir(), '<prefix>-'))`
504
- gives the test a folder of its own); positional parameters (beyond a leading `query` / `tx`, a
505
- symmetric pair aside) and abbreviated names are warnings. A file it cannot read (a file given that is not
506
- there, no read permission) or a script that does not parse is an error of that file (`unreadable-file`),
507
- never a silent skip. Without file arguments it reads the changed list a scoped gate step hands
508
- (`DIALECTE_GATE_CHANGED`: its text files still on disk; a list it cannot read is an error) and writes the
509
- gate's selection (the files it checked); outside a gate, the files changed against HEAD and the new ones,
510
- that result recorded in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the
511
- files, the errors and warnings), which `dialecte lot recap` reads; a run on named files records nothing.
512
- - `dialecte gate [--fast | --full] [--base <ref>] [--no-reuse] [--declare <path>]... [--json]` runs the Definition of Done: `--fast` (default) `check`,
513
- `skills:check` and the tests of the changed files; `--full` adds `build` and the whole suite (the
514
- runner's defaults: every file in parallel), then the steps derived from the package's scripts after its
515
- own (declared or default): `type-narrowing` (`npm run type-narrowing`, a check a publish workflow runs)
516
- when the package has that script and no step runs it; without the script, one line
517
- `skip type-narrowing no npm script "type-narrowing"` and no step of the record. The docs build and the type bench are contributor checks:
518
- `dialecte contrib` runs them (see [Profiles](#profiles)). Each step runs unfiltered, with
519
- `GIT_OPTIONAL_LOCKS=0` (a `git status` inside it never takes the index lock), and is judged on its exit
520
- code and on the counts it printed: a step exiting non-zero fails whatever it says, a test step that
521
- counts no test fails - except `--fast` on a change that touches no test (a doc edit): the changed-tests
522
- step passes with the note "no test file is affected by the change". A step running an npm script the package lacks
523
- is _not wired_, judged for the whole list before any step runs (every wiring problem shows at once, and a
524
- failed one leaves every other step unrun): a step of the default list (the package declares no list for the
525
- mode) fails `gate --full` and `--release` (`FAIL skills not wired (no npm script "skills:check")`, then the
526
- line `add the script, or opt out with dialecte.gate.skip: "dialecte": { "gate": { "skip": { "skills": "<reason>" } } }` under it;
527
- `dialecte contrib` names `"contrib"` there) and is skipped by `--fast` (`skip skills not wired (...)`, the gate stays green); a step the package declares
528
- fails in every mode, `--fast` included (`declared but not wired (no npm script "<x>")`). The fix is the
529
- script, the step removed from the list, or, for a default step, an opt-out with a reason (below). The
530
- hand-over card shows `✗ <step> not wired (no npm script; or dialecte.gate.skip)` for a full or release record
531
- (`dialecte.contrib.skip` for a contrib one) and `! <step> not
532
- wired (no npm script)` for a fast one, and `! <step> opted out: <reason>` for an opt-out (a warning). The
533
- `type-narrowing` step is derived from the package's scripts and is never unwired. A gate record written
534
- before this check is not reused for a package with an unwired or opted-out step (the key changes). While a hand-over
535
- holds the repository (`dialecte handover <lots.json>` wrote its lock), the gate runs only under the
536
- hand-over written for this repository - the script the lock names exists and the `lots.json` beside it
537
- names this repository, real paths compared - and says so in one line with the command that refreshes
538
- the hand-over once the gate is green (`dialecte handover <lots.json> --rehash`): an author re-gates
539
- after a late edit without touching the lock. It refuses under a hand-over of another repository, a
540
- script that is gone, a folder without a lots file, and while a real `handover run` of that folder is
541
- in progress (its `running.json` names a live process; that refusal names the marker file, in the
542
- hand-over folder, so a person can tell a pid reused by another process). A refusal names the script and the lock and
543
- says what to do: run the hand-over first (its last commit releases the lock), or hand the lock's path
544
- to the person who runs the repository, who decides. A run that reaches its steps records its result in the
545
- worktree's git folder, `dialecte-gate-fast.json` or `dialecte-gate-full.json`: when it ran, HEAD, the
546
- state hash and each step (the tdd step first) with its status, its counts and its note or reason, the
547
- tdd step with the cases of the change it judged (`cases`: label and status); a run refused at the hygiene records nothing. The state hash is that of the tree the
548
- worktree would commit (HEAD's tree with the changed and untracked files on top, the deleted ones
549
- removed, `.dialecte/` left out): committing the lots leaves it the same, any other edit changes it.
550
- The record also holds its `key`, what the run checked: `tree` (the git tree id the state hash is the
551
- sha256 of), `lockHash` (sha256 of `node_modules/.package-lock.json`, what npm installed; `none` without
552
- it), `commandHash` (sha256 of the steps' names and commands in order, and HEAD's commit when a step
553
- runs only the tests the change affects, which depend on the diff against HEAD; `--base` is no part of
554
- it: it reads the `tdd` step only) and `linked` (sha256 over the package's `file:` dependencies as node
555
- loads them - the folder `node_modules/<name>` links to, else the path package.json names - each file
556
- they publish, their package.json and the paths of its `files`, with its path, size and modification
557
- time; an exclusion (`!…`) is left out and a glob is walked from the folder before its wildcard, a
558
- superset of what npm packs; a dependency without package.json or `files` is taken whole;
559
- `node_modules` and `.git` are always left out). The key is taken before the steps and again after
560
- them: when they differ (a step edited a file, an install or a rebuilt dependency during the run) the
561
- record is written without a key, with the state hash of the tree the steps started on, and not stored;
562
- the gate says so in one line before its verdict (`"stored": false` with `--json`). A run whose steps
563
- ran is also stored by its tree in the repository's common git folder, `dialecte-checks/<tree>.json`
564
- (`git rev-parse --git-common-dir`), which every worktree of the repository reads (the newest record
565
- kept per mode and key). Before its steps, a gate looks there: a green record of the same mode and the
566
- same key answers instead of running them -
567
- `reused: gate --<mode> green on this tree at <time> (HEAD <sha>)`, the record's step lines, then
568
- `gate --<mode>: green (reused)` (`"reused": true` with `--json`) - and the worktree's record is
569
- written marked `reused` with the time and HEAD of the run it reuses. The hygiene and the `tdd` step
570
- run every time: they are about the worktree (what is staged, the receipts, `.dialecte/lot.json`, the
571
- base), not the tree, and a `tdd` step failing now is a failed gate. A record that failed, that ran no
572
- step, of another mode (`--fast` never answers `--full` nor the reverse) or written by an older cli
573
- (no key) is never reused; a stored entry of another shape is ignored. A test step that passed only on its
574
- serial rerun is green: it is reused with its `flaky in parallel` note. `--no-reuse` runs the steps
575
- whatever the store holds. The key leaves out the Node version and the environment (a path given
576
- through an environment variable); a `file:` dependency edited and restored to the same size within
577
- the same modification time is not seen either. `--full` and `--release` hold the machine awake while they
578
- run (on macOS a `caffeinate -i -w <the cli's pid>` started at their start, detached, ending with the cli;
579
- nothing on another system, nor when `caffeinate` is not on `PATH`, nor with `DIALECTE_KEEP_AWAKE=0`), and
580
- measure their wall and monotonic time: a run whose wall time passed its monotonic time by over 60 s spanned
581
- a sleep of the machine all the same, its record keeps `sleptMs`, and the hand-over card's gates print
582
- `! slept <duration> during gate --full` for a record of the tree it checks.
583
- - `dialecte gate --hook [--no-reuse]` runs in a commit hook: the test steps of `--full` (its steps counting
584
- tests), unless a green `--full` record of what is committed answers them. Its key is the one a `--full` run of
585
- that state stores - the tree, what npm installed, the `file:` dependencies, the full gate's command hash - with
586
- the tree taken from the index git hands the hook (`GIT_INDEX_FILE`, else the worktree's index), never from the
587
- working files: a merge commit and a partial commit check what they record. A green record of that key prints
588
- one line, `gate --hook: tests reused from gate --full green on tree <tree> at <time> (HEAD <sha>)`, and runs
589
- nothing; otherwise `gate --hook: no green gate --full of tree <tree> with this install: running the tests`, the
590
- test steps (rerun serially on a failure, as the gate does), then one vitest summary line of their summed counts (what the hand-over's hook reader counts),
591
- and `gate --hook: green` or `gate --hook: failed at <step>` (exit 1). It runs no hygiene and no tdd step,
592
- reads no hand-over hold (it runs inside `handover run`'s own commit) and records nothing: `handover run`
593
- records the hook. `--no-reuse` runs the tests whatever the store holds, and so does a hook whose git variables name another
594
- repository than its folder's (the cli ignores them, so what is committed is unknown); `--hook` with `--fast` or `--full` is
595
- refused (exit 2). Write it in the hook as an npm script (`"test:hook": "dialecte gate --hook"`), so the
596
- hand-over reads it as a test step of its own: its card line reads `reused by the hook` when the hook answered
597
- from a record. The cli's own hook runs `npm run check` (type-check, lint, format; no suite), `npm run
598
- test:hook`, then `npm run build`.
599
- - A running step looks running. Each `gate` step and `tdd`'s vitest run is announced before its work:
600
- off a terminal a start line `▶ <step>` (then a line every 30 s of silence and the result), on a
601
- terminal one spinner line `⠋ <step> - <what runs> <elapsed>` that the step's result line replaces (the
602
- gate's summary then leaves out the lines already shown; off a terminal and with `--json` it keeps them).
603
- A silent hook gets the waiting-for-input / watch-mode hint once, at 90 s of silence, on both. The
604
- `handover` card is as wide as the terminal's columns, else `$COLUMNS`, else 80: the box is exactly that
605
- wide and every line wraps inside it with a hanging indent under its text column, never into fewer
606
- than 20 columns of text: a hang that would leave less is reduced; a commit line whose columns
607
- (`<sha> <files> <+->`) leave its subject less puts the subject, and a merge lot's merge line, on their
608
- own rows under it, 2 columns in; a line kept to one row with `…` is wrapped whole when its cut would
609
- keep less; a word wider than the room after the hang (a long path) takes a row of its own, 2 columns
610
- in. Colour only on a
611
- terminal (and never with `NO_COLOR`); the `✓` `!` `✗` marks read the same without it. The command
612
- follows the box whole on one line, to copy: `cd <folder> && bash commit.sh`, or
613
- `node <this cli> handover run <folder>` when the repository's own cli does not answer
614
- `handover run --probe` within 60 s. "This cli" is the script that runs: when it is a temporary one
615
- (`npx` from the registry, `tsx` on the sources), install `@dialecte/cli` in the repository so the
616
- card names its own bin.
617
- - No runner hangs silently. Every child that `dialecte gate` (its steps), `tdd` (its vitest runs) and
618
- `handover run` (each commit and its hooks, `--rehearse` too) start runs in a process group of its own,
619
- with its stdin closed (a command that reads it, such as `grep` with no file, gets end-of-file at once),
620
- and under a stall watchdog. Any output, a part of a line included, counts as activity; so does CPU time
621
- gained by any process of the child's tree (its descendants and its process group, sampled with `ps`
622
- every 5 s, macOS and Linux). After 10 minutes with neither, the tree is printed one line per process
623
- (pid, state, CPU time, command), stopped (SIGTERM to the group and every pid, SIGKILL to what is left
624
- after 2 s) and the run ends only once its processes are gone, as `stalled`: the gate's step fails with
625
- `stalled: no output, no CPU for 10 m 0 s` and the tree in its tail, `tdd`'s run fails with the tree, a
626
- hand-over lot is not committed and its files are unstaged (waiting a few seconds for a stopped git's
627
- `index.lock`; when the lock stays, the run says the files are still staged, names the lock and says
628
- to hand its path to the person who runs the repository, who decides once no git runs in it). A
629
- `ps` that fails or times out gives no verdict on that sample; failing for the whole 10 minutes is a
630
- stall of its own. Ctrl-C, SIGTERM or SIGHUP received by the cli is passed on to every running child's group.
631
- A child that asks the terminal (a gpg or ssh passphrase prompt) runs in a background group: it
632
- stops (state `T`) and is reported as stalled.
633
- - `dialecte contrib [--no-reuse] [--json]` runs the contributor checks of a package whose profile is
634
- `contributor`, after `gate --full` and before `dialecte handover`, one line per row: `rules` on the files
635
- changed against HEAD (recorded as `dialecte rules` records it), the package's `dialecte.contrib.steps`
636
- (default: `docs`, `npm run doc:build` with the `generatedDocs` restored, and `type-bench`,
637
- `npm run type-bench:check`; `[]` keeps the built-in rows only) run as the gate runs its steps (a default
638
- step whose npm script is missing fails the run before any row, the built-in `rules` and `release` rows
639
- included, unless `dialecte.contrib.skip` opts it out with a reason; a declared one fails too), `type-narrowing` (`npm run type-narrowing`) when the package has that script and
640
- none of its steps runs it (without the script, one line `skip type-narrowing no npm script
641
- "type-narrowing"` before `release`, no row), `release` (no dependency named by a local folder), then `mutation` when the
642
- package declares a mutation scope (read from the mutation store now, never recorded). A package step a
643
- green `gate --full` record of this tree and install passed with the same name and command is not run
644
- again: its row says `reused from gate --full at <time>`. The run is recorded as `dialecte-gate-contrib.json`
645
- in the worktree's git folder and stored by tree like a gate record, its key holding HEAD too (the rules
646
- row reads the changed files against it); a green record of the same key answers the rows
647
- (`reused: contrib green on this tree at <time> (HEAD <sha>)`), `--no-reuse` runs them and every step a
648
- `gate --full` passed. Exit 0 green, 1 a row failed, 2 refused (a consumer, where nothing is written, or
649
- a value of package.json no command accepts). `--json`: `{ profile, rows: [{ name, status, detail }],
650
- reused?: { at, head } }`.
651
- - `dialecte tdd red|green|status [<test file> | <test file>::<case name>]... [--base <ref>] [--json]` makes
652
- the order of the work visible: tests written from the spec before any code, red for a real reason, then
653
- made green by an implementation that did not touch them. The ledger lives in the worktree's git folder,
654
- never in the tree. Runs use the package's own vitest (each project's run of a case is a case of its own),
655
- with snapshots never written
656
- (`--update=none`, CI): a snapshot test's snapshot is written by the test station before the red.
657
- - `red` runs every case of the changed test files (or of the files named). A case that fails on an
658
- assertion (a snapshot mismatch included), on a stub's error (a message starting with
659
- `not implemented`) or on an error existing code throws, inside an `expect(...)` a matcher completes,
660
- gets a red. Refused, each with its reason: a passing case that is new or changed ("it ran green: this
661
- test proves nothing yet"); a passing case with a receipt whose own test call changed; a passing case
662
- still waiting for its green whose test file, or test code it imports, changed since its red ("test
663
- code changed since its red and it passes"); a failure on a missing export, a type or syntax error, a
664
- timeout, a stub thrown at import or before the assertion; a file holding `.only` or `only: true`; a
665
- file whose run reports no case, `red` and `green` alike, with why the package's vitest configs (every
666
- `vitest*.config.*` and their `projects`, read as files) give: `ran no case: the file belongs to
667
- <config>, which the default config does not list (projects)`, `ran no case of the file` (the default
668
- config holds it: an empty describe, no test call; or a config cannot be fully read - an `include`,
669
- `exclude` or `projects` entry that is no string literal or inline object, such as an imported constant,
670
- a spread, a call or a glob of config files - and may hold it), `every case is skipped` (only `.skip` /
671
- `.todo` / `.skipIf(true)` cases; the gate, which only collects, maps each case the run reports to its
672
- test call, so a case a helper registers counts as run). A refused file is never frozen, and the gate's
673
- tdd step fails on it with the same reason. A file
674
- no vitest config includes (a Playwright spec, a type test) is no vitest test file: it leaves the
675
- selection with `outside <file> not a vitest test file (no vitest config includes it)`, is never
676
- refused nor frozen, and never fails the gate. A
677
- case the same as at the base is marked unchanged; a case the lot accepts is marked accepted, unless
678
- it is proven red then green at its current test call (an acceptance never overrides a proof: it goes
679
- the normal path, no accepted receipt, and the line adds `acceptance not needed (proven red → green): it
680
- can be removed from the lot file`); a green
681
- case whose test code changed around it is kept and flagged `test code changed around it` (the next
682
- step adding a case to a green file); a case never proven green (only unchanged, accepted or revised)
683
- is kept without a flag, and no receipt. A file with a refusal still records its other cases'
684
- receipts, the refusals kept as evidence; it is frozen when one of its cases is red (those need no re-red;
685
- the refused case stays unproven), else not frozen; the gate fails on it until no case of it is refused.
686
- - Two cases of one run sharing a file, a project and a name share one id, and a receipt names one case: every
687
- case of such a group is refused (`red` and `green`), whatever its state, with `2 cases share this id
688
- (lines 12, 12): <hint>` (a case without a location prints `?`). The hint is `rename one` for two plain
689
- calls; for a case of an `.each` / `.for` table (or under one) it says to spell each title in full:
690
- vitest cuts a `$` field of an each-title at its `truncateThreshold` and prints any array as `[ Array(n) ]`, so
691
- two rows can read the same; `truncateThreshold: 0` in the package's vitest config is the other fix. A member
692
- the run does not judge (skipped, filtered out by `-t`, not targeted by `green`) gets a `duplicate <case>
693
- <reason>` line and no receipt. The cases of the group stay out of the move matching, the rest of the file is
694
- judged as usual, and the exit is 1. `--json` holds `duplicates: [{ file, project, name, lines }]` (empty when
695
- none). The `gate`'s tdd step fails (`duplicate case ids in <n> file(s): <files>`) and the card's tdd section
696
- lists `✗ duplicate id <file>::<name> lines 12, 12` per group, so the hand-over is BLOCKED. A receipt
697
- recorded before under an id now shared never counts.
698
- - A red records the case (file, full name, project), the hashes of its test file, of its own test call
699
- and of the production files, the failing message and the time. It is flagged `rollback` at a
700
- production state the case, or the lot, had already left: a production file moved back from the
701
- newest content the lot reached to its content at the base or at an earlier receipt (the run prints
702
- one `rollback:` line naming the files). The ledger keeps, per base and per production state a receipt
703
- names, the content of each production file changed since that base. The receipts are walked in
704
- order: a green, or a receipt at a state moving nothing back, makes its state's contents the newest; a
705
- put back only reds, refusals or unchanged receipts saw stays put back and adds no content, so a
706
- later red there is flagged again, a restore is not, and a step a green proved (an experiment undone
707
- and kept) is the new newest. A green run taken at code put back still makes its state the newest;
708
- its receipts are flagged `rollback`, with the same line, only when a case the run proves had no
709
- green receipt before (of the same file, name, project and test call; a refused run is no green, an
710
- earlier green counts whatever its flags): a refactor that keeps proven cases green (drops a file the
711
- lot added, puts a file back to its content at the base) is not flagged, a green run proving a case
712
- for the first time there is. Content the refactor
713
- moved away stays reached: bringing it back later flags the reds and the first greens taken there.
714
- A state read at another
715
- base, a lot committed since, is not compared;
716
- `red after green` when the case's own last receipt is a green at the same production state.
717
- - The run freezes each test file without a refusal, and a changed helper, fixture or snapshot only when
718
- a case of a file depending on it went red, or was recorded revised, in that run: what it imports
719
- (relative, tsconfig `paths` or vite alias, barrels and re-exports followed through test code; a
720
- package name is a dependency, not test code), a changed file whose name its test code mentions, or
721
- the text of a production module its test code imports directly (a constant naming a fixture; one hop
722
- into production, never further, and the module itself is production), its own snapshot. Every
723
- dependency found by import is followed in turn, and one found by a name written with its folder
724
- (`fixtures/scan.ts`, a full path): it brings the files it imports (`import type` included). A bare
725
- file name (`index.ts`) may be another file: the changed file it names is a dependency, not followed. The
726
- `setupFiles` of the package's vite or vitest configs (test code no test imports) are a dependency of every
727
- test file, followed as an import: a red freezes a changed one, a `revised` entry naming it lets a red
728
- freeze it. A helper no red covers stays unfrozen, and the gate fails on it, unless a `revised` entry names it
729
- (below). A Vite import query or fragment (`./x.worker?worker&url`, `?raw`, `?url`, `?inline`, `#part`) is
730
- left out of the file the import names; a specifier starting with `#` is a subpath import. The files of
731
- the change an `import.meta.glob(...)` of its test code matches (a pattern relative to the file, `/` for
732
- the package root, or a vite alias; a negated `!pattern` leaves its files out and names none) are
733
- dependencies too, followed like an import. An import that looks local (`@/`, `~/`,
734
- `#`, a `paths` or alias prefix) and resolves nowhere refuses its file, naming the import as written.
735
- - A test-code file moved with its bytes as at the base (git's R100: a deleted path and a new one,
736
- added or untracked, holding the same blob) is no change: a moved test file's cases are `unchanged`
737
- with no receipt to hold, its old path lists no deleted case, a moved helper or fixture waits for no
738
- freeze. A move stays within one kind (a test file to a test file, other test code to other test code;
739
- an empty file never pairs): a test file renamed off (`a.test.ts.off`) lists its cases deleted, one
740
- renamed on is a new file. A move with an edit is a new file and a deleted one. A change that only
741
- deletes test files lists their cases `deleted` in the gate's `tdd` step.
742
- - Cases moved out of a test file (a file split in several, a case cut out into another file) keep the
743
- base's proof with no declaration. A case of a new or changed test file is `moved` when its test call,
744
- by tokens (those its case hash reads), under the same describe path, is in the base text of a test
745
- file the change deletes, or of a changed one that no longer holds that call under that path, and its
746
- own file's base did not hold it; a case of the same name and project matched in two files is moved
747
- from neither (`ambiguous <case> in <files>: moved from none of them`). A moved case is a case of the
748
- base: `tdd red` records it `unchanged` when it passes (and freezes the helpers its file depends on),
749
- and with no receipt yet `status`, the gate and the card read it `unchanged`. `status` and the gate's
750
- details print one line per source file, `moved <n> case(s) <old file> → <k> file(s)`, with
751
- ` · test code changed around them` when a target's code outside its test calls (imports, hooks, helpers,
752
- under the describe paths it keeps) differs from the source's base, read by the same tokens; the card's
753
- tdd section shows the line, and a deleted source is reported by it instead of as deleted. A case a
754
- helper registers (the call at its location is no test call: `checkRow(row)`) is `moved by name` when a
755
- test file the change deletes, or that registers fewer cases now, registered one case of the same name
756
- and project through a runner at the base:
757
- `moved by name <n> case(s) <old file> → <k> file(s) · runner changed: <base call> → <new call>`. Those
758
- base names come from one collect-only run of the base files (no test executes), paid only when a split
759
- is detected statically (a test file deleted, or a changed one whose base ran a registering statement
760
- outside its test calls, by tokens, that it no longer runs; a row added to a table is no split), in a
761
- scratch copy of the base tree outside the worktree removed after it, bounded
762
- at 5 minutes; `status` prints its duration (`base collect <n> file(s) <duration>`).
763
- - `green` runs the changed test files: each case needs a red receipt, its file, its test call and its
764
- test code as frozen, production changed since its red ("nothing in production changed since red"),
765
- and a pass.
766
- - `status` prints each case (red, green, unchanged, accepted, missing receipt, test edited after red,
767
- with its flags), one `skipped <case> <receipts>` line per case with receipts the read rule skips
768
- (below; the gate's details too), the test code changed outside `tdd red`, and the cases the change
769
- deletes. A test
770
- call of the base gone without a title (an `it(name, ...)` whose title is a variable: an edited call
771
- looks deleted) prints `deleted <file> a test call of the base is gone`; when a `gone` entry of
772
- `.dialecte/lot.json` names its file (a path or a glob), it prints
773
- `gone <file> a test call of the base is gone (<reason>)` instead, in the gate's details too. A titled
774
- test gone and a deleted test file stay `deleted`. A changed test file whose run reports no case prints
775
- `refused <file> <reason>` (the reasons of `red` above), one no vitest config includes `outside <file>
776
- not a vitest test file (no vitest config includes it)`. A ledger that cannot be read is refused with its
777
- path. `--json` answers the state: `cases`, `duplicates`, `unfrozen`, `findings`, `unlisted`, and, only
778
- when there are some, `zeroCases: [{ file, reason }]` (the refused files) and `notVitest: [<file>]` (the
779
- files out of the selection).
780
- - `status --flags` prints only the cases whose receipts carry a flag, with their flags.
781
- - `status --legend` prints the tdd terms of the hand-over card, each in two lines: what it means, and
782
- whether to look. It needs no package: it works from any folder.
783
- - The lot is the uncommitted work: the change is measured from HEAD, so the cases of lots already
784
- committed on the branch are not asked again. `--base <ref>` (`tdd` and `gate`) gives the
785
- whole-branch view; `gate --full` (and `--release`) measures the tdd step from the lot's base: the
786
- branch the lot was started on (the store lot's base, else the branch `worktree add` recorded it was cut
787
- from; a base given as a commit id stands for the resolved base branch), from where HEAD now leaves it,
788
- so a lot that merged or rebased onto its base's new commits is not asked for them. When that base is
789
- not found, is behind the cut, never held the cut (a stacked lot), was rewritten or has merged the lot's own commits, it measures from the
790
- worktree's cut and says why; a worktree with no recorded base measures from its cut, one not made by
791
- `worktree add` from where the branch left its base branch. The first details line of the gate's tdd step
792
- (none when the step is skipped) reads `tdd base: <short sha> (<source>)`, the source one of `--base`,
793
- `lot base <ref>`, `worktree from <ref>`, `base branch <b> (the lot's base is a commit)`, `worktree cut`,
794
- `base branch <b>`, `HEAD`; a fallback reads `tdd base: the worktree's cut (<why>)`, the why one of `no
795
- base branch recorded`, `<ref> not found`, `<ref> is behind the cut`, `<ref> does not hold the cut: a
796
- stacked lot` (the ref's reflog never reached the cut), `<ref> was rewritten: the cut <sha>
797
- is no ancestor of the merge-base <sha>`, `<ref> holds the lot's own commits`.
798
- - Test code is compared by the leaves of the parser's syntax tree, each file parsed by its extension
799
- (a `.ts` file is no TSX): whitespace, comments (except the ones a tool reads:
800
- `@vitest-environment`, `@jest-environment`, `@vite-ignore`), quote style, statement semicolons,
801
- trailing commas after an element and the order of import statements between side-effect imports
802
- are formatting (a formatter pass needs no new red); template literals count by their raw text; any
803
- other edit is a change. The receipts are a version-3 ledger: an older one is refused, to be moved
804
- aside. A repository without a commit is refused in one line.
805
- - A package whose test entry is production code declares it:
806
- `"dialecte": { "tdd": { "production": ["src/test"] } }`; the test files, fixtures, snapshots and
807
- `*.script.ts` under such a folder stay test code. `testCase.only ? it.only : it` is no focus marker.
808
- - A case edited at review after it was proven is declared in `.dialecte/lot.json`
809
- (`"revised": [{ "case": "<file>::<name>", "reason": "<why>" }]`). It needs an earlier receipt of
810
- the case (a red, an unchanged, an accepted one), not necessarily a red, or to be a case of the base:
811
- its file exists at the base, every title of its name written as a string now is written there too,
812
- and, when its own title is the literal title of an `it` / `test` call at the base or now, the base
813
- holds such a call with its describe path (a computed describe title, a `describe.each` /
814
- `describe.for` format, matches any; a `describe.skipIf` / `describe.runIf` suite counts by its
815
- title) and the file now no more of them (a test moved to another describe, or a string of that title
816
- removed elsewhere, is no proof); otherwise (a table row, a computed title) its own title is written
817
- as a string there and no more times now. A new case (a new file, a new title, a row added to a table)
818
- still needs a red; a case whose title the file computes and the base does not write is refused
819
- ("not provably a case of the base: accept it or prove it red"). The `case` may also be a file path or
820
- a glob over file paths (`scripts/**/*.test.ts`: `**` any folders, `*` and `?` within one), relative
821
- to the package root, without `::`: it applies to every case of the matching files, with one reason.
822
- A file or glob entry never covers a case whose last proof is a red still waiting for its green, and
823
- keeps the `red after green` flag of a case made red again; an exact entry covers both. An `accept`
824
- entry stays one exact case. The next `tdd red` records it as revised when it passes (a
825
- red when it fails) and freezes its file and the changed test code it depends on. A file or glob entry
826
- may also name a test helper (test code that is not a test file: a helper, a fixture, a constant beside
827
- the tests) edited at review while its dependent cases stay green: the next `tdd red` freezes it at its
828
- new hash and prints `revised <helper> <reason>`, when every changed test file depending on it
829
- is in the run and frozen by it with no case red (a refused file, a red still waiting for
830
- its green, or a changed dependent outside a targeted run leaves it unfrozen, named on an
831
- `unfrozen <helper>` line). A helper that no changed test file depends on (its dependents are all
832
- unchanged since the base) is frozen by any `tdd red` whatever its files, with the entry's reason. The new freeze makes the dependent
833
- cases' earlier green stale: `tdd green` proves them again. Without that red run the gate fails on the
834
- edit; `status` lists the revised cases, the gate and the hand-over card list the revisions (cases
835
- and helpers) with their reason, an entry (exact, file or glob) no revised case or helper used as a
836
- note. A `revised` entry covering a proven case nothing changed since its proof (same test call, test
837
- code as frozen) records nothing: the line reads `kept <case> proven before (<kind>) revision not
838
- needed (nothing changed since its proof): <reason>`, and the entry stays unused.
839
- - A receipt counts only while its declaration holds (the read rule of `tdd red`, `tdd green`,
840
- `tdd status`, the gate and the card): an `accepted` receipt whose `accept` entry the lot file no longer
841
- holds, or that a red then a green of the same test call precede, and a `revised` receipt no `revised`
842
- entry (exact, file or glob) covers any more, are skipped, and the case reads from its earlier proof (a
843
- case whose file was frozen again after its green owes a fresh `tdd green`). Nothing in the ledger is
844
- rewritten; the flags are read from every receipt. A skipped receipt is named:
845
- `skipped <case> 1 accepted receipt (no longer declared)`, or `(proven red → green before it)`.
846
- - What it cannot see: the receipts can be written by an agent with a shell; a deliberate throw in
847
- production looks like a stub; code written first, hidden, then a red taken at the base state, cannot
848
- be told from an honest red (at the first step the red's production is the base's). The flags and the
849
- refusals make the rest visible; the review reads the diff.
850
- - `dialecte new verb <namespace> <query|transaction> <name> [--version <v>]` writes a verb of a dialecte
851
- package in the house style: the function (query or transaction first, one params object), its
852
- `.types.ts`, a table-driven test with one red case (no `only`: `tdd red` refuses a focus marker; while
853
- iterating, run the case with `npx vitest run <file> -t "<case>"`), its barrel export and, for a new
854
- namespace, the namespace module and its registration. Its JSDoc summary and `@intent` start with
855
- `FILL:`, which `skills check` refuses until written; the command prints every placeholder left.
856
- - `dialecte handover write <lots.json> [--release] [--target <branch>] [--out <id|folder>] [--rehash] [--json]` (or `dialecte handover <lots.json>`) prepares the commit-by-lots
857
- hand-over a human runs. `--target <branch>` names the branch the hand-over must not be behind (default: the
858
- [base branch](#the-base-branch)); it is written as `target` in the lots file. A branch with no ref, local or on
859
- origin (`--target nope: no such branch, local or on origin`), a `--target` with no branch after it, or no base
860
- branch to default to, is refused (exit 2, nothing written). `--release` marks it a release hand-over (`"release": true` in the lots file): its card
861
- then holds a required `gate release` row, green only with a green `gate --release` record of the tree it commits.
862
- The lots file names the repository, the branch and HEAD expected, and the lots (paths, message):
863
-
864
- ```json
865
- {
866
- "repository": "/path/to/the/repository",
867
- "branch": "feat/names",
868
- "head": "d4b1c04",
869
- "gates": "the scl cases need DIALECTE_SCL_DIR: skipped here",
870
- "lots": [
871
- { "paths": ["src/names/"], "message": "feat(names): names stay unique among siblings" },
872
- { "paths": ["CHANGELOG.md"], "message": "docs(changelog): unique names" }
873
- ]
874
- }
875
- ```
876
-
877
- `gates` is optional free text, the caveats for the person about to run the hand-over: the cards printed
878
- before a run (this one, a rehearsal's) show it as their notes; the card a real run prints after it has
879
- none. The card reads the gates from their records.
880
- It refuses (and writes nothing) when the branch or HEAD differ, `core.hooksPath` names a folder that
881
- does not exist (git would skip every hook; it says how to restore it), something is staged, a changed
882
- file is in no lot or in two, or a lot file (evals included) or message holds a standard citation, one
883
- of the package's `referencePatterns`, or, in a contributor, a tag (see [Profiles](#profiles)). Otherwise it writes the hand-over folder - the lots file, the snapshot (`files.txt`,
884
- `files.sha256`, `files.deleted`, and `lots.sha256`: the lots file as reviewed) and a one-line
885
- `commit.sh` that runs
886
- `npx --no-install @dialecte/cli handover run <folder>` (bash, also run with `sh`; when the repository
887
- installs no cli that can, it says so in one line with the fix) - and prints the hand-over card, the
888
- command with its absolute `cd` under it. The folder is the lots file's, or `--out <id|folder>`: a lot (its
889
- index, full name, a path to its folder or `.dialecte/lot`) writes into the lot folder, any other word is a
890
- folder; either way the folder is taken by its real path (a folder not made yet: the real path of its nearest
891
- existing ancestor, then the rest) before anything is written, so `commit.sh`, the lock, the card, `--json`'s
892
- `folder` and the registry all hold it. A word naming both an existing folder and a lot is the folder: the
893
- card's output starts with the note saying so (`outNote` in `--json`). Refused (exit 2, nothing written), when the folder is a lot folder, in
894
- this order: a damaged lot (`<name> is damaged (<reason>): ...`, naming `lot stop`), a simulated lot (`a simulated lot has no hand-over`), a `canceled` or `failed` lot, an open
895
- question (`answer q<k> first: dialecte lot answer <full name> q<k> "<answer>" ...`), a lots file whose
896
- repository is not the lot's worktree or whose branch is not the lot's (both named); and for any folder whose
897
- registered hand-over is `committed` (`<name> is committed: a committed hand-over is never rewritten`). Every hand-over
898
- written is registered in the repository's store, `<git common dir>/dialecte-handover/`: shared by every
899
- worktree of the repository, kept when a worktree is removed, never in the working tree. The store holds
900
- one entry per hand-over, `<name>.json` = `{ folder, branch, worktree, index, written, state }` (the folder's
901
- absolute path, the lots file's branch and repository, the worktree's index when its folder is numbered
902
- (`0171` for `.worktrees/0171-cli-x`, absent otherwise), when it was written, and its state as last
903
- recorded: `pending` when written, `committed` by a real run that commits every lot, `abandoned` by
904
- `handover abandon`); the folder stays where it was written. The name is `<yyyy-mm-dd>-<branch slug>[-<n>]` -
905
- the local date, the branch with every run of characters outside `[A-Za-z0-9._-]` (the `/` included)
906
- turned into one `-`, then `-2`, `-3`... when that name has an entry already. A folder registered already
907
- (the same real path) keeps its name: `--rehash` updates its entry, never a second one, and never one
908
- recorded `committed`. An entry is written whole (a reader sees the old entry or the new one; on a file
909
- system without hard links a new entry is written exclusively instead) and stays writable, so an older cli
910
- can still record its state. A rehearsal and `show` write no entry. `--json` answers the card as data: the verdict, `profile`,
911
- `failedGates`, `otherTreeGates`, `declarations` (the entries to read), `gates` (the gate lines: name,
912
- status, detail), `contrib` (a contributor's contrib rows, one per row: name, status, detail, and `stale`
913
- 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
914
- hand-over's registered name; absent for a folder with no entry), `worktree` (absolute), `index` (a
915
- numbered worktree's), and each lot with
916
- `pending` until it is committed. Edited a file after the review? `--rehash` (also after
917
- editing `lots.json`). The repository stays held until every lot is committed: `dialecte gate` runs
918
- only under this hand-over (see `gate`), and a hand-over of another folder is refused, naming the script
919
- that holds the repository and its lock.
920
-
921
- - The hand-over card is what a person reads before running the hand-over, and again at its end. Its title
922
- is `hand-over: <repository folder> <branch>`, with the worktree's index first from a numbered worktree
923
- (`hand-over: 0171 cli feat/x`: the repository's own folder name, so the number is shown once). The commit
924
- section ends with the `worktree` line: the worktree the lots are committed in, relative to the workspace
925
- when it is inside it (`.worktrees/0171-cli-x`, `cli` for the main checkout), else its absolute path; both
926
- compared by real path, so a side reached through a link (`/var` and `/private/var`) reads the same. Its
927
- first line is the verdict: `READY` when no gate line failed and none ran on another tree, `BLOCKED` with
928
- `<n> gates failed: <names>` and `gates ran on another tree: <names>`, `DONE` once a real run committed
929
- every lot; then the lots, files and `+<added> −<removed>` (`all gates green` when nothing blocks), and
930
- `<n> declarations to read (below)` on a second line. Its sections:
931
- - `commit`: one line per lot - its sha, or `pending`; its files, lines added and removed, and subject. A
932
- merge lot's line follows (`merge <branch> at <tip> · <n> conflicts · tree <sha>`, or
933
- `tree not recorded: rehearse first`); a merge lot is sized from the tree it was trial-merged on to
934
- the tree a rehearsal recorded, else says `size after rehearse`. Then `HEAD <sha>`, after a run
935
- `HEAD <base> → <tip> · nothing pushed`.
936
- - `gates`: one line per gate step from the gate records (the latest record of each step over `--fast`,
937
- `--full` and the commit hook's record, a line of the hook's ending with `commit hook`:
938
- `✓ test:run 1214/1214 · commit hook`; a gate record newer than the hook's replaces its lines whole,
939
- since the hook names its own scripts, not the gate's steps; the other way round, a hook record of the
940
- tree the hand-over commits, not dropped by a newer gate record of that tree, replaces the lines of
941
- every gate record of another tree it answers - a step of the same name, or a step counting tests when
942
- the hook counts tests: a merge hand-over rehearsed or committed reads the hook's lines of the merged
943
- tree, the worktree's `tests` of its tree before the merge left out. No check leaves silently: a step
944
- the hook did not run reads `! skills not run on the merged tree` (a warning, not of another tree), a
945
- failed one stays `✗ ... (the tree changed since)`, and `tdd` stays the worktree's: on the DONE card of a
946
- merge hand-over the tdd verdict is judged on the worktree's own lot tree (the tree its first merge lot
947
- merged onto), current while the hook record of the merged tree stands, so no `gates ran on another tree`
948
- for it), then, in a consumer, `mutation` when the package declares a mutation scope (below), then
949
- `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots (below), then `late
950
- fixes` on a card still to run (below), then `standard`. `✓`
951
- passed; `!` to look at (a step not run here, with its reason, or not run after a failure; no
952
- findings ledger, or one holding no row yet: `no findings recorded`; only nits open); `✗` failed (a
953
- failed step, a blocking or should-fix finding open, no independent review after the last round, `gate
954
- never run on this tree` when there is no record).
955
- - `review`: the review rounds are the `round-<n>/` snapshots only, against the cap of the lot's effort
956
- (low 1, medium 2, high 3; the identity's effort, else the folder's `brief.json`), then the independent
957
- review, then the open findings: `✓ review 2 review rounds of 2 · independent review approve · approved`.
958
- The independent review must come after the last snapshot: an `independent-reviewer` station end with a
959
- verdict strictly after the snapshot's time (`round-<n>.state`'s `at`, else `round-<n>.base`'s mtime; a
960
- tie is not after), shown `independent review <verdict>`; or, for a folder without step events (no
961
- `events.jsonl`, or events saying the worktree's cli writes none), a ledger row of a round above it,
962
- shown `independent review: round 3 in the ledger` (`rounds 3-4`). None: `✗ review no independent
963
- review after round <n>`, the card BLOCKED. Beyond the cap each round names its first go-ahead row
964
- (`3 review rounds (cap 1, round 2 by <who>, round 3 by <who>)`), a round without one gives `! review
965
- 3 review rounds, cap 2, no go-ahead recorded` (a warning); no effort recorded: `2 review rounds (no
966
- effort recorded)`. A folder with step events and no review round snapshot reads `✗ review no review
967
- round snapshot: dialecte lot snapshot <lot> --round 1` (the ledger never stands in there). A folder with
968
- no snapshot, no ledger row and no independent end, a folder without step events and with no snapshot
969
- (its ledger rows claim no independent review), and a release hand-over keep the ledger-only line
970
- (`<n> rounds · approved · findings ledger`).
971
- - `late fixes`: a change of the tree after the last snapshot (the worktree's state hash against
972
- `round-<n>.state`'s) reads `! late fixes unverified since round <n> (<k> files): dialecte lot verify
973
- <lot> --by <who> --note <text>`, a `lot verify` of the current state `✓ late fixes verified by <who>:
974
- <note>`, a last snapshot without `.state` (an older cli) `! late fixes not checked (round <n> has no
975
- state)`; the last snapshot's tree, or no snapshot, prints no line. A warning only: `handover run`'s
976
- `verify` guard refuses. The records read are the worktree's last runs and the store's records of the tree the
977
- hand-over commits - the worktree's tree, or for a hand-over holding a merge lot the tree its last lot
978
- leaves (the trial merge with its resolutions) - the newest record of each step winning; a tdd step
979
- another worktree recorded is left out (its verdict is that worktree's), and a stored record counts
980
- only when it ran against what is installed here now (the same `node_modules` and `file:`
981
- dependencies) with the command of its mode now. A line from a record made at a commit outside the
982
- history of HEAD ends `· from <sha>` (the branch commit's hook record read for a merge on main; a
983
- record of an earlier commit of this line carries none), a rehearsal's record `· rehearsal`. A record
984
- of another tree than the one checked ends with `(the tree changed since)`: its line turns `!` and
985
- blocks the hand-over; a failed step stays `✗`. The `tdd` line is the worktree's: it is stale only when
986
- its record is of another tree than the worktree's now, never because the tree checked is a merge's;
987
- once a merge hand-over is committed, its card keeps `! tdd ... (the tree changed since)` and `gates ran
988
- on another tree: tdd`, since the worktree took the merge after its tdd verdict.
989
- The `mutation` line is what the package still owes its mutation runs, read from the mutation store when
990
- the card is written. `✗` (blocks): `new` survivors or died runs of the package, whatever their lot
991
- (`2 new survivors · 1 died run: dialecte mutants status`); a run of the branch still running when the
992
- hand-over merges a branch (`run <id> still running (pid <pid>): the merge waits for it`, a run of a
993
- merged branch too) or when the lot's mutation switch is `gate` (`...: a gate lot waits for it`); a gate
994
- lot with no run of its branch (or a merged one) reported on the tree the hand-over commits
995
- (`gate lot: run dialecte mutants run on this tree first`); an invalid `dialecte.mutation` or lot switch,
996
- with its reason. `!` (does not block): a run of the branch still running on a plain hand-over
997
- (`...: its survivors are not in yet`). Otherwise `✓ mutation nothing pending`. To unblock: kill each
998
- survivor with a test, record its reason
999
- (`dialecte mutants record --key <key> --family <family> --reason <why>`), or
1000
- `dialecte mutants schedule <follow-up> <key>`; rerun a died run or `dialecte mutants abandon <run id>`;
1001
- wait for a running run; run `dialecte mutants run` on the tree for a gate lot. The switch is the
1002
- hand-over folder's `lot.json` when it holds one, else `.dialecte/lot.json`.
1003
- The `standard` line says whether the standard was consulted. A standard is configured when
1004
- `DIALECTE_STANDARD` names a file or folder that exists (the environment only: no committed file names
1005
- it). `✓ standard consulted · <note>` when one is configured and the station recorded a consultation;
1006
- `✗ standard configured, not consulted: dialecte lot standard <folder> consulted <note>` (blocks) when
1007
- one is configured and none is recorded; `! standard not consulted: none configured (DIALECTE_STANDARD)`
1008
- otherwise, with the recorded not-consulted reason when there is one: a warning that never blocks. A DONE card
1009
- (committed) shows the state recorded on the lot, never one read from the shell that ran the hand-over:
1010
- `✓ standard consulted · <note>`, `! standard not consulted · <reason>`, or
1011
- `! standard not consulted: none recorded on the lot`. The station records it
1012
- with `dialecte lot standard <id|folder> consulted <note>` or `not-consulted <reason>` (the card's line
1013
- names the hand-over's folder).
1014
- - `contrib` (a contributor's): the rows of the `dialecte contrib` record of the tree the hand-over commits,
1015
- read as gate lines (`rules` with its errors and warnings, the package's steps, `release`), then the live
1016
- `mutation` row. A stored record counts when its key is the one the `contrib` guard asks for: a run at
1017
- the lots file's HEAD on that tree, against what is installed now, with the package's contrib rows. Else
1018
- the worktree's last contrib record, each row stale and saying what changed: `(the tree changed since)`,
1019
- `(HEAD moved since: run dialecte contrib again)`, or `(the install or the contrib rows changed since)`;
1020
- else `✗ contrib never run: dialecte contrib`. Every row green prints one line naming the rows, with the
1021
- record's source; any other row expands the section to one line per row. A failed or stale row counts
1022
- with the failed gates and the gates of another tree.
1023
- - `tdd`: the lot's exemption; only the cases of the change count, those the gate's tdd step listed on
1024
- this tree (a retitled or removed case's receipts are not counted under the old title); without a gate
1025
- record of this tree that lists them, one line `counts from the last gate: run the gate on this tree`
1026
- replaces the counts, groups, entries and flags; each case counted once by the status the gate gave
1027
- it (red then green as proven, kept when its last receipt is a kept after a green; accepted and
1028
- revised only in their groups)
1029
- (`<n> proven red → green · <m> unchanged`, and `· <k> kept` when any); the accepted cases: a head
1030
- line `<n> accepted`, then one row per reason of the lot file (`<count> <reason>`, the largest group
1031
- first, a tie in the lot file's order, each reason wrapped under itself); the accepted and revised receipts
1032
- of earlier lots (cases outside the change), which the lot file no longer names, on one line
1033
- (`earlier lots: 410 accepted, 12 revised (not in the lot file)`); then
1034
- `<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)
1035
- with its reason under it, a helper a red run froze for a `revised` entry as `revised <helper>` with its
1036
- reason under it, a `gone` entry with its reason (whether one covers a finding is the gate's
1037
- to say), an `accept` or `revised` entry no case used, a case of the change whose receipts the read
1038
- rule skips (`skipped <file> › <title>: 1 accepted receipt (no longer declared)`). Then one line per kind of flag with its count of
1039
- cases (`dialecte tdd status --flags` lists them); cases whose only flag is `test code changed around it`
1040
- and whose receipts are otherwise only unchanged are counted apart (a case flagged rollback or red after
1041
- green never is), as
1042
- `helper code changed near unchanged cases (noise)`.
1043
- - `notes`: the lots file's `gates` text, as written; only on the cards printed before a run (the
1044
- written card, a rehearsal's), never on the card after a real run.
1045
-
1046
- Its closing rule names the hand-over, so a part of the card copied alone still says which one it is:
1047
- `dialecte handover show <id> · run <id> · --legend · details: dialecte tdd status`, `<id>` the
1048
- hand-over's registered name, or its folder's absolute path when it has no entry (a folder written by an
1049
- earlier cli; in a box too narrow for it, that
1050
- text is printed inside, above a plain closing rule) - on the written card, `show`'s, a run's and a
1051
- rehearsal's. The command stays under the box until every lot is committed. `dialecte handover --legend` prints every term the card can
1052
- print, each in two lines: what it means, and whether to look.
1053
-
1054
- - `dialecte handover run <folder>` (and `--rehearse`) holds the machine awake while it runs, as `gate --full`
1055
- does, and writes `last-run.json` in the hand-over folder when it ends (before the card of a real run):
1056
- `sleptMs` when its wall time passed its monotonic time by over 60 s; the DONE card then prints
1057
- `! slept <duration> during handover run` in its gates.
1058
- - A hand-over written behind its target branch is not run. The card (READY or BLOCKED, `handover show <one>`)
1059
- prints `! main moved: merge main first (3 commit(s) on main, now 1a2b3c4d)` under its verdict, which reads
1060
- BLOCKED (`--json`: `targetMoved: { branch, ref, tip, behind }`). The target is held when its tip is an
1061
- ancestor of the lots file's HEAD or of a merge lot's tip. When some lots are committed already the line adds
1062
- `: write a new hand-over on the current HEAD with a merge lot of main`. A hand-over onto the target itself, a
1063
- committed one and an abandoned one are not judged; a lots file written before `target` existed is judged
1064
- against the base branch; a `target` that names no ref gives a `!` line with the refusal and BLOCKED.
1065
- - The card also lists the processes working in the worktree (`handover show <one>`, READY or BLOCKED; `lot
1066
- result`, the run picker and `handover list` never look): `✗ processes 2 left running in the worktree: 4123 node
1067
- …vitest --watch, 4177 npm run dev (stop them: kill 4123 4177)` blocks, `! processes open on the worktree:
1068
- code, zsh` and `! processes not known (<why>)` warn (`--json`: `processes: { leftBehind, tools, unknown? }`).
1069
- The run itself, its shell or agent, what it started and every process of its own process group (the other
1070
- commands of its pipeline, such as a `| grep` after it) are never listed: a leftover started in the same process
1071
- group as the cli (the same non-interactive shell command) therefore counts as the run's own. A process with a terminal, one
1072
- whose command (or an ancestor's) is a known editor or the one `git config dialecte.editor` names, and one
1073
- named in `git config dialecte.personProcesses` (a comma list of command names, never committed) is one of the
1074
- person's tools; every other process is left behind.
1075
- - `dialecte handover run <folder>` is what `commit.sh` runs. Three of its guards, `target` (the target branch's tip is held, as above),
1076
- `processes` (read at run time, never from the card: a process left behind, or a list that cannot be read,
1077
- refuses; tools only pass with `!`) and `verify` (late fixes nobody verified: `✗ verify late fixes
1078
- unverified since round <n>`; `! verify late fixes not checked (round <n> has no state)` never refuses;
1079
- `✓ verify no late fixes`, or `verified by <who>: <note>`), come after the merges guard. Each refusal
1080
- exits 2 with nothing committed, where every other guard exits 1; `--rehearse` prints `!` for each and goes
1081
- on. The merges guard's note for a merge lot of the target that moved reads `lot <n>: merges main at <sha>; main
1082
- is now <sha> (see target)`. Each guard prints one line with its result
1083
- and its time (`✓ snapshot 110 file(s) 0.4 s`): repository, the lots file as reviewed, hooks
1084
- folder, branch, HEAD, empty index, the files against the snapshot, deleted files, files outside the
1085
- lots, references (citations, declared patterns, and the tags of a contributor), `contrib` in a contributor
1086
- (a green `dialecte contrib` record of the tree the lots leave, at the lots file's HEAD, against what is
1087
- installed now; a rehearsal never stops there), and last `mutation`: the card's `mutation` verdict computed again when the
1088
- guard runs (never taken from the card), so a run that reported a survivor, or died, after the card was
1089
- written refuses the run with exit 1 and nothing committed (`✗ mutation <detail>`, each survivor and died
1090
- run indented under it, then what to do with each); a run still running on a plain hand-over passes with
1091
- its warning; `✓ mutation no mutation scope declared` for a package without one. A rehearsal runs the
1092
- same guard. When the staged files are exactly the next lot's (a run stopped after
1093
- staging it), the index guard prints the command that unstages them, with its `cd`.
1094
- Then each lot announced before its work: off a terminal `▶ lot n/N` with its files and subject, and a
1095
- line every 30 s in which nothing of the lot was shown (`… <lot> running 2 m 10 s`: hook lines the view
1096
- leaves out do not count); on a terminal one spinner line naming the lot,
1097
- what runs and the time. The commit's hook output is read as steps, from npm's script headers: a script
1098
- that runs others (`npm run`, `run-p`, `run-s`, `npm-run-all`) is their parent, and the lines of the
1099
- scripts a parent runs in parallel stay the parent's. While the hook runs, only the current step and the
1100
- warning and error lines show (lint, format, type-check and build warnings and errors, failing tests),
1101
- each labelled by the step that printed it (`[lint:check] <line>`): on a terminal the step with its
1102
- elapsed time and those lines live under the spinner, off one `│ ▶ <step>` per step and those lines
1103
- behind `│`. A test step (a `test` segment in its name: `test`, `test:run`, `unit:test`; or a test
1104
- runner on its command line: `vitest`, `jest`, `node --test`) shows its failing tests and failed scripts
1105
- only: the warnings its tests print are theirs, not the repository's. A line its step printed already
1106
- (the same text: Vite's `configLoader` notice, 2-3 times per build) is not a new line: on a terminal
1107
- the first one carries the count, `<line> (×3)`, updated in place; off a terminal (a log) a line is
1108
- written as it is read, its identical repeats right after it are counted, and when that run of repeats
1109
- ends (another warning or error line, the next step, the hook's end) a run of two or more is written
1110
- again as `<line> (×<n>)`. Lines of different steps never merge. Every byte goes to the hook's full
1111
- log as it comes. After a passing hook, one summary line
1112
- (`check ✓ · test:run ✓ 1214 · build ✓ · 1 lint warning in lint:check`: the scripts the hook runs, a
1113
- script they run only when it printed counts or failed; the warnings counted per step and kind, in the
1114
- order first printed, each distinct line once: the same text printed again in its step counts once),
1115
- the labelled warning lines (each once, where it was first printed, with its step's total as
1116
- `(×<n>)` from 2) and `full log: <path>`; after a failing hook, the
1117
- summary with `✗`, the labelled error lines not among the failing step's last 30 lines (each once, with
1118
- its count), those 30 lines
1119
- and the log's path. A hook that ended (passed or failed; not one stopped as stalled) is recorded in
1120
- the git folder of the repository it committed in (`dialecte-gate-hook.json`, mode `hook`): HEAD after
1121
- it (the new commit, or the base when it failed), the state hash of the tree before the commit and the
1122
- steps its summary names with their status and counts; the card reads it with the gate records, so a
1123
- lot committed where no `dialecte gate` ran still shows its gates, until a newer gate record replaces
1124
- it. The record holds its key too (the tree the hook ran on, what npm installed, the `file:` dependencies,
1125
- and for `commandHash` the hook files git runs: husky's `.husky/<hook>` scripts, else the hooks folder's
1126
- executable files) and goes to the repository's store of records by tree. A rehearsal writes it in its
1127
- scratch clone's git folder and in the repository's store, marked `origin: "rehearsal"`, never in the
1128
- repository's own `dialecte-gate-hook.json`. A hook that prints nothing gets `hook ✓` (or
1129
- `hook ✗`) and the log's path; a repository with no commit hook prints none of it (in husky's `.husky/_`,
1130
- which holds a wrapper for every hook name, a hook counts only when its script exists in `.husky/`). Then the commit with
1131
- 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
1132
- finds the lots already committed on top of the recorded HEAD (same message, same paths, the bytes of the
1133
- reviewed snapshot `files.sha256`, not the working tree) and resumes at the next one; anything else on top
1134
- of HEAD is refused with what was found. When every lot is committed, the `head` line says the hand-over is
1135
- already committed and the guards after it (they read the working tree, which later work may change) are
1136
- not run: the run exits 0. It never
1137
- pushes. `--rehearse` first decides, per lot and before any clone, whether rehearsing it can find
1138
- something new, and prints one line per lot: `lot <n>/<N> reused <reason>` or
1139
- `lot <n>/<N> rehearse <reason>`. A plain lot is reused when the store holds a green `gate --full` of
1140
- the tree its commit will hold (HEAD with every lot up to it on top) with the key of now - the same
1141
- `node_modules`, `file:` dependencies and `--full` steps - the lot does not change `package-lock.json`,
1142
- and the commit hook stages no files of its own (its text names `git add`, `git stage`, `lint-staged` or
1143
- `git update-index`): `green gate --full on tree <tree>`. A merge lot is reused when the tree it leaves
1144
- (its trial merge with its resolutions) is its tip's tree and a green record of that tree - the branch
1145
- commit's hook record or a `gate --full`, with the key of now - is in the store, under the same
1146
- conditions: `green hook record of the tip's tree <tree>`. Otherwise the line says the first reason that
1147
- holds: `no green gate --full on tree <tree>`, `the lot changes package-lock.json`,
1148
- `the hook stages files (<match>)`, `node_modules changed since the record`,
1149
- `a linked dependency changed since the record`,
1150
- `<branch> moved: the merge leaves tree <tree>, the tip holds <tree>` (`<branch>` the one the hand-over
1151
- commits on: `main moved: ...`), `no green record of the tip's tree <tree>`; `--rehearse --full`
1152
- rehearses every lot (`--full`). The decisions go to `rehearsal.json` in the hand-over folder
1153
- (when, and per lot its tree, `reused` or `rehearsed`, the reason and the record reused: mode, time,
1154
- HEAD, and `contrib: "run"` on a contributor's last lot whose tree has no green contrib record). When every
1155
- lot is reused and no contrib run is needed, no clone is made: the guards, a reused merge's `tree <sha>`,
1156
- then `rehearsal skipped: every lot's tree has a green record` and the card. Otherwise the clone is made
1157
- (`▶ rehearsal contrib` then runs `dialecte contrib` in it at the lots file's HEAD on the tree the lots
1158
- leave, before any commit, its record going to the repository's store as a rehearsal's; the clone is put
1159
- back after it, the files the run left removed) and
1160
- the reused lots are committed in it with `--no-verify` (their hook skipped, in the clone only), the
1161
- others with their hook. A real run (no `--rehearse`) runs every commit's hook, whatever the store holds.
1162
- The rehearsal clone (`▶ rehearsal clone`) warns naming the untracked files outside
1163
- `.gitignore` and `.git/info/exclude` a hook could read (they are not in the clone), and runs the lots in a scratch clone that looks like your tree - the repository at
1164
- HEAD, your working tree on top, the hooks folder, a copy-on-write copy of `node_modules` - so the hooks
1165
- run as they will for real. The clone sits in a rehearsal folder under a short root, `/tmp` on macOS
1166
- and Linux (the system's temporary folder on Windows):
1167
- `/tmp/dialecte-rehearse-<random>/<repository folder name>`, so a tool's socket under the hook's
1168
- temporary folder stays within the system's path limit; the hook runs with `TMPDIR` set to a folder
1169
- inside the rehearsal folder. Beside the clone, a link per relative `file:` / `link:` dependency of the
1170
- repository's package.json that leaves the repository, to the folder the same path reaches from the
1171
- repository (`file:../core`: `<rehearsal folder>/core` -> the repository's `../core`), so the clone
1172
- resolves it as the checkout does; one line names the links, and a path that leaves the rehearsal
1173
- folder too, or whose target is missing, is not linked (a line says why). In a workspace (the
1174
- repository's parent holds `.worktrees/`) the clone stays fresh but its `node_modules` is taken from the
1175
- pool when an entry matches its lockfile (`node_modules: pooled _pool-<repository>-<n>`), parked back at
1176
- the end, and the rehearsal folder goes to `.worktrees/_trash/`, removed in the background (removed here
1177
- when the trash is on another file system). Elsewhere the whole rehearsal folder is
1178
- removed at the end - its links unlinked, never what they reach - (`--keep` keeps it and names it:
1179
- `kept the rehearsal folder: <path>`), and on Ctrl-C or SIGTERM, with the hook and every process it
1180
- started stopped. The clone's git folder holds a marker naming the process that made it
1181
- (`dialecte-rehearsal.json`). A real run marks its hand-over folder with `running.json` (its pid and
1182
- start time) while it runs, removed at its end, on a failure, and on Ctrl-C, SIGTERM or SIGHUP received
1183
- while a commit (its hook) or an install runs; a run stopped at another moment leaves it, and a marker whose
1184
- process is gone counts as no run.
1185
- - A lot of `lots.json` can be a merge (git 2.38 or later, for its trial merge):
1186
- `{ "kind": "merge", "branch": "<branch or tag>", "tip": "<sha>", "resolved": { "<path>": "<file>" | null }, "message": "...", "tree": "<sha>" }`
1187
- (`null`: the merge removes the file). Merge lots are trial-merged in sequence: each on the tree the lots
1188
- before it leave - HEAD's, each earlier plain lot's files as they are in the working tree, each earlier
1189
- merge's trial tree with its resolutions - so a conflict that appears only on top of an earlier merge is
1190
- found at the write and needs a resolution, instead of stopping the run. The write refuses a branch that
1191
- is gone or moved since its tip was reviewed, a missing resolution file, a resolution holding conflict
1192
- markers, a conflict of the trial merge without a resolution or on a symlink or a submodule, and a file
1193
- the merge changes that has working-tree changes outside the resolutions (a file an earlier lot commits
1194
- aside). It records the conflicts, each resolution's hash and the tree the merge was trial-merged on
1195
- (`onTree`) in `merges.json`, under the review hash like `lots.json` (`--rehash` after a review). A resolution may
1196
- cover a file that merges cleanly (the lot changes it on top of the merge). Rehearse first:
1197
- `--rehearse` prints the merge's `tree <sha>` (a reused merge too), which goes into the lot as `tree`;
1198
- a real run requires it ("tree not recorded: rehearse first"). Before merging, the run refuses the lot
1199
- when HEAD's tree is not its `onTree` - an earlier lot committed other content (a hook staged files of
1200
- its own) - naming both trees, with nothing merged, and the next step (see what the lots before it
1201
- committed, then write the hand-over again from this HEAD for the lots left). A `merges.json` without
1202
- `onTree` (written by an earlier cli) is refused at the read: write the hand-over again, then
1203
- `--rehash` after a review. The run merges the recorded tip (`git merge --no-ff --no-commit`; a branch
1204
- moved since is a note) and refuses a merge in progress, leaving it - except one of the lot's own tip
1205
- that this cli started (its marker in the git folder) or with `--resume-merge`, aborted and redone. It
1206
- checks the conflicts against the recorded ones, copies the resolutions (hash-checked), refuses
1207
- conflict markers in the result, and checks the staged tree against the recorded one before the commit
1208
- (else the merge is aborted) and the commit's tree after it (a hook may stage files). A merge whose
1209
- hook refuses it is aborted, for a clean rerun. A rerun recognises a done merge by its subject, the
1210
- tip as its second parent and its tree. Before any commit whose staged `package-lock.json` differs
1211
- from HEAD's, `node_modules` are brought to it: the staged lock and `package.json` written over the
1212
- working copies (the working ones saved first in the git folder's `dialecte-install-backup`, put back
1213
- after the install, on an interrupt too; a backup a crash left is restored by the next run when the
1214
- files still hold the staged bytes, else refused naming it),
1215
- `npm ci --ignore-scripts --prefer-offline --no-audit --no-fund` (no install script runs: a `prepare`
1216
- or `postinstall` could change git config, hooks or any file; `npm ci` reinstalls every package, so
1217
- the note after the sync names each installed package of the staged lock that has one,
1218
- `install scripts not run: <names>`: each package once by its name, a nested copy too, five named then
1219
- `and <n> more`), the working copies put back byte for byte;
1220
- refused when the install changed the staged files or the versions still differ (dev, peer and optional
1221
- packages an install leaves out aside). A real run that leaves every lot committed then moves the worktree's `.dialecte/lot.json`
1222
- into the hand-over folder as `lot.json`, after the card is built, and leaves an empty declaration
1223
- (`{}`) in its place, saying so in one line (`lot file archived: <folder>/lot.json`): the next lot on
1224
- the branch does not inherit its entries. No lot file, an empty one, a rehearsal, a stopped run, or a
1225
- folder that holds a `lot.json` already (a second run) leave the lot file as it is.
1226
- - `dialecte handover show [<name|folder>] [--json]` prints a hand-over's card again, recomputed from its
1227
- folder (the lots file, the snapshot) and the records - the lots found committed from the lots file's HEAD
1228
- to the tip of its branch, `DONE` when every lot is - and writes nothing: not in the folder, the store,
1229
- the worktree or its index, nor a lock or a run marker. A word without a path separator that names an
1230
- entry of the store is that entry's folder; else a number (`0171`, or unpadded `171`) names the newest
1231
- entry of the worktree of that index (ranked by name as below, never by when it was written) - `run` and
1232
- `abandon` take it the same way; anything else is a path (relative to the current folder: `./0171` is a
1233
- folder), and
1234
- a registered folder given by its path still gets its name on the card. Without an argument: the newest
1235
- registered hand-over of the current branch (the latest date, then the highest counter, from the name),
1236
- whatever its state; none for the branch: the store's entries, one `name branch state` line each, exit
1237
- 1 (an empty or missing store says so, exit 1). While the folder exists its state is the folder's own
1238
- (abandoned, pending, partly committed, committed, stale); a folder removed is `gone`: listed, never run,
1239
- never shown as a card (exit 1, naming the missing folder). After the box, when a file of a lot not yet committed
1240
- (or `lots.json`) differs from what was reviewed, a deleted one included:
1241
- `<n> file(s) differ from the reviewed snapshot: re-gate, then dialecte handover <folder>/lots.json --rehash`;
1242
- then the run command on its own line, none once done or abandoned. Colour and width as the written
1243
- card. An unknown name, or a folder that is no hand-over: exit 2, naming it. `--json` answers the card
1244
- as data with its `folder` and `name`, as `dialecte handover --json` does, and `changedSinceReview` (the
1245
- count of that line).
1246
- - `dialecte handover review <name|index|folder> [--json] [--print]` opens the hand-over's worktree (the lots
1247
- file's `repository`) in one new editor window and returns at once: the editor is started detached, its output
1248
- ignored, never waited for. The hand-over is named as `show` names it. For a hand-over holding a merge lot it
1249
- first writes `<hand-over folder>/review/lot.diff`, the lot's own change against the lots file's `head` (what is
1250
- committed on top of it, staged, unstaged, and the untracked files git would add; ignored files left out; no
1251
- colour whatever the git config), read through a scratch index so the repository is left as it was, and opens it
1252
- in the same window. The editor: the worktree's `git config dialecte.editor` when set (its words, split as a
1253
- shell splits them, then the paths; no flag added), else the first editor of a fixed list the cli knows found as
1254
- an executable file on `PATH` (searched by the cli, no shell; opened with its new-window flag), else
1255
- `code --new-window`; `$EDITOR` and `$VISUAL` are never read. `--print` prints the command line it would run (each word that needs it shell-quoted, so
1256
- it runs as copied) and starts nothing; with `--json` too it prints that answer and starts nothing; `--json` answers `{ editor, command, opened }`. Exit 2: no
1257
- argument, an unknown hand-over, a worktree that is gone (naming it), or an editor that is no executable file
1258
- (`editor <word> not found: set git config dialecte.editor`), nothing started; with `--json` a refusal answers
1259
- `{ error }`, the message as written. Every READY card gets a `review`
1260
- section after the gates, `dialecte handover review <name> (opens <editor>)` (`review: { command, editor }` in
1261
- `--json`), read from `PATH` when the card is built; BLOCKED, DONE and ABANDONED cards have none.
1262
- - `dialecte handover run` without a folder runs the one registered hand-over still to run (its folder
1263
- pending or partly committed; `--rehearse` too): an abandoned, committed, stale or gone one is skipped.
1264
- Two or more: refused, nothing run and no run marker, one `name branch verdict` line each (`READY` or
1265
- `BLOCKED`, computed as `show` does), exit 2; none: says so, exit 1. `handover run <name>` runs that
1266
- registered hand-over (a gone one: exit 2, naming its folder). A hand-over in the folder of a `canceled` lot
1267
- is not run, however it is named (exit 2 before any guard, naming the lot, nothing written).
1268
- - `dialecte handover abandon [<name|folder>]` gives up a hand-over that will not run: it writes
1269
- `abandoned.json` (when) in its folder, records its entry `abandoned`, then removes the lock of its worktree when the lock names this
1270
- folder's `commit.sh` (a lock naming another hand-over is left, said in one line). Without an argument:
1271
- the hand-over the current worktree's lock names; no lock: says nothing is held, exit 1. Refused (exit 2,
1272
- nothing written) while a real run of it is in progress, and once every lot is committed; a partly
1273
- committed one may be abandoned, its commits stay. A lot folder is refused too (exit 2, nothing written):
1274
- `<full name> is a lot: its hand-over is redone with dialecte handover write --rehash --out <full name>; to
1275
- end the lot: dialecte lot stop <full name>`. It never touches the index, a ref or a commit. An
1276
- abandoned hand-over is `abandoned` in `list` and `show`'s listing, `ABANDONED` on its card (no run
1277
- command); `run` without a folder skips it, `run <it>` refuses (exit 2, naming the marker); abandoning it
1278
- again says it already is (exit 0), and `dialecte handover <lots.json> --rehash` of its folder is refused
1279
- (exit 2, nothing written, naming `abandoned.json`): write a new hand-over into a new folder instead. A run
1280
- and an abandon started at the same moment never both go on: each reads the other's marker again after
1281
- writing its own, and one that finds it refuses (exit 2), nothing committed or abandoned.
1282
- - `dialecte handover list [--root <dir>] [--json]` lists every hand-over folder under the workspace's
1283
- `_commit-plan/` (or the folder given, or the current one): repository, worktree, branch, lots, age, and
1284
- its state - pending, partly committed, committed, abandoned, or stale when something else moved the branch. A
1285
- folder holding a hand-written `commit*.sh` and no lots file shows as "legacy script, state unknown".
1286
- - `dialecte worktree add <repository> <branch> [--from <ref>] [--json]` makes a worktree under the
1287
- workspace's `.worktrees/<index>-<repository>-<branch tail>` (the last segment of the branch:
1288
- `0171-core-depth` for `feat/depth`; a new branch starts from `--from`, else the base
1289
- branch; a `<repository>` that is no folder, or a folder in no git repository, is refused in one line, exit
1290
- 2): it copies the hooks folder `core.hooksPath` names (husky's `.husky/_` is ignored by git, so a
1291
- plain worktree misses it), takes a `node_modules` from the workspace's pool when one matches (below), else
1292
- copies the main checkout's `node_modules` copy-on-write where the file system
1293
- can (links kept, a relative link to a sibling re-pointed so it still reaches it) - from the worktree that
1294
- has the `--from` branch checked out when it has one, else from the main checkout - lists `.dialecte/`
1295
- once in the exclude file of the repository's common git folder (so for the main checkout and every
1296
- worktree of it), and writes the hygiene baseline `gate --fast` compares with; it prints a card.
1297
- The index is 4 digits at least (`0001`, past `9999` it grows), one counter per workspace so the latest
1298
- worktree sorts last: 1 + the highest of the claims in `.worktrees/.index/` (one empty file per index ever
1299
- taken) and the numbered folders and links of `.worktrees/`. A claim is created only where none exists,
1300
- so two runs at the same moment, of any repositories, never take the same index (the other takes the
1301
- next), and a number stays taken after its worktree is removed. Unnumbered folders and the sibling links
1302
- (`.worktrees/core`) count for nothing and are never renamed. `--json` carries `index`.
1303
- The pool: a finished checkout's `node_modules` waits in `.worktrees/_pool-<repository>-<n>/node_modules`,
1304
- with a `pool.json` beside it (`{ repository, lockHash, parkedAt }`, `lockHash` the sha256 of the
1305
- `package-lock.json` it was checked against), at most two entries per repository (parking a third sends
1306
- the oldest to the trash). A park (`lot close`, the end of a rehearsal) takes only a `node_modules` that
1307
- matches its `package-lock.json` (as `worktree add` reads it), rewrites absolute, in place, every link inside
1308
- it whose relative target leaves its checkout (a sibling repository; a link into the checkout itself, an npm
1309
- workspace package, stays relative and reaches the taker's own package), renames the folder into a new entry (no file is copied),
1310
- sends `node_modules/.vite` and `node_modules/.cache` to the trash (or leaves them in the folder already
1311
- going there), then writes `pool.json`; a `_pool-*` folder without one is a park that never finished,
1312
- never taken, and `worktree prune` names it as left over. `worktree add` takes the newest entry of the
1313
- repository whose `lockHash` is the new worktree's `package-lock.json` hash (a rename: two takers never
1314
- share one, the second goes on to the next entry), then reads it against the lockfile as it reads a copy.
1315
- No match, an empty pool or a rename across file systems: the copy. The card's `node_modules` row says
1316
- which and how long (`pooled _pool-cli-1 0.1 s`, `copy-on-write 46.2 s`); `--json` carries
1317
- `nodeModules: { method, from?, seconds }`. The trash: `.worktrees/_trash/` - a worktree goes there by
1318
- `git worktree move` (git keeps it registered) then a background `git worktree remove --force`, a folder
1319
- by a rename then a background `rm -rf` of that one path; nobody waits for either. A folder left there (a
1320
- sleep, a crash) stays for you to look at. The pool and the trash are used only where the repository's
1321
- parent holds `.worktrees/`.
1322
- Before the copy it makes the links the worktree's `file:` and `link:` dependencies need (`dependencies`,
1323
- `devDependencies`, `optionalDependencies`, `peerDependencies`): a relative path that leaves the worktree
1324
- into the workspace's `.worktrees/` (`file:../core` from `.worktrees/cli-x` reaches `.worktrees/core`)
1325
- gets a relative link there to the folder the same path reaches from the main checkout
1326
- (`.worktrees/core -> ../core`). Each dependency gets one outcome, in the card's `links` row and the
1327
- JSON's `siblingLinks` (`dependency`, `link`, `target`, `outcome`): `created`; `present` (a link that
1328
- already reaches it: a second worktree changes nothing); `skipped: <target> missing`;
1329
- `skipped: <folder> missing` for a path into a sibling whose own folder is not under `.worktrees/` yet
1330
- (`file:../core/sub/pkg` without `.worktrees/core`); `skipped: outside .worktrees/`;
1331
- `skipped: cannot make the link (<code>)` when the file system refuses it (`EACCES`, ...);
1332
- `kept: points to <its text>, not <target>` or `kept: a real folder` (or file): what is there is never
1333
- replaced. A path inside the repository needs no link and is not listed. After the copy it reads
1334
- `node_modules` against the worktree's `package-lock.json` (its `packages` map, lockfileVersion 2 or 3,
1335
- nested packages included, bundled ones left out): each package installed at its locked version
1336
- (`missing`, `<installed> installed, lock <locked>`, `package.json unreadable`), each link reaching what
1337
- the lockfile resolves it to (`link to <path> missing`, `… points elsewhere`). A package npm may leave
1338
- out of this machine's install is not missing when absent: `optional`, or an `os` / `cpu` list this
1339
- platform does not match (`!x` excluding x); a `devOptional` one is, since a development install puts it
1340
- in. The card's `lockfile` row says
1341
- `✓ node_modules matches package-lock.json (<n> packages)`, or the count of packages that differ with the
1342
- first five, and a `next` row holds the command that puts it right, `cd '<worktree>' && npm ci`. Without
1343
- a lockfile it says `no package-lock.json: not checked`; a lockfile that is not JSON, or has no `packages`
1344
- map (lockfileVersion 1), is not checked either (`package-lock.json unreadable: not checked`,
1345
- `package-lock.json has no packages map: not checked`). The JSON carries it as `nodeModulesCheck`
1346
- (`lockfile`, `notChecked`, `problems`: `package`, `problem`; `command` when there are problems). The
1347
- exit code stays 0 whatever the links and the lockfile say: the worktree exists, and its card says what
1348
- to run.
1349
- - `dialecte lot start <brief.json> [--effort low|medium|high] [--dry-run] [--simulate <scenario>] [--json]` starts a lot from its brief
1350
- (`schema`, `feature`, `repository`, `branch`, `base`, `goal`, `plan`, `scope`, `steps`, `lots`, `effort`).
1351
- Every check runs first and every refusal is printed at once (`<field>: <rule> - <detail>`, `{ refused }` with
1352
- `--json`, exit 2), before anything is created: the fields, the repository's main checkout, a new valid branch,
1353
- a base that resolves to a commit, the plan and each step's heading in it, the scope and the lots covering it
1354
- (a lot path is inside a scope entry by path segments: `lib/x` is inside `lib/`, `lib-other/x` and `libx` are
1355
- not; an entry whose glob cuts a name, `src/data*`, compares by string prefix), no
1356
- overlap with an open lot of the same store. Then it claims the next worktree index, publishes the lot folder
1357
- `<git common folder>/dialecte-lots/<index>-<repository>-<branch tail>/` (the brief, a copy of the plan, the
1358
- first transition, `identity.json` last; every record written once, read-only), makes the numbered worktree at
1359
- the recorded base commit and its `.dialecte/lot` link to the lot folder. The store is appended to the user's
1360
- store list (`$XDG_STATE_HOME/dialecte/lot-stores`, else `~/.local/state/dialecte/lot-stores`), refused when
1361
- that list sits inside a git work tree. `--dry-run` runs the checks (the store-list refusal included, no
1362
- hard-link probe), names the lot and the start to run next (`next: dialecte lot start <brief path as given>`),
1363
- writing and claiming nothing. A worktree that cannot be made leaves the lot
1364
- `failed` (exit 1), nothing removed, with `next: dialecte lot stop <full name> --reason <text>`; a link that
1365
- cannot be made leaves the lot working (exit 0, a `note:` line, `notes` in JSON; `lot status` reports the link
1366
- missing). Every `--json` exit is JSON: `{ lot, folder, worktree, runner, notes, next }` started,
1367
- `{ dryRun: true, lot, worktree, next }` dry run, `{ lot, folder, state, reason, next }` failed,
1368
- `{ refused, next: null }` a refused brief, `{ error, usage, next: null }` a usage error (exit 2),
1369
- `{ error, next: null }` any other exit before a lot exists.
1370
- - `dialecte lot status <id> [--json]` derives the lot's state from its records (`working`, `input-required`,
1371
- `ready`, `committed`, `canceled`, `failed`), with the worktree and link checks and the exact next command (the
1372
- text form adds an `also:` line when there is one, five lines at most); it
1373
- reads files only, runs no git and writes nothing. A real working lot's next station is walked from its
1374
- records (`nextStation`: per step test-writer, `tdd red`, test-reviewer at medium or high effort,
1375
- implementer, `tdd green` and `gate --fast`; per review round its snapshot, reviewer, fixer or adjudicator
1376
- and `gate --fast`; then `gate --full` after the last edit station, `contrib` for a producer, the
1377
- independent review, the hand-over to write; the first unmet one wins): the text form prints it after the
1378
- state line, `station implementer step 2 of 3 · round -/2 · effort medium` (`<what>` may be `reviewer
1379
- round 1`, `tdd green and gate --fast (implementer step 2 ended, claim unchecked)`, `implementer running
1380
- since <at> (run <run>)`, `lot snapshot round 2`, `question to the person (round cap 2 reached)`, `handover write (no
1381
- hand-over written)`, `unknown (<why>)`), the position line given up first, and `next` is that station's
1382
- command (`dialecte lot station <name> start implementer --step 2`, `... end <station> --run <run>`, the
1383
- check's command, `dialecte lot snapshot <name> --round <r>`, at the cap its `--beyond-cap` form), `also`
1384
- keeping the manual line; a hand-over to write and an unknown position keep the manual line. A station
1385
- is ended by an end with exit 0 or none and a verdict other than `failed` or `limit`; a start with no end
1386
- is running until a later station start or end or a snapshot comes (a check never closes it: the
1387
- station's own `tdd red`, `tdd green` and `gate --fast` run inside it), `no end` after; an end that names
1388
- its run and gives no `--step`/`--round` takes its start's; an end of another name, or one with no start
1389
- that places it, is `unplaced`. A claim is checked by a later `step.end` of its kind with exit 0 in
1390
- the lot's own worktree (never `throwaway`, no later failed run of the kind, no newer failed gate
1391
- record), or by one inside the station's run whose `stateHash` is the one its end recorded (the tree it
1392
- handed over); when the events say the worktree's cli writes no step events, its tdd ledger and green gate
1393
- records after the end stand in (a later green record of a gate mode covers every earlier claim of that
1394
- mode), else `unknown (the worktree's cli records no steps)`. A reviewer or test-reviewer end approves only
1395
- with `approve`: none or another word reads `unknown (<station> ended without a verdict)` or `unknown
1396
- (<station> ended with <word>)`. `--json` adds `station` (`{ kind, station, check, step, round, why,
1397
- unplaced, noEnd }`, `null` for a simulated lot) and `rounds` (`{ review, cap, effort, steps, beyondCap:
1398
- [{ round, by, reason }], independent }`, `effort` the level the cap is taken from or `null`, `steps` the
1399
- brief's count; the text form prints from them). Other states, a
1400
- simulated lot and `lot start` keep their next. A damaged lot (a folder of the store whose name has a lot
1401
- name's shape and whose records do not hold: no readable `identity.json`, one naming another folder, or a record
1402
- that fails its check) answers `<name> damaged: <reason>` then `next: dialecte lot stop <name> --reason <text>`
1403
- (`{ lot, state: "damaged", reason, next }` with `--json`), exit 6, never `no lot`; the reason is a fixed word
1404
- of the cli, never a field of the record, and a lot with an unreadable identity is named by its folder. Exit 0 for a lot found, 2 for an unknown or ambiguous id
1405
- (`{ error, next: null }` with `--json`) or a usage error (`{ error, usage, next: null }`). An
1406
- `<id>` is an index (`171` = `0171`), a full name, a lot folder or `.dialecte/lot`; a word naming an existing
1407
- folder is that folder; a damaged lot is named by its id (index or full name), a path to it does not find it. The review rounds' verbs take `<id|folder>` the same way (a write needs an index
1408
- unique across every store of the list), and a lot folder is accepted as their hand-over folder although it
1409
- sits in the git folder. Two workspaces of the store list may give the same full name (the same index,
1410
- repository folder name and branch tail): that name is then ambiguous (exit 2 listing both); give the lot
1411
- folder instead.
1412
- - The host loop: `lot start -> lot wait -> (lot answer -> lot wait)* -> lot result`. Every output names the exact
1413
- next command with the lot's full name, and the exit code says what the host does next (section below). Every
1414
- answer of `status`, `wait`, `answer`, `result` and `stop` goes to standard output, whatever its exit code; only
1415
- a usage error or a refusal (exit 2), and an answer hook that threw (exit 1 of `answer`), go to standard error.
1416
- `inbox` follows the same rule (its exit 1, nothing waits, is an answer). `lot start` stays outside it: a
1417
- refused start (exit 2) or a failed one (exit 1, the lot `failed`) is an error on standard error, naming the lot
1418
- and its next command. The answer line of a caller's question carries no `--by` (it defaults to `caller`); a person's names
1419
- `--by <who>`.
1420
- - `dialecte lot wait <id> [--timeout <seconds>] [--json]` returns the status as soon as the lot needs someone:
1421
- exit 0 `ready` or `committed`, 1 `failed` or `canceled`, 3 `input-required` (at once, every time, costing
1422
- nothing), 4 when the last transition is a limit (run again), 5 when `--timeout` is reached while the lot still
1423
- works. A real lot is looked at every second, by a stat of its folders and of the registry, and read again only
1424
- when one changed, nothing written; on a terminal a `waiting <name> (<state>,
1425
- <elapsed>)` line refreshes (never under `--json`). A simulated lot is played up to its next blocking point; one
1426
- with nothing left to play (no `scenario.json`, or every step played) never waits: it answers its state at once,
1427
- as `lot result` does (a working lot: exit 5), whatever `--timeout`. A damaged lot answers at once with exit 6,
1428
- as `lot status` prints it.
1429
- - `dialecte lot answer <id> <question> "<answer>" [--by <who>] [--json]` records the answer to an open question
1430
- once, then prints the status with `next: dialecte lot wait <name>`. The answer is one line; a question with
1431
- options takes one of them (compared trimmed, case-folded, recorded as the option is written); the same answer
1432
- again is `already`, another one is refused. A person's question needs `--by <who>` (not `caller`); a caller's
1433
- defaults to `caller`. `--by` is one line, not empty, checked before the lot is read (exit 2 naming `--by`).
1434
- A refusal's text form escapes the options, answer and `--by` it quotes (a line feed in them prints as
1435
- `\u{a}`, the refusal stays one line); `--json` carries them as stored. A damaged lot takes no answer (exit 2,
1436
- naming the lot, its damage and the stop to run; nothing written).
1437
- - `dialecte lot result <id> [--json]` never blocks and writes nothing. A `ready` or `committed` lot exits 0 with
1438
- `{ lot, state, handover: { name, folder, state, card, show, run }, worktree, branch, questions, simulated }`:
1439
- the card is the one `handover show --json` computes, `handover.state` the hand-over's own state read from git
1440
- (`committed` once its lots are committed, even before the registry says so), `questions` the answered ones
1441
- (`{ id, text, answer, by }`); a simulated lot's `handover` is `{ simulated: true }`, nothing to show or run.
1442
- `failed` and `canceled` exit 1 with `{ state, reason, at, position }` of the last transition, `input-required`
1443
- exits 3 with the open questions, `working` exits 5, a damaged lot exits 6 (as `lot status` prints it). The text
1444
- form prints agent text escaped.
1445
- - `dialecte lot stop <id> --reason <text> [--by <who>] [--json]` ends a lot. A `committed` lot is refused
1446
- (exit 2). A pending hand-over is abandoned first, as `handover abandon` does (`abandoned.json`, the registry
1447
- entry `abandoned`, the lock released when it names that hand-over); while its run is in progress, or once it is
1448
- committed, the stop is refused (exit 2) and publishes nothing. Then a `canceled` transition (cause `stop`, the
1449
- reason, `--by` or `caller`), and the registry is read once more: a hand-over registered meanwhile is abandoned
1450
- at once. A lot already `canceled` exits 0 writing nothing; one whose entry is still `pending` (a crash inside an
1451
- earlier stop) is repaired. It moves no worktree and deletes nothing; `lot close` and `worktree prune` let the
1452
- worktree go once the lot is canceled. The reason and `--by` are one line, not empty (exit 2). A damaged lot is
1453
- stopped by moving its folder aside, never deleted and nothing written into its broken records first: to
1454
- `<git common folder>/dialecte-lots-aside/<name>` (`-2`, `-3`, ... appended when the name is taken, an empty
1455
- folder included), with a `stopped.json` (`reason`, `by`, `at`, `damage`) inside the moved folder (a lot folder
1456
- that is a symbolic link: the link is moved, never its target, and the record is `<aside name>.stopped.json`
1457
- beside it). It prints `stopped <name>: damaged (<reason>); its folder is now <path>` (`{ lot, state:
1458
- "moved-aside", damage, folder }` with `--json`). Its index stays claimed, its worktree and branch stay; refused
1459
- (exit 2, nothing moved) while a live run marker holds the folder or a pending registry entry names it (first:
1460
- `handover abandon <entry>`); a stop that finds the folder gone (another
1461
- stop moved it) says `no lot <id>`. Until it is moved aside, a damaged lot holds its paths: the scope of its
1462
- `brief.json` when that reads as a list of texts, else every path, so `lot start` refuses an overlap with it
1463
- (`overlap with <name> (damaged: <reason>): ...`, or `its scope cannot be read: it holds every path`); one whose
1464
- identity reads simulated holds none.
1465
- - `dialecte lot start --simulate <scenario>` starts a simulated lot that plays one of the scenarios (`ready`,
1466
- `question`, `person`, `two-questions`, `limit`, `failure`, `slow`) under `lot wait`, publishing the records a
1467
- real run would: it writes only its lot folder, one line of the store list and one index claim, never a branch,
1468
- a worktree or a registry entry, and never blocks a real lot. A host proves its loop on it before a real run.
1469
- With `--dry-run` it is the dry run of that simulated start: exit 0, the findings a real start would refuse for
1470
- listed (`wouldRefuse` in JSON, `worktree: null`), no worktree named, and `next` the same start with
1471
- `--simulate <scenario>`; nothing claimed or written.
1472
- - `dialecte inbox [--repository <name>] [--simulated] [--json]` lists what waits on someone across every store of
1473
- the store list and the store of the current folder: one line per open question (person questions first, then
1474
- caller questions), then the ready lots, then the failed ones, by index within a group, each line
1475
- `<index> <repository> <branch> <what> <next command>`, where `<what>` is `question q<k> (person|caller)
1476
- <question text>`, `READY` or `FAILED <reason>` and the next command is the lot's own (the answer line of that
1477
- question, `handover show`, `lot result` or `lot stop`); then `working <n> · simulated <m> (listed with
1478
- --simulated)`. `--repository` keeps the lots whose repository folder has that name, `--simulated` lists the
1479
- simulated lots that wait. A lot folder whose `identity.json` does not read, or whose records do not hold, is a
1480
- `damaged <folder>: <reason>; next: dialecte lot stop <name> --reason <text>` line (a `.tmp-` folder being built,
1481
- or a folder whose name has no lot name's shape, is no lot). The records are checked once, on read: a question id is `q<k>` (k 1 or
1482
- more), an audience `caller` or `person`, a position's step, of and round non-negative integers, a transition's
1483
- `at` a time, an answer file's question its file's `q<k>`. Every lot verb names such a lot damaged (exit 6 for
1484
- `status`, `wait`, `result`; `answer` refuses, exit 2), so no forged field reaches a line or a `next`. It reads files only (each registry once per store), runs no process, writes nothing. `--json`:
1485
- `{ waiting: [<status of each waiting lot>], working, simulated, damaged }`. Exit 0 when something waits or is
1486
- damaged, 1 when nothing does, 2 for a usage error.
1487
- - `dialecte plan next <plan.md> [--json] [--all]` reads a plan's lot block (one fenced block with the info string
1488
- `json dialecte-lots` in the plan, or `<plan without .md>.lots.json` beside it; both or neither is refused) and proposes what can
1489
- start now; it starts, claims and writes nothing. Each entry declares an `id`, a `kind` (`lot`, `fix`, `spec`,
1490
- `person`), `dependsOn`, a `scope` per repository (`"."` is the whole repository), extra `heavy` steps
1491
- (`mutation`, `browser`, `release`), a `brief`, and a `match` (`branch`, `handover`, `feature`) by which its
1492
- records are found; the block's `shared` files (the changelog, the README, the command map) never hold a lot back.
1493
- An entry's state is read, never declared: done by a committed hand-over or store lot, open by a store lot, a
1494
- pending hand-over or a worktree on its branch, else ready, waiting, parked, or unknown with the reason when its
1495
- repository cannot be read (files only: the stores, the registries, `worktrees/*/HEAD`; no git process, except
1496
- one probe per lot whose hand-over was committed outside its folder and not closed yet: once its branch is past
1497
- the lot's base commit and on the base branch that lot reads `committed`, is no longer open nor holds anything,
1498
- and is listed under `landed` as `lot <full name> committed: hand-over committed in <folder>, branch on
1499
- <target>`; once `lot close` closes that hand-over every reader reads it `committed`, files only, with no
1500
- `landed` line; a lot with a live run or a transition later than that hand-over reads from its own records). The
1501
- text says the counts, the open lots (and open work no entry accounts for: its repository's proposals are
1502
- `unverified`), the lots that can start in critical-path order (`unblocks 7 (chain 4)`, `after <id>`, `merge:
1503
- <open lots>`, `next: dialecte lot start <brief>` or the brief to write), the ready lots held by an open one with
1504
- each scope pair met, person entries without a mark, the spec work (a spec missing or `DRAFT`), what each entry
1505
- waits for, the parked ones, then the machine: the live heavy steps with their worktree and age, the load against
1506
- twice the cores, the free and inactive memory against 2 GB (`vm_stat` on macOS, `/proc/meminfo` on Linux); a
1507
- proposal whose heavy steps would run beside a live one says `stacks:`, and on a short machine its heavy steps
1508
- would wait (advice only). `--all` lists the done entries; `--json` answers `{ plan, repositories, counts,
1509
- entries, proposals, held, landed, specWork, heavy, unknown }`, `landed` always a list (`[{ repository, lot,
1510
- folder, target }]`, `[]` when none). Exit 0 when a lot or fix can start, 1 when none can, 2
1511
- for a usage error, no block or an invalid one (every fault listed), or a repository that is not a git checkout.
1512
- `dialecte plan check <plan.md> [--json]` checks the block alone: one line when valid, else every fault (exit
1513
- 2). `dialecte plan mark <plan.md> <id> done --by <who> [--reason <text>]` records a person entry's mark once in
1514
- the machine's state folder (`<state>/dialecte/plans/`); a `lot` entry's state comes from its records and is
1515
- refused.
1516
- - `.dialecte/lot` reaches the lot folder, whose `round-<n>/` snapshots hold copies of the lot's files, tests
1517
- included. Leave `.dialecte/` out of every tool that walks the worktree: a test runner whose globs include dot
1518
- folders, a formatter, a linter. Git already leaves it out (`worktree add` excludes it).
1519
- - `dialecte lot exempt <reason>`, `lot accept <case> <reason>`, `lot revised <case|file|glob> <reason>`,
1520
- `lot gone <file|glob> <reason>` write the lot declaration `.dialecte/lot.json` at the package root (the
1521
- nearest package.json above the current folder) as tab-indented JSON, keeping what it holds; the same
1522
- case (or file) again replaces its reason. `accept` needs a case `<file>::<name>`; `gone` refuses one
1523
- (it writes `"gone": [{ "file": "<file or glob>", "reason": "..." }]`).
1524
- - `dialecte lot mutation <off|changed|audit|gate>` writes the lot's mutation switch (`"mutation"`, no
1525
- reason). Without it, `dialecte mutants run` mutates the changed lines when the lot's diff touches the
1526
- declared scope and nothing otherwise; `audit` mutates the whole scope; `gate` runs as `changed`.
1527
- - `dialecte lot standard <id|folder> consulted <note> | not-consulted <reason>` writes `<folder>/standard.json`
1528
- (`{ state, note, at }`, the note's words joined by single spaces) for the card's `standard` line; the line
1529
- references of what was read stay in the findings ledger. Another state, or no note, is a usage error
1530
- (exit 2); a folder inside a repository is refused as below.
1531
- - `dialecte lot finding`, `decide`, `snapshot`, `choice`, `delta` and `verify` keep a lot's review rounds in its
1532
- lot folder, or in a hand-over folder (`_commit-plan/<topic>-<date>/`) that stays outside every repository:
1533
- each refuses any other folder inside a git work tree or a git folder (`.git/`, a bare repository). `--` ends the options: the
1534
- words after it are taken as they are, so a finding or a reason may start with `--`. Each writes its file
1535
- whole (a temporary file renamed over it), so a reader never sees half a ledger.
1536
- - `lot finding <id|folder> --round <n> --severity <blocking|should-fix|nit> --at <file:line> <finding>`
1537
- appends the row `| R<n>-<k> | <n> | <severity> | <file:line> | <finding> | open |` to
1538
- `<folder>/findings-ledger.md` (the folder, the file and its table made when absent; k one past the
1539
- highest of the round). A `|` is written `\|`; a line break is refused. A hand-written ledger keeps
1540
- every other byte.
1541
- - `lot decide <id|folder> <finding> <state>` rewrites that row's state cell: `open`, `fix-to-verify`,
1542
- `fixed <round> [note]` (a round after the one that raised it), `accepted <reason>`, `logged <where>`.
1543
- An id not in the ledger is refused, naming the ids it holds.
1544
- - `lot choice <id|folder> --by <who> <decision>` appends `| <decision> | <who> | <yyyy-mm-dd> |` to
1545
- `<folder>/decisions.md` (made with its title and table when absent): a decision made outside the
1546
- findings ledger, the user's above all. A `|` is written `\|`; an empty `--by`, a line break, or more
1547
- than one decision word (quote it) is refused.
1548
- - `lot snapshot <id|folder> --round <n>` copies every file `git status --porcelain -z
1549
- --untracked-files=all` lists at the worktree root (the old path of a rename included) to
1550
- `round-<n>/` at its repository-relative path - bytes, mode, a symlink as a symlink; a path gone from
1551
- disk (or now a folder) that HEAD holds goes in `round-<n>.deleted`, NUL-separated, sorted; HEAD in
1552
- `round-<n>.base`. An existing round, an untracked nested repository and a submodule (a gitlink in the
1553
- index or at HEAD) are refused; a run that
1554
- stops part-way leaves only `.partial` names, which the next run removes. `.dialecte/lot.json` is
1555
- never part of it. `round-<n>.state` (`{ "schema": 1, "at", "stateHash" }`, the worktree's state hash)
1556
- is written and renamed with the others. A round above the cap of the lot's effort (low 1, medium 2,
1557
- high 3; the identity's effort, else the folder's `brief.json`, else none recorded and a cap of 1; an
1558
- interim read until the risk class lands) is refused, exit 2, naming `dialecte lot snapshot <folder>
1559
- --round <n> --beyond-cap --by <who> --reason <text>`. With them the row `| round <n> beyond the cap of
1560
- <cap>: <reason> | <who> | <day> |` goes to `decisions.md` first, then the snapshot (a retry finds the
1561
- row of that round and adds none; once it stands, the plain `--round <n>` takes the round too). `--beyond-cap` within the cap, `--by` or `--reason` without it or
1562
- blank, and a `--by` or `--reason` holding a forbidden word (`lot snapshot: --by holds a forbidden word:
1563
- nothing written`, the word never printed) are refused, exit 2, nothing written; an existing round
1564
- stays exit 1.
1565
- - `lot verify <id|folder> --by <who> --note <text>`, run inside the lot's worktree, appends `{ schema: 1,
1566
- at, by, note, state }` to `<folder>/verify.jsonl` in one write, `state` the worktree's state hash: the
1567
- late fixes of that tree verified (the card's `late fixes` line, the `verify` guard). One later change
1568
- needs a new verify. Exit 0 recorded; 2 for `--by` or `--note` missing, blank or not one line, a
1569
- forbidden word in either, a run in another work tree than the lot identity's worktree (both named), or
1570
- no snapshot yet (nothing is late), nothing written; 1 outside a git work tree, or a line over the event
1571
- line limit.
1572
- - `lot delta <id|folder> --round <n> [--worktree] [--json]` (n ≥ 2) prints, for each file of
1573
- `round-<n-1>/`, of `round-<n-1>.deleted` or of the worktree's status, what changed since round n-1,
1574
- in the form that fits where the file is: the snapshot copy against the worktree file (or
1575
- `/dev/null` when it is gone), `/dev/null` against a file deleted then and back now or new and absent
1576
- from the base, `git diff HEAD` for a file round n-1 had at the base. Files unchanged since round n-1
1577
- are left out; colour, external diff and textconv settings never apply. It refuses when HEAD moved
1578
- 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
1579
- `<lot branch>-round-<n-1>` from the lot's branch tip, in `.worktrees/<index>-<repository>-<branch
1580
- tail>-round-<n-1>` with the lot's own index when its worktree is numbered (no new claim; else the
1581
- workspace's next): the deletions applied with `git rm
1582
- --pathspec-from-file`, then `round-<n-1>/` copied over, so a new test can run on the old code; it
1583
- prints its path and the removal command with its absolute `cd`. The lot's worktree is never
1584
- changed. Its `node_modules` comes from the pool, or a copy, as for `worktree add`.
1585
- - `lot close <hand-over name|index>... [--json]` closes finished lots: for each hand-over of the registry
1586
- named (by its name or its worktree's index) whose state is `committed` or `abandoned`, its worktree (the
1587
- path the registry entry holds) is closed: every decision first, for every argument with every rule, its
1588
- own state and branch included (one worktree reached by several names or indexes closes only when every
1589
- one of them may close, and then once, the other arguments answered "the same worktree as ..."; when one
1590
- keeps it, every one of them is kept, each line with the reason), its
1591
- `node_modules` read against the lockfile where it is; then the links of its `node_modules`
1592
- made absolute where they are, the worktree moved to the trash (`.worktrees/_trash/`, by
1593
- `git worktree move`), its `node_modules` parked in the pool (`.worktrees/_pool-<repository>-<n>`) from
1594
- there, its caches (`.vite`, `.cache`) sent to their own `_trash/` entries, and last the trashed worktree
1595
- removed in the background by `git worktree remove` without `--force`: git refuses a worktree written into
1596
- since the check, which then stays registered in `.worktrees/_trash/` for you to look at (one line says so
1597
- when something closed). Paths are compared by their real path as spelled on disk (a path typed in another
1598
- case on a case-insensitive volume matches). Before the move, the lot's final record is kept: the card line
1599
- of its `cards.log` (the one `handover run` wrote when it committed; else a recomputed one, marked
1600
- `recomputed`, built without the probe), read back and parsed, then a `removing` line naming the worktree,
1601
- its branch and the branch tip; after the move a `removed` line says `trashed` or `kept`. Kept also, with
1602
- why: `final record not kept: <reason>` when the record cannot be written or read back, and `the lot's
1603
- commit is not known` (with where to look and how to remove the worktree by hand) when a committed lot's
1604
- commit can be found neither among its lot commits nor in the worktree's hook record (read only when no
1605
- other committed hand-over shares the worktree). Every other hand-over of the worktree gets its card line
1606
- too, `head` its last lot commit or `null`. Kept,
1607
- with why and nothing done for that hand-over: first, a worktree a lot of the repository's store names
1608
- (by real path) while the lot is not `committed` nor `canceled`, reason `lot <full name> <state>` (the
1609
- store read once, no git process per lot but the one probe below). A lot whose hand-over was committed
1610
- outside its own folder (no registry entry for the lot folder, every entry naming its worktree and branch
1611
- `committed`) reads `committed` once its branch is past the lot's base commit (the base an ancestor of the
1612
- tip, the tip not the base) and on the base branch. Such a lot keeps nothing, and every outcome of its
1613
- worktree carries the line `lot <full name> committed: hand-over committed in <folder>, branch on <target>`
1614
- (under the outcome's line, indented; `landed` in `--json`); the other keep rules below still apply to it.
1615
- Once `lot close` has closed that hand-over, every reader (`lot status`, `lot wait`, the overlap at `lot
1616
- start`, `worktree prune`, `plan next` among them) reads the lot `committed`, files only and without the
1617
- probe, so a branch deleted afterwards never reopens it. A lot with a live run, or a transition later than
1618
- that hand-over (resumed after it), reads from its own records, never landed nor closed by it. A hand-over
1619
- still `pending`; its worktree is the main
1620
- checkout (never parked, moved or trashed); no registered worktree at that path (closed already, or one
1621
- in the trash or the pool: never a target again); a worktree on another branch than the hand-over's
1622
- (both branches named: it holds other work now); a `locked` worktree (`git worktree lock`); another
1623
- hand-over registered for the same worktree that is neither `committed` nor `abandoned` (named); a mutation
1624
- run started from it that still runs or died before reporting; `lot close` itself run from inside it
1625
- (run it from another folder); a process whose working folder is in it;
1626
- the processes not known (`lsof` failed or took longer than 20 s); a link from outside the worktree
1627
- pointing into it (`the link <path> points to it`: the links directly in the workspace, `.worktrees/`,
1628
- `_commit-plan/` and the scratch roots, and those in `node_modules/` and `node_modules/@*/` of every
1629
- worktree and main checkout of the workspace's repositories, read once per call; the worktree's own links
1630
- never count); a `dirty` worktree (anything
1631
- `git status --porcelain --untracked-files=normal` lists, untracked files included whatever
1632
- `status.showUntrackedFiles` says); a HEAD reflog reaching commits that neither the hand-over's branch, the
1633
- base branch nor a remote-tracking ref holds (a commit made on a detached HEAD: the reflog goes with the
1634
- worktree); ignored files its removal would delete that nothing else holds (`ignored files git worktree
1635
- remove would delete: .env`, the first three named past three): rebuilt folders (`node_modules/`, `dist/`,
1636
- the VitePress caches, the hooks folder, the `dialecte.rebuiltIgnored` folders), `.DS_Store`, the
1637
- `.dialecte/lot` link, a `.dialecte/lot.json` that is empty or byte-equal to the one archived by a
1638
- committed hand-over of this worktree, and files byte-equal, mode included, to the same path in the main
1639
- checkout go; anything else keeps it, `.dialecte/notes.md` included. The branch is never touched (`worktree prune` still lists the merged
1640
- ones). Each line names the folder it moved and where `node_modules` went (`closed <name>: 0007-cli-x;
1641
- node_modules pooled in _pool-cli-1`, or `trashed: <why it was not parked>`); a failure part-way keeps
1642
- that hand-over with the error and what was already moved, the others go on. A hand-over it closes gets
1643
- `closed` (the time) on its registry entry; closing it again prints `<name> already closed`, nothing
1644
- decided nor moved (an entry without it, a worktree removed by hand, is still kept: `nothing to close`).
1645
- Exit 0 when every named hand-over closed (or was already closed), 1 when one was kept, 2 for a name or
1646
- index the registry does not hold (then nothing is closed); `--json` prints
1647
- `[{ handover, closed: true, already?: true, landed? } | { handover, kept, landed? }]`.
1648
- - Recording a lot. Every record below is appended to a file, never rewritten; a reader skips a half line and a line
1649
- it cannot parse, and counts them.
1650
- - `dialecte lot station <id> start <station> [flags]` and `lot station <id> end <station> [--run <run>] [flags]`
1651
- append one station event to the lot's `events.jsonl` (`by: host`): the host says which station ran, with
1652
- which step, round, attempt, agent, vendor, model, tier, effort, session and skills (`--skill` seen,
1653
- `--skill-asked` asked by the brief), and, at its end, tokens (`--tokens-in`, `--tokens-out`,
1654
- `--tokens-cache-read`, `--tokens-cache-write`, `--tokens-total`), `--money <amount> <currency>`,
1655
- `--duration`, `--exit`, `--verdict` and `--suite <name>=<runs>` for suites the agent ran itself. Nothing but
1656
- the station is required; a field nobody gave stays unknown. `start` answers a `run` and the `end` command to
1657
- run; `end` pairs with `--run` (an end that gives no `--step`/`--round` then takes its start's), else with the one open start of its station whose step, round and attempt match
1658
- the ones it gives (several: refused), else is recorded alone. `--event <id>` makes a retry safe: the same id
1659
- with the same fields answers the first event (`already`) and writes nothing, other fields are refused.
1660
- `start` is refused on a committed, canceled or failed lot, `end` is accepted in every state. An `end`
1661
- records `stateHash`, the state hash of the lot's worktree (left out when it cannot be read; a retry does
1662
- not compare it): a check the station ran on that tree inside its run counts for its claim. The station
1663
- names `shared` and `outside` are the report's own labels and are refused. `lot station <id> --from
1664
- <file.json>` takes the same fields as one JSON object, plus `phase` (`start` or `end`); an unknown key
1665
- is refused, every fault at once. A line over 4,096 bytes is refused. Exit 1 when the event cannot be written, 2
1666
- for a usage error or a refusal.
1667
- - Step events: the cli writes `step.start` and `step.end` events (`by: cli`) into the lot's `events.jsonl` for
1668
- `gate --fast`, `--full`, `--release` and `--hook`, `contrib`, `tdd red`, `tdd green`, `mutants run`,
1669
- `handover run` (real and rehearsal), `lot delta --worktree` and `worktree add`: the step, whether it is heavy,
1670
- its exit, its time, whether a gate reused records, and per gate step its status, counts, time and selection. A
1671
- step in a worktree that links no lot, or none matching, writes nothing. The `step.end` of `tdd red` and
1672
- `tdd green` carries `stateHash`, the worktree's state hash after the run (computed only in a lot). A write that fails prints one
1673
- `events: not recorded: <reason>` line and never changes the step's exit; a step killed after its start writes
1674
- its end as interrupted where it can. Long lists are cut, failing parts first. A step run in a worktree whose
1675
- link names a lot that lives elsewhere (a copied or moved worktree) is written to that lot as `step.foreign`.
1676
- - `dialecte.stepEvents` in the cli's own `package.json` (`"stepEvents": 1`) tells a host that this cli writes step
1677
- events. Each event notes the capability of the cli installed in the lot's worktree; a cli without it (an
1678
- older release or source) writes none, so the report shows the step counts of such a lot as unknown rather
1679
- than 0.
1680
- - Heavy steps (`gate --full`, `--release`, `contrib`, `mutants run`, a rehearsal, a gate step the package
1681
- declares heavy, and for the last only while that part runs) write a live marker in
1682
- `<state folder>/dialecte/heavy/` (`$XDG_STATE_HOME`, else `~/.local/state`): the step, the lot, the
1683
- worktree, the process and its start time. The step removes it at its end; a marker whose process is gone, or
1684
- runs with another start time, is dead and ignored. A person's run outside any lot writes the marker too, and
1685
- no event. This is how a host sees which heavy step runs now, and since when.
1686
- - `dialecte lot report <id> [--json]` reads files only (no git, no process, nothing written) and prints one lot:
1687
- its state, feature, effort, steps and rounds; per station run the agent, tier, model, tokens, time, suites
1688
- and skills; totals for tokens (each field with how many stations did not report it, a lower bound when a
1689
- total is not exact), money per currency (with how many stations reported none), and time (the lot's elapsed time as agents, cli steps, waiting for
1690
- answers, waiting for the machine and the rest); the suites per step family with their counts, reuse and
1691
- reruns, attributed to the station whose time holds the step (`shared` when several, `outside stations`
1692
- when none, and always for the steps the orchestration runs; a step a person runs by hand during a
1693
- station lands on that station); the heavy steps, the folders (worktree add, throwaways, trash), the review
1694
- rounds from the findings ledger, the events counted (damaged, duplicates, unknown kinds) and the next
1695
- command. A number nobody reported is `unknown` in the text and `null` in `--json`, never 0. A step family
1696
- reads unknown, with the reason, when the worktree's cli writes no step events, when a record of a step has
1697
- no run in the events, or when nothing of the lot's steps left a trace. `dialecte lot report --feature <name>
1698
- [--simulated] [--json]` gives one line per lot of the feature, in every store of the store list and the
1699
- current folder, then the totals by station and by tier; simulated lots are counted apart and listed by
1700
- `--simulated`; a lot whose folder is gone is listed from its `cards.log` line. Exit 1 when the feature names
1701
- no lot, 2 for an unknown or ambiguous id.
1702
- - The hand-over card gains a `usage` row (tokens, agents, runs, agent time, and the report's command) when the
1703
- hand-over folder is a lot folder holding a station event; `handover show --json` carries `usage`. A folder
1704
- with no station event shows no row.
1705
- - `cards.log`, in `<git common folder>/dialecte-handover/`, one per repository: one JSON line per record,
1706
- appended in one write, never rewritten, never rotated. A `card` line is a lot's final record: its hand-over
1707
- card, usage and the times of its gate, tdd and hook records (a worktree's records go with it), written by
1708
- `handover run` once a commit is recorded, or by `lot close` when none exists. A `removing` line is written
1709
- before a worktree moves (its path, branch, branch tip and record times), a `removed` line after it (the same
1710
- id; `trashed` or `kept`). A `removing` without its `removed` reads as unknown. The report reads these lines
1711
- for lots whose worktree or folder is gone.
1712
- - `dialecte lot export <id> <dir> [--json]` copies a lot folder to `<dir>/<full name>/`, `asks/` left out, links
1713
- kept as links (one pointing outside the folder is named), with the lot's `cards.log` lines and registry
1714
- entry added as `cards.log` and `registry.json`. It is refused (exit 2, nothing written) for an unknown or
1715
- ambiguous id, for a `<dir>` inside a git work tree or a git folder, and when `<dir>/<full name>` exists.
1716
- The copy is made into a temporary folder beside it and each file's size and checksum compared with the
1717
- source's (`events.jsonl` as a prefix, since a running lot appends); a difference makes one more copy of
1718
- that file, a second one removes the temporary folder and exits 1 naming the file; a match renames it. The
1719
- source is never written; another run's temporary folder is named, never removed.
1720
- - `dialecte mutants run [--mode changed|audit] [--base <ref>]` runs StrykerJS (resolved from the package,
1721
- its devDependency) on the scope `package.json` declares:
1722
- `"dialecte": { "mutation": { "scope": [...], "exclude": [...], "errorFactories": [...], "fast": { "vitestConfig": "..." }, "full": { "command": "..." } } }`.
1723
- `changed` mutates the scope lines changed since the merge base with the base branch (found as
1724
- [the base branch](#the-base-branch) is; with none found, or a `dialecte.baseBranch` naming no branch, the run
1725
- is refused, exit 2, naming `dialecte.baseBranch` and `--base`) or `--base <ref>`, untracked scope files
1726
- whole; `audit` the whole scope (no base needed). Without `--mode` the lot's switch decides; with no switch,
1727
- `changed` when the change touches the scope, else `mutation off for this lot` and exit 0. A detached HEAD is
1728
- refused: a run is filed under its branch. Before Stryker starts, the run is written `running` with its
1729
- process id and that process's start time to `<git-common-dir>/dialecte-mutation/runs/<run id>.json` (every
1730
- worktree of the repository reads it); a run whose process is gone before it reports, or whose pid now
1731
- belongs to a process that started at another time, reads `died`. Every Stryker call names an empty config
1732
- file (`configFile`), so a `stryker.config.json` of the package is never merged in, and only the fast tier is
1733
- incremental. The fast tier runs first, then the timed-out mutants alone, then the declared full tier on the
1734
- survivors no committed record (`.dialecte/mutation-records.json`) lists; the entry is then replaced
1735
- `reported` with the counts, the survivors and the keys of the mutants it detected (killed or timed out), and
1736
- each survivor no record lists enters the ledger (`<git-common-dir>/dialecte-mutation/ledger.json`) as `new`,
1737
- keyed `<package>::<survivor key>`. A `new` or `scheduled` survivor becomes `killed` only when a later run
1738
- detected that exact mutant, and never by a run that started before the last run reporting it (that run tested
1739
- older code); a record with a reason and a family makes it `recorded` (a scheduled one keeps its follow-up
1740
- name). Any other run leaves it as it is: a survivor whose line changed or went away stays pending until the
1741
- lot tests it, records its reason or schedules it. The ledger's readers and writers hold a lock file beside it
1742
- (one whose owner process is gone, or that names no owner and is a few seconds old, is taken over) and first
1743
- take in every reported run the ledger has not taken in yet, in the order they started, so a run whose ledger
1744
- update was missed still reaches it, once. The last lines name the package, lot (the branch), tree (12
1745
- characters), mode, counts, each new survivor `file:line mutation` and each ledger item the run moved
1746
- (`<key> file:line killed|recorded`). Exit 1 only when Stryker fails (the run stays `running` until the
1747
- process ends); survivors never fail the command. Reports and sandboxes go under `.tmp/mutants/<run id>/`,
1748
- removed once the run reported. Stryker's incremental file lives in the run's work folder, seeded from and
1749
- written back to `<git-common-dir>/dialecte-mutation/incremental/<package hash>-<key>.json` after a reported
1750
- fast tier. The key holds the whole tree (`.dialecte/` left out), the package's path, the installed lock, the
1751
- linked `file:` dependencies, the fast tier's options, the cli version and the ignorer plugin's bytes, so the
1752
- file is reused on an identical tree only (a rerun, other targets, `changed` then `audit`, another worktree at
1753
- the same tree, a rerun after recording reasons) and never across edits. The store keeps the newest 4 files of
1754
- a package. A write-back that fails prints one warning on stderr and the run goes on.
1755
- - `dialecte mutants status [--json]`: the package's running runs with their age, died runs, `new`
1756
- survivors grouped by the lot that first saw them and `scheduled` ones by follow-up.
1757
- `dialecte mutants schedule <follow-up> <key>...` (or `--all-new`) moves `new` survivors to `scheduled`
1758
- under that follow-up (an unknown key refuses the whole call); `dialecte mutants abandon <run id>` marks a
1759
- died run `abandoned` and keeps it (a running or reported run is refused); `dialecte mutants migrate`
1760
- turns `scripts/mutants/equivalent-mutants.json` into `.dialecte/mutation-records.json` (same keys and
1761
- reasons, family `unclassified`, the line's hash), never overwriting an existing file. The store is
1762
- written by the cli only: never edit it by hand.
1763
- - `dialecte mutants judge [--file <file>]` prints, per file (sorted), the package's `new` survivors as a judge
1764
- packet: each survivor's key, line and mutation, a family guess with its reason (the first rule its code
1765
- matches: an `errors/` file or error wording, a `.constants.ts` file or a module-level declaration, an
1766
- exhaustive `default:`; `unclassified` when none does), the covering tests the last run that reported it named
1767
- (five, then `…and <n> more`), the code around it as the file is now (5 lines above and below, 21 at most, each
1768
- line cut at 160 characters, the mutated lines marked `>`, `line changed since the run` when its text differs
1769
- from the reported one) and the `record` and `schedule` commands that close it. A packet holds 10 survivors at
1770
- most and its JSON and its text stay within 12000 bytes each: the rest is counted (`…and <n> more survivors`);
1771
- a lone survivor over the cap loses window lines (context first), then test names, then the end of its mutation
1772
- text, each counted. A run entry stores at most five covering test names per survivor, and how many more.
1773
- `dialecte mutants record (--key <key>... | --file <file>) --family <family> --reason <text> [--removable]`
1774
- writes each survivor's record to `.dialecte/mutation-records.json` (family, trimmed reason of at most 200
1775
- characters, the hashes of its line and tests; `removable` for `invariant-guard` and `fallback-never-taken`
1776
- only; other records kept, files and records sorted), then moves each `new` or `scheduled` one to `recorded`
1777
- (a killed or recorded one stays as it is), both under the ledger lock, the records first: a crash between the
1778
- two leaves the survivor `new` until a later run or `record` takes the record in. `--key` repeats or takes
1779
- several keys; `--file` takes every `new` or `scheduled` survivor of the file. An unknown family, `unclassified`,
1780
- an empty or too long reason, `--removable` with another family, an unknown key, or a `--file` holding no `new`
1781
- or `scheduled` survivor refuses the whole call (exit 1, nothing written); both `--key` and `--file`, neither, no
1782
- `--family` or `--reason`, or an option given another of the verb's options as its value (`--reason --json`) is a
1783
- usage error (exit 2). `dialecte mutants drop <run id>` removes an abandoned run, or a reported run, from the
1784
- store; a running or died run (abandon it first) and the latest reported run of its branch (it is that branch's
1785
- evidence: drop it once a newer run of the branch reported) are refused. Every verb but `run` takes `--json` and
1786
- then prints exactly one JSON object on stdout, a refusal included: `{ "verb", "ok": true, ... }` or
1787
- `{ "verb", "ok": false, "reason" }` with the usual exit code (`status --json` prints the status itself).
1788
- - A `new` survivor or a died run blocks every hand-over of the package (the card's `mutation` line and
1789
- `handover run`'s guard) until it is killed, recorded, scheduled, rerun or abandoned; a running run blocks a
1790
- merge hand-over and a gate lot; `dialecte worktree prune` keeps the worktree of a running or died run.
1791
- - `dialecte worktree prune [--root <workspace>] [--yes] [--json]` lists, per repository of the workspace,
1792
- the worktrees and local branches whose commits are all in the base branch, the hand-over folders whose
1793
- lots are all committed (never `_commit-plan` itself, nor a folder holding other folders) and the
1794
- rehearsals whose process is gone - the rehearsal folders under `/tmp` (each goes whole) and the clones
1795
- earlier cli versions made in the system's temporary folder, each judged by its marker - with the
1796
- command that removes each (its absolute `cd` first).
1797
- `--yes` runs them after a confirmation on a terminal; without a terminal it refuses, so hand the
1798
- commands (or the `--yes` command) to a person. Kept, each with why: first, a worktree a lot of the
1799
- repository's store names (by real path) while the lot is not `committed` nor `canceled`
1800
- (`<branch>: lot <full name> <state>`; the store read once per repository, no git process per lot); an unmerged branch; the branch the
1801
- main checkout is on; a worktree a mutation run was started from while that run still runs
1802
- (`mutation run <id> still running (pid <pid>)`) or after it died before reporting
1803
- (`mutation run <id> died before reporting: rerun or dialecte mutants abandon <id>`; a reported or
1804
- abandoned run keeps nothing); a worktree a hand-over is pending in, or with uncommitted changes; a branch whose
1805
- reflog still reaches commits the base does not hold (reset onto a newer base after commits of its own:
1806
- its reflog is the only way back to them); a worktree or branch with no commit of its own in its reflog
1807
- (just made); a worktree holding ignored files that removing it would delete (anything but
1808
- `node_modules`, `dist`, `.vitepress/cache`, `.vitepress/dist`, `.DS_Store` and the hooks folder; a long
1809
- list is counted, the first three named); a rehearsal clone whose process still runs, or without a
1810
- marker. It never removes, nor offers to remove, a symbolic link or what a link reaches. A worktree
1811
- path, a hand-over folder or a rehearsal clone that is a link, or a hand-over folder reached through a
1812
- linked folder under the workspace at any depth, is kept with
1813
- `a link: prune never removes a link nor what it points to` (a dangling link included). A worktree,
1814
- hand-over folder or rehearsal clone that a link reaches (links looked for one level under the
1815
- workspace, its `.worktrees/`, its `_commit-plan/` and the scratch folder) is kept with
1816
- `the link <link> points to it`. `git worktree prune` unregisters every worktree whose folder holds no
1817
- checkout, a link's too: while a registered worktree of the repository is a link, a worktree deleted
1818
- from disk is kept, naming that link, and no `git worktree prune` is offered. The sibling links
1819
- `worktree add` makes (`.worktrees/core -> ../core`) are in no item. It reads each worktree with
1820
- `git --no-optional-locks`, so it never rewrites an index. Each hand-over's repository is read once for
1821
- the whole workspace, and its state once, never once per repository. `handover list` follows a link to a
1822
- hand-over folder and lists a folder reached by its path and through a link once. The pool entries and the
1823
- trash (a worktree in `_trash/` included) are never listed nor touched: one line each,
1824
- `pool: 2 entries (cli 1, core 1)` and `trash: 3 folders, being deleted or left over`.
1825
-
1826
- `gate --fast` starts with the hygiene of the worktree: nothing staged; no stash entry pushed on this
1827
- worktree's branch since `worktree add` made it (the baseline keeps every stash entry it saw, so another
1828
- session dropping one changes nothing; one stash is shared by every worktree and session: a new entry of
1829
- another branch is only noted, naming it; without a baseline the stash is not compared); and
1830
- every new file one the change declares (`--declare <path>`, repeatable; an undeclared one is a warning).
1831
- A failure says what changed and how to look at it with read-only commands.
1832
-
1833
- Steps run with the runner's defaults - no lock, no `nice`, no worker cap - whoever else shares the machine.
1834
- A step that counts tests and runs vitest (its command, or the npm script it runs, names `vitest`) and fails
1835
- on its exit code or its counts is run once more with `--no-file-parallelism`, on the failing files the first
1836
- run named (through `npm run <script>` after one `--`; the whole step when the output names no file). The
1837
- rerun passes when it exits 0, counts no failed test and at least one passed: the step then passes,
1838
- flagged - `serial rerun of <n> file(s): exit 0, <counts> flaky in parallel` on its line, one
1839
- `flaky <file>` line under it per file, the note kept in the gate record; the hand-over card's row of such a step,
1840
- or of a hook's test step `gate --hook` flagged so, reads `✓ <step> <passed> passed · <n> flaky, passed serially`
1841
- (n the flaky files), never a failed count. Otherwise the step fails as a
1842
- `real failure: <why>`, each file listed under it as `failed <file>` when it failed again or `flaky <file>`
1843
- when it passed serially, the rerun's last lines as the tail. While the rerun runs, the step's line still
1844
- shows its own command. A step that stalled, counts no tests, runs no vitest, or already runs one file at a time
1845
- (`--no-file-parallelism` in its command) is never rerun. `--json` carries the rerun of
1846
- each step (`rerun`: files, the files still failing, status, exit code, counts).
1847
-
1848
- `gate --fast` and `--full` run a `tdd` step after the hygiene (first in `--full`): every test-code file
1849
- changed since the base (test files, helpers, fixtures, snapshots) must be as the red run that last froze it
1850
- ("test code changed outside tdd red"), and every case of the change red then green, or unchanged; the
1851
- others fail the gate with the list. The flags of the receipts and the deleted cases are printed under the
1852
- step. The lot file may also accept cases without a red - a new test of behaviour that already exists, an honest
1853
- cut of an assertion: `"accept": [{ "case": "<file>::<name> [project]", "reason": "..." }]`. An accepted
1854
- case passes `tdd red` as accepted and does not block its file (a case already proven red then green keeps
1855
- its proof: an acceptance never overrides one, and an accepted receipt counts only while its entry stays in
1856
- the file); the gate lists each acceptance with its
1857
- reason, the hand-over card counts them by reason from the receipts (those of earlier lots, which the file
1858
- no longer names, counted on one line), and both report an acceptance or a `revised` entry no case used (the
1859
- gate's `unused accept` line adds `; the closest: <file>::<name>` when a case title of the change is close). An
1860
- entry names a title with its quotes folded: a straight `'` or `"` matches a curly one (`’`, `‘`, `“`, `”`) and
1861
- the reverse; nothing else (a backtick, a prime, the letter case) compares alike. The card
1862
- lists every `gone` entry with its reason; only the gate reports a `gone` entry that covers no finding. The file is strict: an unknown key, at the top or in
1863
- an `accept` entry, and an exemption without a reason are refused, naming what is wrong. A lot the orchestrator declares exempt - a wording, rename or doc-only lot - passes with its reason
1864
- and what the change touches: `{ "tdd": "exempt: <reason>" }` in `.dialecte/lot.json` at the package root
1865
- prints "exempt: <reason> (n production file(s), m test file(s) changed)". The hygiene and the hand-over
1866
- leave the file out (never committed); the hand-over card shows the exemption and the flags. A package that
1867
- does not test with vitest skips the step.
1868
-
1869
- A package tunes them in its package.json:
1870
-
1871
- ```json
1872
- "dialecte": {
1873
- "gate": {
1874
- "fast": [
1875
- {
1876
- "name": "tests",
1877
- "run": "npx vitest run --project unit --changed",
1878
- "counts": "tests",
1879
- "changedOnly": true
1880
- }
1881
- ]
1882
- },
1883
- "profile": "contributor",
1884
- "generatedDocs": [".vitepress/data/elements-catalog.json"],
1885
- "referencePatterns": ["SPEC-[0-9]+"],
1886
- "allowReferences": ["ticket number"],
1887
- "baseBranch": "main",
1888
- "rebuiltIgnored": ["coverage/"]
1889
- }
1890
- ```
1891
-
1892
- `gate.fast` / `gate.full` replace the default steps of that mode (`counts: "tests"` makes a step fail
1893
- when it counts no test; `changedOnly: true` marks a step that runs only the tests the change affects,
1894
- so "No test files found" passes with a note instead of failing; `restoresGeneratedDocs: true` restores the `generatedDocs` byte for byte after
1895
- it); `baseBranch` optionally names
1896
- [the base branch](#the-base-branch); `rebuiltIgnored` lists ignored
1897
- folders a build or a run rebuilds, which `lot close` may delete with a worktree: each a folder ending with `/`,
1898
- relative to the package root, read from the `package.json` of the main checkout nearest the ignored path (a
1899
- worktree's own declaration counts for nothing); an invalid entry (empty, absolute, holding `.` or `..`, without its
1900
- trailing `/`, not a string) is ignored, and an ignored folder nobody declares keeps the worktree; `referencePatterns` adds the package's own patterns (extended regular expressions) to the
1901
- citations (and, in a contributor, the tags) `rules` and `handover` refuse; `allowReferences` is the contributor's
1902
- opt-out: it lifts generic tags a contributor commits on purpose - `ticket number`, `acceptance criterion`,
1903
- `plan tag` - and refuses any other label in either profile: a citation of a standard is never allowed. A consumer
1904
- allows every tag already, so `allowReferences` changes nothing there (`dialecte doctor` says to remove it). A lot may hold a symbolic link, a link to a
1905
- folder included: it is hashed and scanned as its target text and committed as a link, the way git stores it (a
1906
- rehearsal copies it as the same relative link).
1907
-
1908
- **Scoped steps, heavy steps, the release list.** A step of `fast`, `full` or `release` may say `"scoped": true`
1909
- (never with `changedOnly`, never in `contrib.steps`): the gate resolves one base per run - `--base <ref>`, else the
1910
- merge-base of HEAD and [the base branch](#the-base-branch), else the empty tree (everything changed) - and hands the
1911
- step `DIALECTE_GATE_BASE`, `DIALECTE_GATE_TREE`, `DIALECTE_GATE_CHANGED` (a file of the changed paths byte for byte,
1912
- NUL-separated, both paths of a rename, relative to the repository top as `git diff --name-only` names them, while a
1913
- declared `failing` path is relative to the package root) and `DIALECTE_GATE_SELECTION` (a path to write). The step writes there
1914
- `{ "schema": 1, "base", "tree", "changed": <paths judged>, "selected": [{ "id", "reasons": [...] }], "skipped": [{ "id", "reason" }] }`:
1915
- `selected` and `skipped` are both required lists, each selected id has at least one reason, the file is at most 1 MiB
1916
- 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
1917
- count fails the step. An empty selection should exit 0 without starting vitest: it passes with
1918
- `nothing selected since <base> (<n> paths changed)` (`1 path changed` for one); a non-empty selection on a
1919
- `counts: "tests"` step that runs no test fails (`no test ran`). The step selects from the working files (never
1920
- `git show <tree>:`), so what it selects and what it runs are the same code. A failing step counting tests is rerun
1921
- once, serially, with its failing files appended as plain arguments (after one added `--` only when the step runs
1922
- through `npm run` and its command holds none), then `--no-file-parallelism`, with the same base, tree and changed file
1923
- and a new selection path: the rerun must select the same ids, and a script running vitest more than once passes
1924
- `--passWithNoTests` to each invocation (or runs one). A scoped step whose command (or the npm script it runs) does not
1925
- name vitest is rerun whatever runs it, when it exited non-zero on a test failure (a failed test counted, a `FAIL` line,
1926
- vitest's `Unhandled Errors` or `Errors <n> error` summary); for such a step a plain script error fails as itself. A
1927
- scoped step that names vitest keeps the rule of any vitest step: rerun on any failure. A first run whose selection is
1928
- not valid is never rerun.
1929
- The selection may declare `"failing": ["<path>", ...]` (relative to the package root, no `..`, no backslash; a leading
1930
- `./` and repeated `/` are normalised away): a failed step records those files with the ones its output names
1931
- (`failing` in the record and in `--json`; the card's row ends `· failing <n>: <first 3>`).
1932
- Run outside the gate (no `DIALECTE_GATE_SELECTION`), a scoped script selects everything. The base enters the record's
1933
- key, so a run at another base never reuses. `"heavy": true` marks a heavy suite (a browser suite); it is outside the
1934
- command hash. `gate.release` is the list `gate --release` runs (default: the `full` steps, derived ones included),
1935
- every scoped step against the empty tree (`--base` with `--release` feeds only the tdd step); it _covers full_ when
1936
- every `full` step is in it with the same `name`, `run`, `counts` and `changedOnly`, and only then does its green
1937
- record answer a commit hook, a rehearsal, contrib and the card. An environment switch that changes what runs belongs
1938
- in the step's `run`. A gate config the cli cannot run (a list that
1939
- is no list of steps, a step without `name` or `run`, a `scoped` or `heavy` that is no boolean, `scoped` with
1940
- `changedOnly`) is refused naming the list and the step: `gate`, `contrib` and `handover run` exit 2, `gate --hook`
1941
- exits 1, the card prints `✗ gate invalid gate config: <message>`.
1942
-
1943
- **Opting out of a default step.** A package that has no use for a default step (no skills folder, no type
1944
- benchmark yet) says so, with a reason, instead of wiring a script:
1945
-
1946
- ```json
1947
- "dialecte": {
1948
- "gate": { "skip": { "skills": "no skills folder in this package" } },
1949
- "contrib": { "skip": { "type-bench": "no type benchmark yet" } }
1950
- }
1951
- ```
1952
-
1953
- `dialecte.gate.skip` serves the default steps of `fast`, `full` and the release list that follows `full`;
1954
- `dialecte.contrib.skip` the default `contrib` steps (`docs`, `type-bench`) when `contrib.steps` is not declared.
1955
- A skip is only for a default step the package cannot run: an `npm run <x>` step whose script `x` is missing. A reason
1956
- is a non-empty string of one line and at most 200 characters. A name that is no default step of a mode with no
1957
- declared list, a step the package can run (its script is there, or it runs no npm script, as the default `tests`:
1958
- `"tests": skip is for a step the package cannot run; remove the skip`), an empty or too long reason, or a `skip`
1959
- that is no map is refused like any gate config (exit 2, naming the key and the name): an opt-out cannot go stale
1960
- unseen, and adding the script makes its skip refused until it is removed. An opted-out step runs in no mode (`skip skills
1961
- opted out: <reason>`; the card warns, never blocks), and a step the package declares has no opt-out: remove it or add its
1962
- script. Adding or removing an opt-out changes the gate record's key, so the gate runs again.
150
+ Each has its page: [`rules`](doc/commands/rules.md), [`gate`](doc/commands/gate.md), [`contrib`](doc/commands/contrib.md), [`tdd`](doc/commands/tdd.md), [`new`](doc/commands/new.md), [`handover`](doc/commands/handover.md), [`worktree`](doc/commands/worktree.md), [`lot`](doc/commands/lot.md), [`inbox`](doc/commands/inbox.md), [`health`](doc/commands/health.md), [`plan`](doc/commands/plan.md), [`mutants`](doc/commands/mutants.md), [`changelog`](doc/commands/changelog.md), [`text`](doc/commands/text.md).
1963
151
 
1964
152
  ### The base branch
1965
153
 
1966
154
  Every command that reads the base branch (the gate's base, `mutants`, `tdd`, `worktree add` and `worktree prune`,
1967
155
  `lot close`, the hand-over's target) finds it the same way, the first rule that answers winning:
1968
156
 
1969
- 1. `dialecte.baseBranch` when set (an optional override): the local branch, else origin's. Set to a branch that
1970
- exists nowhere, it is refused, never replaced by another: exit 2 for the gate's base, `mutants`, `handover write`
157
+ 1. `dialecte.baseBranch` when set (an optional override). Set to a branch that
158
+ exists nowhere, it is refused, never replaced by another (a package without a `dialecte.gate` config too: its
159
+ default lists hold the scoped `rules` step): exit 2 for the gate's base, `mutants`, `handover write`
1971
160
  and `handover run`, exit 1 for `worktree add` of a new branch without `--from`; the commit hook fails, and the
1972
161
  tdd step of `gate --full` fails with the same text.
1973
- 2. The branch `origin/HEAD` names (recorded at clone), when that branch exists; the local one is preferred.
1974
- 3. `main`, local, else origin's.
1975
- 4. `master`, local, else origin's.
162
+ 2. The branch `origin/HEAD` names (recorded at clone), when that branch exists.
163
+ 3. `main`.
164
+ 4. `master`.
1976
165
  5. Nothing found: refused with `no base branch found (no dialecte.baseBranch, no origin/HEAD, no main, no master):
1977
166
  name it as dialecte.baseBranch in package.json`. The gate alone keeps selecting everything (with a note) in that
1978
167
  case; `worktree add` without `--from` refuses, `worktree prune` skips the repository with the text, `lot close`
1979
168
  holds nothing through the base, and `tdd` measures from HEAD.
1980
169
 
170
+ Each rule reads the branch where it is newest: the local branch or origin's, whichever is ahead of the other, and
171
+ origin's when they diverged. The remote is the truth: a merge queue lands on the host, so a local base branch goes
172
+ stale. `worktree add` (without `--from`) fetches origin before it cuts the branch, and `lot close` fetches it and
173
+ fast-forwards the local base branch (merged in the main checkout when it is checked out there and clean, its ref
174
+ moved otherwise; a line says when it does not move). A fetch that fails says so and the last known refs are read. A
175
+ lot's own branch is always read locally.
176
+
1981
177
  The repository field of `package.json` is a URL and is never read for this. `mutants` finds `origin/<b>` through
1982
178
  the same rule and no longer takes a tag named like the base branch.
1983
179
 
1984
- ### GitHub text: lot recap and text check
1985
-
1986
- Text written with an assistant tends to retell the diff and grow long. The pull request splits in two:
1987
- an expandable part made from records, and a short human part that is checked before it is posted. Both
1988
- commands only print; the user posts.
1989
-
1990
- - `dialecte lot recap <id|folder>` prints the expandable part (`<details>`) as GitHub markdown, from the
1991
- records only: the commits of the lots (or `not committed yet`), the test cases the newest gate record of the
1992
- current tree judged red then green, counted per test file, the gate and rules lines (and `mutation`), the
1993
- lot's mutation runs (`Mutation`: each run of the branch and of the branches it merges, oldest first, with
1994
- its mode, id and counts or its state; each survivor those runs killed or recorded; each survivor first seen
1995
- on those branches and scheduled, with its follow-up; `No mutation run.`, or `No mutation scope declared.`
1996
- for a package without one), the review rounds from
1997
- the findings ledger, the decisions (accepted findings, the lot declaration's `accept` and `revised` entries,
1998
- the rows of `decisions.md`, then, in a lot folder, one row per answer `answers/q<k>.json` in `k` order:
1999
- `q<k> <question text> -> <answer>`, by who answered, on the UTC day of the answer; an answer is never copied
2000
- into `decisions.md`), the logged findings as follow-ups, and who reviewed and posted it (`git config
2001
- user.name`; no name set is refused). Every section is always there, saying so in one line when empty; a
2002
- branch that does not hold the lots on top of the recorded base lists none as committed and says so. Each
2003
- finding is printed with its id, its text without one leading reviewer tag `[...]`. The ledger is read whole:
2004
- every row after its header with the header's cell count is a finding, whatever its id (`R<n>-<k>`, `TR3-1`,
2005
- `F-a`, printed as written), notes between rounds included; its round is the round cell's, else the one an
2006
- `R<n>-` id names, else the row is refused. A state is read as a history (`fix wrong 2 (...) - fixed 3
2007
- (reasoned)`): it starts with `fixed`, `accepted`, `logged`, `open`, `fix to verify`, `fix wrong` or
2008
- `reopened`, and a spaced dash starts a new part only before `fixed <n>`, `reopened <n> by <id>`, `fix wrong
2009
- <n>`, `fix to verify`, a closing `open`, or a later `accepted` or `logged` followed by ` (`, `: ` or a
2010
- spaced dash; any other spaced dash belongs to the text before it. The last part decides (`fix wrong`,
2011
- `reopened` and `fix to verify` leave the finding open), an accepted one's reason being the rest (in its
2012
- parentheses, or after `- ` / `: `); a state recap cannot read is refused with the row's id. A `file:line` is
2013
- printed relative to the repository, or to the workspace folder for a sibling repository (the parent of the
2014
- main checkout; of the `.worktrees` folder when the repository is gone), never absolute: an absolute path
2015
- outside both, or one the rewrite does not reach (a `/` starting a path segment after a backtick, a quote,
2016
- `=`, `[`, `-`; `~/`), is refused with the row's id; a `/` starting no segment (`a.ts / b.ts`, `+/- 2`) and
2017
- URLs stay. Where a finding was logged, the hand-over folder and the lots file's notes are left out. It writes
2018
- nothing.
2019
- - `dialecte text check <file> [--kind pr|issue|comment|commit]` checks every line before the first `<details`
2020
- line (the recap is not checked). A pull request or an issue holds the headings `What changes`, `Why`, `How
2021
- to check it` in this order, then `Watch out` only when it has something to say; each with text under it,
2022
- nothing before the first. A comment or a commit holds no heading; a commit's line 1 is its subject, not
2023
- empty and at most 72 characters (longer ones are cut in logs and in GitHub's list), with a blank line before
2024
- the body. The word cap: 150 for a pull request (the diff carries the rest), 200 for an issue (it stands
2025
- alone), 80 for a comment (it answers one point), 100 for a commit body (the why; the subject is not
2026
- counted). Words hold a letter or a digit; headings and fenced code blocks are not counted. Past the cap it
2027
- prints the count, the cap and every line from the one that passed it. Exit 0 when the text holds, 1 with one
2028
- line per problem.
2029
-
2030
- ## Run a script
2031
-
2032
- `dialecte run <script.ts>` runs a script against an in-memory project of the dialecte your project
2033
- installs (with `@dialecte/core` 0.8.0 or later) and answers one structured outcome. The script is a
2034
- module whose default export receives `{ project, doc, documentId, dialecte, helpers, utils }`; what it
2035
- returns is the outcome's `result`.
2036
-
2037
- ```ts
2038
- // add-part.ts
2039
- export default async function addPart({ doc }) {
2040
- const [assembly] = await doc.query.findByAttributes({
2041
- tagName: 'Assembly',
2042
- attributes: { name: 'A1' },
2043
- })
2044
- await doc.transaction(async (tx) =>
2045
- tx.addChild(assembly, { tagName: 'Part', attributes: { name: 'P2' } }),
2046
- )
2047
- }
2048
- ```
2049
-
2050
- ```
2051
- dialecte run add-part.ts --in assembly.xml --expect expected.json
2052
- failed: expectations not met
2053
- operations: Assembly +0 ~1 -0, Part +1 ~0 -0
2054
- diagnostics: none
2055
- expectations: 0 passed, 1 failed
2056
- ✗ expected 3 Part under Assembly[name="A1"], found 2
2057
- ```
2058
-
2059
- - `--in <file>` imports a file first (an empty document otherwise); its import diagnostics are in the
2060
- outcome. `--out <file>` writes the document once the script ran.
2061
- - `--prepare` stages the script's first transaction instead of committing it and stops the script
2062
- there: the records it would write, and what its callback returned (a lifecycle report), nothing
2063
- committed. Any other write is refused and fails the run, even when the script catches the refusal:
2064
- a second transaction, `commit()` on a prepared transaction, a transaction on a document opened
2065
- through `project.openDocument`, the project's own writes (`importFile`, `removeDocument`,
2066
- `undo`, ...) and its raw database (`getDatabaseInstance`). In every mode the runner alone commits:
2067
- `tx.commit`, `tx.finishStaging` and `tx.clearStagedOperations` are refused inside a callback, and a
2068
- transaction nested in another fails with `CONCURRENT_TRANSACTION`. The guarantee covers the API a
2069
- script is handed; a deliberate call around it (`Object.getPrototypeOf(doc).transaction.call(...)`, a
2070
- store reached by other means) is outside it.
2071
- - `--expect <file>`: a JSON array of expectations `{ "tag", "where"?, "under"?, "count"? }`, checked on
2072
- the result (on the staged transaction under `--prepare`); each one not met is named with the count
2073
- found. `count: 0` means none, no `count` at least one.
2074
- - Deterministic: ids come from a seeded generator (`--seed <n>`, 0 by default), `--now <iso>` freezes
2075
- the clock, both from the moment the script module loads (an id minted at its top level is seeded
2076
- too). The same script, input and seed give the same outcome.
2077
- - Operations are counted per record, as each commit merges them: an element created then updated in
2078
- one transaction is one creation.
2079
- - A thrown structured error is answered as code, key, detail, `meta` and the element's path from the
2080
- root (`/Root/A/AA_2[2]`); `dialecte explain <code>` says what it means.
2081
- - `--json` prints the outcome as data. `--package <name>` names the dialecte when the project depends
2082
- on none or several (`@dialecte/scl/v2019C1`, `@dialecte/core/test`). `--timeout <ms>` (120 s by
2083
- default): the run then answers a timeout and the command exits; called as a library, the script may
2084
- keep running in the caller's process. Exit 0 ok, 1 failed or an expectation not met, 2 usage. The
2085
- script's own console output goes to stderr. A value the script returns that is not JSON (a cycle, a
2086
- BigInt) is given as text with a note.
2087
- - Needs Node 22.18 or later: a `.ts` script runs through Node's built-in type stripping, no build step
2088
- (erasable TypeScript only: types, no enums or namespaces).
2089
-
2090
- `dialecte explain <code | key>` reads the error catalogue of the installed core and the error and
2091
- diagnostic catalogues the dialecte exports: the message, when it is raised, the usual fix, the docs
2092
- page. `--json` for the entries as data; exit 1 when no catalogue knows the code.
2093
-
2094
- ## A fixture from the engine
2095
-
2096
- `dialecte fixture <Tag>` answers the smallest XML document holding `<Tag>` that is valid against the
2097
- dialecte's full schema, built by the engine of the dialecte your project installs - never written by hand.
2098
- It is a `dialecte run` of a script the command writes from the definition, read through core's readers:
2099
-
2100
- - the chain of parents from the root down to the element: the shortest one (among chains as short, the
2101
- first in sequence order), or the one `--under A/B` names (the root may be named first or left out);
2102
- - every child an element on the way requires, as many times as it is required, and the first branch of
2103
- each choice it requires (unless a child already takes one), each with what it requires in turn; an
2104
- element declared with an abstract type names its first variant with `xsi:type`;
2105
- - a value for every required attribute, and text for an element whose type an empty text does not
2106
- satisfy: the fixed value, else the default, else the first value the type takes - an enumerated value,
2107
- a string its patterns match, a number counting up from the lowest its range allows, free text from the
2108
- tag name - checked against every facet (enumeration, pattern, length, range). Each sampled value is new
2109
- in the document, so unique and key fields never repeat one;
2110
- - every element a key selects holds its key fields, and every reference a keyref checks points at an
2111
- element of the key: one already planned when the values can meet (the element itself, for a reference to
2112
- its own key), else one planted along the key's selector, with what it requires in turn (its own
2113
- references included).
2114
-
2115
- ```
2116
- dialecte fixture AAA_1 --package @dialecte/core/test
2117
- <?xml version="1.0" encoding="UTF-8"?>
2118
- <Root xmlns="http://dialecte.dev/XML/DEFAULT">
2119
- <A aA="A">
2120
- <AA_1 aAA_1="AA_1">
2121
- <AAA_1 aAAA_1="aaa">
2122
- <AAAA_1 aAAAA_1="AAAA_1"/>
2123
- </AAA_1>
2124
- </AA_1>
2125
- </A>
2126
- </Root>
2127
- ```
2128
-
2129
- What is guaranteed, and how it is proven: the document is valid against the dialecte's full XSD -
2130
- structure, values, identity (unique and key) and references (keyref). The tests build the fixture of every
2131
- element of core's test dialecte and of scl and judge each with `xmllint --schema` on the real XSD.
2132
-
2133
- What is not:
2134
-
2135
- - The hooks have the last word on what they fill: an attribute a hook already set when the element was
2136
- added (an id, a derived name) keeps the hook's value. A dialecte whose hooks fill a key or reference
2137
- field differently from the plan could break a reference the plan made good; the tests catch it for the
2138
- dialectes they cover.
2139
- - Only the first branch of a required choice, and the first variant of an abstract type, are taken; the
2140
- fixture holds no optional content.
2141
- - A reference whose key is declared on another element than the keyref, a key reached only through `.//`
2142
- or through any element, and a field reaching past the selected element are not planted: the command
2143
- exits 1 naming the constraint, never with a document that breaks it.
2144
- - The document carries no record-id marks (`dev:db-id`): it is the plain export, as a user would get it.
2145
-
2146
- - Ids are seeded and the clock is frozen: the same command and the same installed versions give the same
2147
- bytes.
2148
- - `--out <file>` writes the document and prints one line (the path of the element, the bytes); `--json`
2149
- answers `{ ok, packageName, tag, path, bytes, xml }` (`out` in place of `xml` with `--out`).
2150
- - Exit 1 with the reason when there is no fixture: an unknown tag (the closest tags named), a `--under`
2151
- step its parent does not hold, an element only an endless chain of required children could hold, a
2152
- value the fixture cannot make (the attribute named: a pattern construct it does not read, facets no
2153
- value satisfies), a reference it cannot plant (the constraint named), or a write the engine refuses
2154
- (its outcome, as `dialecte run` prints it). Exit 2: usage.
2155
- - The command does not run a schema validator itself: no XSD ships with it.
2156
-
2157
180
  ## Developing the cli
2158
181
 
2159
182
  The `schema`, `run`, `fixture` and `explain` tests drive `@dialecte/core`'s own test dialecte: they resolve core from the
@@ -2170,9 +193,9 @@ lockfile). Build core there (`npm run build`) before running the tests. A releas
2170
193
  per dependency (its field, name and spec), and says how to pin it
2171
194
  (`npm install --save-exact <name>@<version>`).
2172
195
 
2173
- The cli has a commit hook: `.husky/pre-commit` runs `npm run check` (type-check, lint, format; no suite), then
2174
- `npm run test:hook` (`dialecte gate --hook` from the sources: the suite, unless a green `gate --full` of the
2175
- committed tree answers it), then `npm run build`. `npm install` in the
196
+ The cli has a commit hook: `.husky/pre-commit` runs `npm run test:hook` (`dialecte gate --hook` from the sources:
197
+ the tdd receipts of the lot, then `check` and `rules` on the touched files; no test suite: the lot's tests ran in
198
+ `tdd red` / `tdd green` on that tree, and CI runs the whole suite on every push). `npm install` in the
2176
199
  cli checkout activates it (`"prepare": "husky"` sets `core.hooksPath` to `.husky/_`), and `dialecte worktree add`
2177
200
  copies `.husky/_` into each new worktree, so `handover run` proves a cli lot again at its commit, running the
2178
201
  suite only for a tree no green `gate --full` checked. A hook
@@ -2180,10 +203,19 @@ runs with git's `GIT_DIR`, `GIT_INDEX_FILE` and the commit's identity set: the s
2180
203
  (`test/git-environment.setup.ts`, vitest `setupFiles`) clears them before any test, so a test's git acts on
2181
204
  its scratch repository only, and the cli clears git's repository variables at its start.
2182
205
 
206
+ The main checkout's `dist/` is rebuilt by the `post-merge` hook (and `post-rewrite` after a rebase) after
207
+ `git pull` or `lot close`'s fast-forward, when the checkout has one: the build goes to a folder of its own and
208
+ replaces `dist/` only when it succeeds; a failed build leaves `dist/` as it was, and a linked worktree builds
209
+ nothing. Run main's cli as `node src/cli.ts` in briefs.
210
+
2183
211
  The cli gates itself with its own `dialecte.gate` (package.json). `--fast`: `check`, a scoped `tests` step
2184
- (`node src/scoped-tests.ts`: `vitest related` over the paths changed between the gate base and the tree that a
2185
- test can import, and an empty selection exits 0 without starting vitest) and a scoped `rules` step on the same
2186
- changed list. `--full`: the default full steps (`check`, `skills`, `build`, the whole suite), then `rules` on the
212
+ (`node src/scoped-tests.ts`: the test files vitest's import graph has the changed paths a test can import reach, run
213
+ with `vitest run <files>` (the graph read once with the package's vitest, `src/lib/gate/test-graph.ts`), and an empty selection exits 0 without starting vitest; a changed path no test can import - the
214
+ manifest, the entry, the vitest config, a setup file, a file a test reads - is left to the full suite on CI, said in
215
+ one line; so is the far reach of a shared file, one more than a quarter of the package's test files and more than 50
216
+ reach (the command map, `src/lib/git.ts`, `test/scratch-repository.ts`), named with its count: its direct tests and
217
+ the other changed files' tests still run) and a scoped `rules` step on the same changed list. Its commit hook (`dialecte.gate.hook`) runs `check`
218
+ and the scoped `rules` after the tdd receipts of the lot; the full suite runs on CI for every push. `--full`: the default full steps (`check`, `skills`, `build`, the whole suite), then `rules` on the
2187
219
  changes since the gate base. The suite's setup file also points `XDG_CONFIG_HOME` at a folder that does not exist
2188
220
  (no person's forbidden words list is read) and sets `DIALECTE_KEEP_AWAKE=0` (no run of the suite holds the machine
2189
221
  awake); a case that wants either sets it itself.