@dialecte/cli 0.0.3 → 0.2.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 +1042 -0
- package/dist/cli.js +33350 -571
- package/dist/ignorers.js +115 -0
- package/dist/lookups.d.ts +187 -0
- package/dist/lookups.js +1745 -0
- package/dist/tdd-reporter.js +39 -0
- package/package.json +32 -5
package/README.md
CHANGED
|
@@ -21,6 +21,31 @@ npm i -D @dialecte/cli # provides the `dialecte` binary
|
|
|
21
21
|
dialecte coverage # generate complete, schema-driven type-coverage probes
|
|
22
22
|
dialecte bench [--check] # measure the type-instantiation cost of your own types (library .d.ts skipped); --check gates CI
|
|
23
23
|
dialecte audit # render the public type surface and flag readability issues (C1–C6)
|
|
24
|
+
dialecte skills sync # install the agent skills your dependencies ship, for your agents
|
|
25
|
+
dialecte skills generate # refresh the generated blocks of this package's skills
|
|
26
|
+
dialecte skills check # fail on a skill citing what the code no longer has, or an undocumented public function
|
|
27
|
+
dialecte api find "<need>" # find a method by what you need
|
|
28
|
+
dialecte api show <path> # read one method's contract
|
|
29
|
+
dialecte members <expr> # what an expression of the live types holds
|
|
30
|
+
dialecte schema <Tag> # what an element may hold and where
|
|
31
|
+
dialecte models # which model each tier (fast, standard, strong, frontier) means for your vendor
|
|
32
|
+
dialecte doctor # versions, core API generation, skills and station agents in sync, local checkouts
|
|
33
|
+
dialecte rules # code-rules self-check of the changed files
|
|
34
|
+
dialecte gate [--full] # the package's Definition of Done, with the real counts
|
|
35
|
+
dialecte tdd red|green|status # receipts: each new test failed on an assertion before the code, then passed untouched
|
|
36
|
+
dialecte new verb <namespace> <query|transaction> <name>
|
|
37
|
+
dialecte handover <lots.json> # the guarded commit-by-lots hand-over a human runs (run, list)
|
|
38
|
+
dialecte handover --legend # every term of the hand-over card: what it means, whether to look
|
|
39
|
+
dialecte worktree add|prune # a worktree ready to work in (sibling links, node_modules checked); what a merge left behind
|
|
40
|
+
dialecte record review|decision|snapshot # a lot's findings ledger and round snapshots, in its hand-over folder
|
|
41
|
+
dialecte record choice <folder> --by <who> <decision> # a decision made outside the ledger, in decisions.md
|
|
42
|
+
dialecte recap <folder> # the pull request's expandable part, built from the hand-over's records only
|
|
43
|
+
dialecte mutants run|status|schedule|abandon|migrate|judge|record|drop # mutation testing of the declared scope; survivors tracked until handled
|
|
44
|
+
dialecte text check <file> # the human part of a GitHub text: its fixed headings and its word cap
|
|
45
|
+
dialecte review delta <folder> --round <n> # the fix diff since round n-1; --worktree: the old code to run a test on
|
|
46
|
+
dialecte run <script.ts> # run a script on an in-memory project of the installed dialecte: one structured outcome
|
|
47
|
+
dialecte fixture <Tag> # the smallest valid XML document holding an element, built by the dialecte's engine
|
|
48
|
+
dialecte explain <code> # what an error or diagnostic code means, when it is raised, the usual fix
|
|
24
49
|
dialecte --help
|
|
25
50
|
```
|
|
26
51
|
|
|
@@ -40,6 +65,1023 @@ Everything is overridable per `package.json` `"dialecte"` field (odd layouts) or
|
|
|
40
65
|
|
|
41
66
|
Env: `RUNS=5 dialecte bench` (repetitions kept as the min); `COVERAGE_CHILD_CAP=N` (cap child edges).
|
|
42
67
|
|
|
68
|
+
## Agent skills
|
|
69
|
+
|
|
70
|
+
Every Dialecte package ships the agent skills that describe it in `skills/<name>/SKILL.md` (open
|
|
71
|
+
[Agent Skills](https://agentskills.io) format), versioned with its code.
|
|
72
|
+
|
|
73
|
+
- **In an app**: `npx @dialecte/cli skills sync` links the skills of your `@dialecte/*` (and any other)
|
|
74
|
+
dependencies into `.claude/skills` and `.agents/skills` (Codex, Cursor, Gemini CLI, Copilot read the
|
|
75
|
+
latter; add `--agent copilot` for `.github/skills`). Links follow your installed versions; rerun after
|
|
76
|
+
adding a dependency. `--copy` writes copies instead of links.
|
|
77
|
+
- **Station agents (Claude Code)**: when Claude Code is a target (the default) and the project's model vendor
|
|
78
|
+
is anthropic, `skills sync` also writes one agent per station of `dialecte-lot` into
|
|
79
|
+
`.claude/agents/dialecte-<station>.md`: `implementer` and `fixer` (standard tier), `implementer-strong` and
|
|
80
|
+
`reviewer` (strong), `eval-runner` and `standard-reader` (standard), `grader` and `searcher` (fast). Each file
|
|
81
|
+
sets the model (from the `dialecte models` map, as the alias Claude Code accepts: `sonnet`, `opus`,
|
|
82
|
+
`haiku`) and the tools: the reviewer holds the read tools and Bash (it runs the tests) and no Write or Edit,
|
|
83
|
+
the searcher and the grader hold read tools only. The body is a few lines naming the station, the skills to
|
|
84
|
+
load and the never-list; it never copies a skill. The files are owned through the manifest: replaced on
|
|
85
|
+
every sync, removed when no longer produced, and a file of your own with the same name is reported, never
|
|
86
|
+
overwritten. `dialecte doctor` warns about a stale or missing one. Other hosts (Copilot / VS Code, Codex,
|
|
87
|
+
Gemini) get no agent files from this command yet: the tier of each station comes from `dialecte models`
|
|
88
|
+
there, as the `Tier:` line of a brief says.
|
|
89
|
+
- **Session-start check (Claude Code)**: `skills sync` adds a `SessionStart` hook running
|
|
90
|
+
`npx --no-install @dialecte/cli doctor --brief` (the installed cli: no download at a session start) to
|
|
91
|
+
`.claude/settings.json`, inserted by a minimal text edit (the rest of your file stays byte for byte), never
|
|
92
|
+
duplicated, removed when you drop the claude target. If you edited the hook's text since, removal cuts only
|
|
93
|
+
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`
|
|
94
|
+
is installed for Claude Code. `doctor --brief` prints nothing when the skills, the
|
|
95
|
+
versions and the station agents are in sync, otherwise one line per problem with its fix, and always exits 0.
|
|
96
|
+
`--no-session-check` leaves the hook out (and removes the one a sync added). Elsewhere, the `dialecte` skill
|
|
97
|
+
tells the agent to run `doctor` first.
|
|
98
|
+
- **Working on Dialecte**: `npx @dialecte/cli skills sync --from ../` takes them from your local checkouts.
|
|
99
|
+
- **In a package**: `dialecte skills generate` rewrites the `<!-- dialecte-skills:generated <kind> -->`
|
|
100
|
+
blocks (`extensions`, `core-methods`, `hooks`, `api`, `intents`) from the source; the `api` block lists
|
|
101
|
+
the methods, then one section per package entry (each `exports` subpath shipping a `.d.ts`) with the
|
|
102
|
+
functions it exports.
|
|
103
|
+
`dialecte skills check` verifies every API, path and npm script a page cites, and that every public
|
|
104
|
+
method and every function an entry exports (not `@internal`) has a JSDoc summary and an `@intent` tag; it warns when a summary or an
|
|
105
|
+
intent quotes a sentence, since the generated pages republish the JSDoc. A page about several
|
|
106
|
+
repositories declares `<!-- dialecte-skills workspace -->` and is fully verified with
|
|
107
|
+
`--workspace <folder>`; a deliberate outside mention goes in `<!-- dialecte-skills ignore: token -->`.
|
|
108
|
+
|
|
109
|
+
## Lookups for agents (and people)
|
|
110
|
+
|
|
111
|
+
Each answers in a few lines, the same with or without the Dialecte repositories, and takes `--json`.
|
|
112
|
+
Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage error.
|
|
113
|
+
|
|
114
|
+
- `dialecte api find "<need>" [--package <name>] [--limit 5]` searches the `api.json` every installed
|
|
115
|
+
package ships next to its skill's `api.md` (written by `skills generate`): one line per method - route,
|
|
116
|
+
`q | tx | doc | project | export`, the intent that matched, the package. Ranking, in order: how many words of the
|
|
117
|
+
need the method's `@intent` tags hold, then its summary, then its name - one intent word beats any number
|
|
118
|
+
of summary words; stop words dropped, word forms reduced to a light stem (`copied`, `copies`, `copying`
|
|
119
|
+
→ `copy`); ties put a dialecte's verb before core's, then sort by route.
|
|
120
|
+
- `dialecte api show <path>` (`info.of`, `doc.query.info.of`, `tx.reference.applyUuidRemap`): signature as
|
|
121
|
+
declared, summary, intents, other routes, where it is declared in its repository, and one call: the
|
|
122
|
+
method's JSDoc `@example` when it is short and calls the method, else a call from the test next to it
|
|
123
|
+
whose arguments a caller can copy (written-out values first; never a test case field, a fixture constant
|
|
124
|
+
or a cast). No such call, no example.
|
|
125
|
+
- `dialecte members <expression>` (`doc.query`, `doc.query.reference`, `tx.lifecycle.extract`): the
|
|
126
|
+
IntelliSense walk on demand, from the live types of the package where it runs. In an app, point it at
|
|
127
|
+
the namespace holding your project's types: `--namespace <Name> --entry <module>`.
|
|
128
|
+
- `dialecte schema <Tag> [--package <name>]`: parents, children in order with how often each may appear,
|
|
129
|
+
attributes (required, identity, default, fixed, enumeration, pattern), text, xsi:type variants - read
|
|
130
|
+
through the readers of the core each installed dialecte depends on (how often a child may appear is core's
|
|
131
|
+
`childOccurrences`). An unknown tag answers the closest; a dialecte not built is reported as skipped.
|
|
132
|
+
- `dialecte doctor`: installed `@dialecte/*` versions, the core API generation of each dialecte (read from
|
|
133
|
+
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
|
|
134
|
+
another version than the one installed - linked skills follow node_modules), local checkouts (siblings,
|
|
135
|
+
`$DIALECTE_ROOT`); each warning with the one command that fixes it.
|
|
136
|
+
|
|
137
|
+
- `dialecte models [--vendor <id>] [--json]`: the model each tier means for the vendor the project uses
|
|
138
|
+
(`anthropic`, `openai`, `google`), one line per tier, the date the rows were checked and what each tier
|
|
139
|
+
is for. Agents name a tier (`standard`) and ask this command which model that is. The vendor is the one
|
|
140
|
+
`dialecte skills sync` remembered as `vendor` in `.dialecte-skills.json`, in every skill folder of the
|
|
141
|
+
project. Sync detects it from the project (`.claude/`, `AGENTS.md` + `.codex/`, `.gemini/`; a folder holding
|
|
142
|
+
only the skills a sync wrote is no evidence) and asks on a terminal when several agents, a multi-vendor host
|
|
143
|
+
(Copilot, Cursor) or none are found. Without a terminal, a first sync that cannot tell (no manifest, nothing detected) exits 2 naming
|
|
144
|
+
`--vendor <id>`, which also sets it without asking; a project that already has a manifest and an ambiguous
|
|
145
|
+
or empty detection keeps syncing without a vendor and is told how to set it. When manifests disagree, `models` warns on stderr, naming them, and uses the
|
|
146
|
+
most recently written; an unknown vendor id in a manifest is ignored with a warning. Exit 1 for an unknown
|
|
147
|
+
`--vendor`, 2 when no vendor is known.
|
|
148
|
+
|
|
149
|
+
Run outside a package (no `package.json`), each answers a usage error.
|
|
150
|
+
|
|
151
|
+
## MCP server
|
|
152
|
+
|
|
153
|
+
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`.
|
|
154
|
+
|
|
155
|
+
## Contributing to a Dialecte package
|
|
156
|
+
|
|
157
|
+
Eleven commands for whoever changes a Dialecte package, a person or an agent. Each answers the same way
|
|
158
|
+
every time: exit 0 when green, 1 when a check fails, 2 on a usage error; `--json` where a program reads
|
|
159
|
+
the answer.
|
|
160
|
+
|
|
161
|
+
- `dialecte rules [<files...>] [--json]` checks the code rules on the syntax tree of the changed files
|
|
162
|
+
(or the files given): exported types outside a `*.types.ts` file, module constants outside a
|
|
163
|
+
`*.constants.ts` file, functions declared as `const`, an `await` inside an argument, plan tags and
|
|
164
|
+
standard citations are errors, and so is a test that takes the system's temporary folder itself as
|
|
165
|
+
its root (`tmpdir()` handed to a call that lists or scans a folder, or given as `root` / `cwd` /
|
|
166
|
+
`scratchRoot`...: other tests and processes share it; `mkdtempSync(join(tmpdir(), '<prefix>-'))`
|
|
167
|
+
gives the test a folder of its own); positional parameters (beyond a leading `query` / `tx`, a
|
|
168
|
+
symmetric pair aside) and abbreviated names are warnings. Without file arguments it records its result
|
|
169
|
+
in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the files, the errors
|
|
170
|
+
and warnings), which the hand-over card reads; a run on named files records nothing.
|
|
171
|
+
- `dialecte gate [--fast | --full] [--base <ref>] [--no-reuse] [--declare <path>]... [--json]` runs the Definition of Done: `--fast` (default) `check`,
|
|
172
|
+
`skills:check` and the tests of the changed files; `--full` adds `build`, the whole suite (the runner's
|
|
173
|
+
defaults: every file in parallel), `doc:build` and `type-bench:check`. Each step runs unfiltered, with
|
|
174
|
+
`GIT_OPTIONAL_LOCKS=0` (a `git status` inside it never takes the index lock), and is judged on its exit
|
|
175
|
+
code and on the counts it printed: a step exiting non-zero fails whatever it says, a test step that
|
|
176
|
+
counts no test fails - except `--fast` on a change that touches no test (a doc edit): the changed-tests
|
|
177
|
+
step passes with the note "no test file is affected by the change". A step whose npm script the package lacks is skipped. While a hand-over
|
|
178
|
+
holds the repository (`dialecte handover <lots.json>` wrote its lock), the gate runs only under the
|
|
179
|
+
hand-over written for this repository - the script the lock names exists and the `lots.json` beside it
|
|
180
|
+
names this repository, real paths compared - and says so in one line with the command that refreshes
|
|
181
|
+
the hand-over once the gate is green (`dialecte handover <lots.json> --rehash`): an author re-gates
|
|
182
|
+
after a late edit without touching the lock. It refuses under a hand-over of another repository, a
|
|
183
|
+
script that is gone, a folder without a lots file, and while a real `handover run` of that folder is
|
|
184
|
+
in progress (its `running.json` names a live process; that refusal names the marker file, in the
|
|
185
|
+
hand-over folder, so a person can tell a pid reused by another process). A refusal names the script and the lock and
|
|
186
|
+
says what to do: run the hand-over first (its last commit releases the lock), or hand the lock's path
|
|
187
|
+
to the person who runs the repository, who decides. A run that reaches its steps records its result in the
|
|
188
|
+
worktree's git folder, `dialecte-gate-fast.json` or `dialecte-gate-full.json`: when it ran, HEAD, the
|
|
189
|
+
state hash and each step (the tdd step first) with its status, its counts and its note or reason, the
|
|
190
|
+
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
|
|
191
|
+
worktree would commit (HEAD's tree with the changed and untracked files on top, the deleted ones
|
|
192
|
+
removed, `.dialecte/` left out): committing the lots leaves it the same, any other edit changes it.
|
|
193
|
+
The record also holds its `key`, what the run checked: `tree` (the git tree id the state hash is the
|
|
194
|
+
sha256 of), `lockHash` (sha256 of `node_modules/.package-lock.json`, what npm installed; `none` without
|
|
195
|
+
it), `commandHash` (sha256 of the steps' names and commands in order, and HEAD's commit when a step
|
|
196
|
+
runs only the tests the change affects, which depend on the diff against HEAD; `--base` is no part of
|
|
197
|
+
it: it reads the `tdd` step only) and `linked` (sha256 over the package's `file:` dependencies as node
|
|
198
|
+
loads them - the folder `node_modules/<name>` links to, else the path package.json names - each file
|
|
199
|
+
they publish, their package.json and the paths of its `files`, with its path, size and modification
|
|
200
|
+
time; an exclusion (`!…`) is left out and a glob is walked from the folder before its wildcard, a
|
|
201
|
+
superset of what npm packs; a dependency without package.json or `files` is taken whole;
|
|
202
|
+
`node_modules` and `.git` are always left out). The key is taken before the steps and again after
|
|
203
|
+
them: when they differ (a step edited a file, an install or a rebuilt dependency during the run) the
|
|
204
|
+
record is written without a key, with the state hash of the tree the steps started on, and not stored;
|
|
205
|
+
the gate says so in one line before its verdict (`"stored": false` with `--json`). A run whose steps
|
|
206
|
+
ran is also stored by its tree in the repository's common git folder, `dialecte-checks/<tree>.json`
|
|
207
|
+
(`git rev-parse --git-common-dir`), which every worktree of the repository reads (the newest record
|
|
208
|
+
kept per mode and key). Before its steps, a gate looks there: a green record of the same mode and the
|
|
209
|
+
same key answers instead of running them -
|
|
210
|
+
`reused: gate --<mode> green on this tree at <time> (HEAD <sha>)`, the record's step lines, then
|
|
211
|
+
`gate --<mode>: green (reused)` (`"reused": true` with `--json`) - and the worktree's record is
|
|
212
|
+
written marked `reused` with the time and HEAD of the run it reuses. The hygiene and the `tdd` step
|
|
213
|
+
run every time: they are about the worktree (what is staged, the receipts, `.dialecte/lot.json`, the
|
|
214
|
+
base), not the tree, and a `tdd` step failing now is a failed gate. A record that failed, that ran no
|
|
215
|
+
step, of another mode (`--fast` never answers `--full` nor the reverse) or written by an older cli
|
|
216
|
+
(no key) is never reused; a stored entry of another shape is ignored. A test step that passed only on its
|
|
217
|
+
serial rerun is green: it is reused with its `flaky in parallel` note. `--no-reuse` runs the steps
|
|
218
|
+
whatever the store holds. The key leaves out the Node version and the environment (a path given
|
|
219
|
+
through an environment variable); a `file:` dependency edited and restored to the same size within
|
|
220
|
+
the same modification time is not seen either.
|
|
221
|
+
- A running step looks running. Each `gate` step and `tdd`'s vitest run is announced before its work:
|
|
222
|
+
off a terminal a start line `▶ <step>` (then a line every 30 s of silence and the result), on a
|
|
223
|
+
terminal one spinner line `⠋ <step> - <what runs> <elapsed>` that the step's result line replaces (the
|
|
224
|
+
gate's summary then leaves out the lines already shown; off a terminal and with `--json` it keeps them).
|
|
225
|
+
A silent hook gets the waiting-for-input / watch-mode hint once, at 90 s of silence, on both. The
|
|
226
|
+
`handover` card is as wide as the terminal's columns, else `$COLUMNS`, else 80: the box is exactly that
|
|
227
|
+
wide and every line wraps inside it with a hanging indent under its text column, never into fewer
|
|
228
|
+
than 20 columns of text: a hang that would leave less is reduced; a commit line whose columns
|
|
229
|
+
(`<sha> <files> <+->`) leave its subject less puts the subject, and a merge lot's merge line, on their
|
|
230
|
+
own rows under it, 2 columns in; a line kept to one row with `…` is wrapped whole when its cut would
|
|
231
|
+
keep less; a word wider than the room after the hang (a long path) takes a row of its own, 2 columns
|
|
232
|
+
in. Colour only on a
|
|
233
|
+
terminal (and never with `NO_COLOR`); the `✓` `!` `✗` marks read the same without it. The command
|
|
234
|
+
follows the box whole on one line, to copy: `cd <folder> && bash commit.sh`, or
|
|
235
|
+
`node <this cli> handover run <folder>` when the repository's own cli does not answer
|
|
236
|
+
`handover run --probe` within 10 s. "This cli" is the script that runs: when it is a temporary one
|
|
237
|
+
(`npx` from the registry, `tsx` on the sources), install `@dialecte/cli` in the repository so the
|
|
238
|
+
card names its own bin.
|
|
239
|
+
- No runner hangs silently. Every child that `dialecte gate` (its steps), `tdd` (its vitest runs) and
|
|
240
|
+
`handover run` (each commit and its hooks, `--rehearse` too) start runs in a process group of its own,
|
|
241
|
+
with its stdin closed (a command that reads it, such as `grep` with no file, gets end-of-file at once),
|
|
242
|
+
and under a stall watchdog. Any output, a part of a line included, counts as activity; so does CPU time
|
|
243
|
+
gained by any process of the child's tree (its descendants and its process group, sampled with `ps`
|
|
244
|
+
every 5 s, macOS and Linux). After 10 minutes with neither, the tree is printed one line per process
|
|
245
|
+
(pid, state, CPU time, command), stopped (SIGTERM to the group and every pid, SIGKILL to what is left
|
|
246
|
+
after 2 s) and the run ends only once its processes are gone, as `stalled`: the gate's step fails with
|
|
247
|
+
`stalled: no output, no CPU for 10 m 0 s` and the tree in its tail, `tdd`'s run fails with the tree, a
|
|
248
|
+
hand-over lot is not committed and its files are unstaged (waiting a few seconds for a stopped git's
|
|
249
|
+
`index.lock`; when the lock stays, the run says the files are still staged, names the lock and says
|
|
250
|
+
to hand its path to the person who runs the repository, who decides once no git runs in it). A
|
|
251
|
+
`ps` that fails or times out gives no verdict on that sample; failing for the whole 10 minutes is a
|
|
252
|
+
stall of its own. Ctrl-C, SIGTERM or SIGHUP received by the cli is passed on to every running child's group.
|
|
253
|
+
A child that asks the terminal (a gpg or ssh passphrase prompt) runs in a background group: it
|
|
254
|
+
stops (state `T`) and is reported as stalled.
|
|
255
|
+
- `dialecte tdd red|green|status [<test file> | <test file>::<case name>]... [--base <ref>] [--json]` makes
|
|
256
|
+
the order of the work visible: tests written from the spec before any code, red for a real reason, then
|
|
257
|
+
made green by an implementation that did not touch them. The ledger lives in the worktree's git folder,
|
|
258
|
+
never in the tree. Runs use the package's own vitest (each project's run of a case is a case of its own),
|
|
259
|
+
with snapshots never written
|
|
260
|
+
(`--update=none`, CI): a snapshot test's snapshot is written by the test station before the red.
|
|
261
|
+
- `red` runs every case of the changed test files (or of the files named). A case that fails on an
|
|
262
|
+
assertion (a snapshot mismatch included), on a stub's error (a message starting with
|
|
263
|
+
`not implemented`) or on an error existing code throws, inside an `expect(...)` a matcher completes,
|
|
264
|
+
gets a red. Refused, each with its reason: a passing case that is new or changed ("it ran green: this
|
|
265
|
+
test proves nothing yet"); a passing case with a receipt whose own test call changed; a passing case
|
|
266
|
+
still waiting for its green whose test file, or test code it imports, changed since its red ("test
|
|
267
|
+
code changed since its red and it passes"); a failure on a missing export, a type or syntax error, a
|
|
268
|
+
timeout, a stub thrown at import or before the assertion; a file holding `.only` or `only: true`. A
|
|
269
|
+
case the same as at the base is marked unchanged; a case the lot accepts is marked accepted; a green
|
|
270
|
+
case whose test code changed around it is kept and flagged `test code changed around it` (the next
|
|
271
|
+
step adding a case to a green file); a case never proven green (only unchanged, accepted or revised)
|
|
272
|
+
is kept without a flag, and no receipt. A file with a refusal still records its other cases'
|
|
273
|
+
receipts, the refusals kept as evidence, but is not frozen: the gate fails on it until no case of
|
|
274
|
+
it is refused.
|
|
275
|
+
- A red records the case (file, full name, project), the hashes of its test file, of its own test call
|
|
276
|
+
and of the production files, the failing message and the time. It is flagged `rollback` at a
|
|
277
|
+
production state the case, or the lot, had already left: a production file moved back from the
|
|
278
|
+
newest content the lot reached to its content at the base or at an earlier receipt (the run prints
|
|
279
|
+
one `rollback:` line naming the files). The ledger keeps, per base and per production state a receipt
|
|
280
|
+
names, the content of each production file changed since that base. The receipts are walked in
|
|
281
|
+
order: a green, or a receipt at a state moving nothing back, makes its state's contents the newest; a
|
|
282
|
+
put back only reds, refusals or unchanged receipts saw stays put back and adds no content, so a
|
|
283
|
+
later red there is flagged again, a restore is not, and a step a green proved (an experiment undone
|
|
284
|
+
and kept) is the new newest. A green run taken at code put back still makes its state the newest;
|
|
285
|
+
its receipts are flagged `rollback`, with the same line, only when a case the run proves had no
|
|
286
|
+
green receipt before (of the same file, name, project and test call; a refused run is no green, an
|
|
287
|
+
earlier green counts whatever its flags): a refactor that keeps proven cases green (drops a file the
|
|
288
|
+
lot added, puts a file back to its content at the base) is not flagged, a green run proving a case
|
|
289
|
+
for the first time there is. Content the refactor
|
|
290
|
+
moved away stays reached: bringing it back later flags the reds and the first greens taken there.
|
|
291
|
+
A state read at another
|
|
292
|
+
base, a lot committed since, is not compared;
|
|
293
|
+
`red after green` when the case's own last receipt is a green at the same production state.
|
|
294
|
+
- The run freezes each test file without a refusal, and a changed helper, fixture or snapshot only when
|
|
295
|
+
a case of a file depending on it went red, or was recorded revised, in that run: what it imports
|
|
296
|
+
(relative, tsconfig `paths` or vite alias, barrels and re-exports followed through test code; a
|
|
297
|
+
package name is a dependency, not test code), a changed file whose name its test code mentions, or
|
|
298
|
+
the text of a production module its test code imports directly (a constant naming a fixture; one hop
|
|
299
|
+
into production, never further, and the module itself is production), its own snapshot. Every
|
|
300
|
+
dependency found by import is followed in turn, and one found by a name written with its folder
|
|
301
|
+
(`fixtures/scan.ts`, a full path): it brings the files it imports (`import type` included). A bare
|
|
302
|
+
file name (`index.ts`) may be another file: the changed file it names is a dependency, not followed. A
|
|
303
|
+
helper no red covers stays unfrozen, and the gate fails on it, unless a `revised` entry names it
|
|
304
|
+
(below). An import that looks local (`@/`, `~/`,
|
|
305
|
+
`#`, a `paths` or alias prefix) and resolves nowhere refuses its file, naming the import.
|
|
306
|
+
- `green` runs the changed test files: each case needs a red receipt, its file, its test call and its
|
|
307
|
+
test code as frozen, production changed since its red ("nothing in production changed since red"),
|
|
308
|
+
and a pass.
|
|
309
|
+
- `status` prints each case (red, green, unchanged, accepted, missing receipt, test edited after red,
|
|
310
|
+
with its flags), the test code changed outside `tdd red`, and the cases the change deletes. A test
|
|
311
|
+
call of the base gone without a title (an `it(name, ...)` whose title is a variable: an edited call
|
|
312
|
+
looks deleted) prints `deleted <file> a test call of the base is gone`; when a `gone` entry of
|
|
313
|
+
`.dialecte/lot.json` names its file (a path or a glob), it prints
|
|
314
|
+
`gone <file> a test call of the base is gone (<reason>)` instead, in the gate's details too. A titled
|
|
315
|
+
test gone and a deleted test file stay `deleted`. A ledger that cannot be read is refused with its
|
|
316
|
+
path.
|
|
317
|
+
- `status --flags` prints only the cases whose receipts carry a flag, with their flags.
|
|
318
|
+
- `status --legend` prints the tdd terms of the hand-over card, each in two lines: what it means, and
|
|
319
|
+
whether to look. It needs no package: it works from any folder.
|
|
320
|
+
- The lot is the uncommitted work: the change is measured from HEAD, so the cases of lots already
|
|
321
|
+
committed on the branch are not asked again. `--base <ref>` (`tdd` and `gate`) gives the
|
|
322
|
+
whole-branch view; `gate --full` measures from where the branch left its base branch.
|
|
323
|
+
- Test code is compared by the leaves of the parser's syntax tree, each file parsed by its extension
|
|
324
|
+
(a `.ts` file is no TSX): whitespace, comments (except the ones a tool reads:
|
|
325
|
+
`@vitest-environment`, `@jest-environment`, `@vite-ignore`), quote style, statement semicolons,
|
|
326
|
+
trailing commas after an element and the order of import statements between side-effect imports
|
|
327
|
+
are formatting (a formatter pass needs no new red); template literals count by their raw text; any
|
|
328
|
+
other edit is a change. The receipts are a version-3 ledger: an older one is refused, to be moved
|
|
329
|
+
aside. A repository without a commit is refused in one line.
|
|
330
|
+
- A package whose test entry is production code declares it:
|
|
331
|
+
`"dialecte": { "tdd": { "production": ["src/test"] } }`; the test files, fixtures, snapshots and
|
|
332
|
+
`*.script.ts` under such a folder stay test code. `testCase.only ? it.only : it` is no focus marker.
|
|
333
|
+
- A case edited at review after it was proven is declared in `.dialecte/lot.json`
|
|
334
|
+
(`"revised": [{ "case": "<file>::<name>", "reason": "<why>" }]`). It needs an earlier receipt of
|
|
335
|
+
the case (a red, an unchanged, an accepted one), not necessarily a red, or to be a case of the base:
|
|
336
|
+
its file exists at the base, every title of its name written as a string now is written there too,
|
|
337
|
+
and, when its own title is the literal title of an `it` / `test` call at the base or now, the base
|
|
338
|
+
holds such a call with its describe path (a computed describe title, a `describe.each` /
|
|
339
|
+
`describe.for` format, matches any; a `describe.skipIf` / `describe.runIf` suite counts by its
|
|
340
|
+
title) and the file now no more of them (a test moved to another describe, or a string of that title
|
|
341
|
+
removed elsewhere, is no proof); otherwise (a table row, a computed title) its own title is written
|
|
342
|
+
as a string there and no more times now. A new case (a new file, a new title, a row added to a table)
|
|
343
|
+
still needs a red; a case whose title the file computes and the base does not write is refused
|
|
344
|
+
("not provably a case of the base: accept it or prove it red"). The `case` may also be a file path or
|
|
345
|
+
a glob over file paths (`scripts/**/*.test.ts`: `**` any folders, `*` and `?` within one), relative
|
|
346
|
+
to the package root, without `::`: it applies to every case of the matching files, with one reason.
|
|
347
|
+
A file or glob entry never covers a case whose last proof is a red still waiting for its green, and
|
|
348
|
+
keeps the `red after green` flag of a case made red again; an exact entry covers both. An `accept`
|
|
349
|
+
entry stays one exact case. The next `tdd red` records it as revised when it passes (a
|
|
350
|
+
red when it fails) and freezes its file and the changed test code it depends on. A file or glob entry
|
|
351
|
+
may also name a test helper (test code that is not a test file: a helper, a fixture, a constant beside
|
|
352
|
+
the tests) edited at review while its dependent cases stay green: the next `tdd red` freezes it at its
|
|
353
|
+
new hash and prints `revised <helper> <reason>`, when every changed test file depending on it (at
|
|
354
|
+
least one) is in the run and frozen by it with no case red (a refused file, a red still waiting for
|
|
355
|
+
its green, or no dependent file in the run leaves it unfrozen; a changed dependent outside a targeted
|
|
356
|
+
run too, named on an `unfrozen <helper>` line). The new freeze makes the dependent
|
|
357
|
+
cases' earlier green stale: `tdd green` proves them again. Without that red run the gate fails on the
|
|
358
|
+
edit; `status` lists the revised cases, the gate and the hand-over card list the revisions (cases
|
|
359
|
+
and helpers) with their reason, an entry (exact, file or glob) no revised case or helper used as a
|
|
360
|
+
note.
|
|
361
|
+
- What it cannot see: the receipts can be written by an agent with a shell; a deliberate throw in
|
|
362
|
+
production looks like a stub; code written first, hidden, then a red taken at the base state, cannot
|
|
363
|
+
be told from an honest red (at the first step the red's production is the base's). The flags and the
|
|
364
|
+
refusals make the rest visible; the review reads the diff.
|
|
365
|
+
- `dialecte new verb <namespace> <query|transaction> <name> [--version <v>]` writes a verb of a dialecte
|
|
366
|
+
package in the house style: the function (query or transaction first, one params object), its
|
|
367
|
+
`.types.ts`, a table-driven test with one red case (no `only`: `tdd red` refuses a focus marker; while
|
|
368
|
+
iterating, run the case with `npx vitest run <file> -t "<case>"`), its barrel export and, for a new
|
|
369
|
+
namespace, the namespace module and its registration. Its JSDoc summary and `@intent` start with
|
|
370
|
+
`FILL:`, which `skills check` refuses until written; the command prints every placeholder left.
|
|
371
|
+
- `dialecte handover <lots.json> [--out <dir>] [--rehash] [--json]` prepares the commit-by-lots
|
|
372
|
+
hand-over a human runs. The lots file names the repository, the branch and HEAD expected, and the lots
|
|
373
|
+
(paths, message):
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"repository": "/path/to/the/repository",
|
|
378
|
+
"branch": "feat/names",
|
|
379
|
+
"head": "d4b1c04",
|
|
380
|
+
"gates": "the scl cases need DIALECTE_SCL_DIR: skipped here",
|
|
381
|
+
"lots": [
|
|
382
|
+
{ "paths": ["src/names/"], "message": "feat(names): names stay unique among siblings" },
|
|
383
|
+
{ "paths": ["CHANGELOG.md"], "message": "docs(changelog): unique names" }
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
`gates` is optional free text, the caveats for the person about to run the hand-over: the cards printed
|
|
389
|
+
before a run (this one, a rehearsal's) show it as their notes; the card a real run prints after it has
|
|
390
|
+
none. The card reads the gates from their records.
|
|
391
|
+
It refuses (and writes nothing) when the branch or HEAD differ, `core.hooksPath` names a folder that
|
|
392
|
+
does not exist (git would skip every hook; it says how to restore it), something is staged, a changed
|
|
393
|
+
file is in no lot or in two, or a lot file (evals included) or message holds a plan tag or a standard
|
|
394
|
+
citation. Otherwise it writes the hand-over folder - the lots file, the snapshot (`files.txt`,
|
|
395
|
+
`files.sha256`, `files.deleted`, and `lots.sha256`: the lots file as reviewed) and a one-line
|
|
396
|
+
`commit.sh` that runs
|
|
397
|
+
`npx --no-install @dialecte/cli handover run <folder>` (bash, also run with `sh`; when the repository
|
|
398
|
+
installs no cli that can, it says so in one line with the fix) - and prints the hand-over card, the
|
|
399
|
+
command with its absolute `cd` under it. `--json` answers the card as data: the verdict, `failedGates`,
|
|
400
|
+
`otherTreeGates`, `declarations` (the entries to read), `gates` (the gate lines: name, status, detail),
|
|
401
|
+
`tdd` (the tdd lines as the text a person reads, no layout and no padding), `notes`, and each lot with
|
|
402
|
+
`pending` until it is committed. Edited a file after the review? `--rehash` (also after
|
|
403
|
+
editing `lots.json`). The repository stays held until every lot is committed: `dialecte gate` runs
|
|
404
|
+
only under this hand-over (see `gate`), and a hand-over of another folder is refused, naming the script
|
|
405
|
+
that holds the repository and its lock.
|
|
406
|
+
|
|
407
|
+
- The hand-over card is what a person reads before running the hand-over, and again at its end. Its title
|
|
408
|
+
is `hand-over: <repository folder> <branch>`; the repository and worktree paths are not in it. Its
|
|
409
|
+
first line is the verdict: `READY` when no gate line failed and none ran on another tree, `BLOCKED` with
|
|
410
|
+
`<n> gates failed: <names>` and `gates ran on another tree: <names>`, `DONE` once a real run committed
|
|
411
|
+
every lot; then the lots, files and `+<added> −<removed>` (`all gates green` when nothing blocks), and
|
|
412
|
+
`<n> declarations to read (below)` on a second line. Its sections:
|
|
413
|
+
- `commit`: one line per lot - its sha, or `pending`; its files, lines added and removed, and subject. A
|
|
414
|
+
merge lot's line follows (`merge <branch> at <tip> · <n> conflicts · tree <sha>`, or
|
|
415
|
+
`tree not recorded: rehearse first`); a merge lot is sized from the tree it was trial-merged on to
|
|
416
|
+
the tree a rehearsal recorded, else says `size after rehearse`. Then `HEAD <sha>`, after a run
|
|
417
|
+
`HEAD <base> → <tip> · nothing pushed`.
|
|
418
|
+
- `gates`: one line per gate step from the gate records (the latest record of each step over `--fast`,
|
|
419
|
+
`--full` and the commit hook's record, a line of the hook's ending with `commit hook`:
|
|
420
|
+
`✓ test:run 1214/1214 · commit hook`; a gate record newer than the hook's replaces its lines whole,
|
|
421
|
+
since the hook names its own scripts, not the gate's steps), then `rules` from its record, then
|
|
422
|
+
`mutation` when the package declares a mutation scope (below), then
|
|
423
|
+
`review` from the hand-over folder's findings ledger and `round-<n>/` snapshots. `✓` passed; `!` to
|
|
424
|
+
look at (a step not run here, with its reason, or not run after a failure; `rules` never run; no
|
|
425
|
+
findings ledger, or one holding no row yet: `no findings recorded`; only nits open); `✗` failed (a
|
|
426
|
+
failed step,
|
|
427
|
+
a rules error, a blocking or should-fix finding open, `gate never run on this tree` when there is no
|
|
428
|
+
record). The records read are the worktree's last runs and the store's records of the tree the
|
|
429
|
+
hand-over commits - the worktree's tree, or for a hand-over holding a merge lot the tree its last lot
|
|
430
|
+
leaves (the trial merge with its resolutions) - the newest record of each step winning; a tdd step
|
|
431
|
+
another worktree recorded is left out (its verdict is that worktree's), and a stored record counts
|
|
432
|
+
only when it ran against what is installed here now (the same `node_modules` and `file:`
|
|
433
|
+
dependencies) with the command of its mode now. A line from a record made at a commit outside the
|
|
434
|
+
history of HEAD ends `· from <sha>` (the branch commit's hook record read for a merge on main; a
|
|
435
|
+
record of an earlier commit of this line carries none), a rehearsal's record `· rehearsal`. A record
|
|
436
|
+
of another tree than the one checked ends with `(the tree changed since)`: its line turns `!` and
|
|
437
|
+
blocks the hand-over; a failed step stays `✗`.
|
|
438
|
+
The `mutation` line is what the package still owes its mutation runs, read from the mutation store when
|
|
439
|
+
the card is written. `✗` (blocks): `new` survivors or died runs of the package, whatever their lot
|
|
440
|
+
(`2 new survivors · 1 died run: dialecte mutants status`); a run of the branch still running when the
|
|
441
|
+
hand-over merges a branch (`run <id> still running (pid <pid>): the merge waits for it`, a run of a
|
|
442
|
+
merged branch too) or when the lot's mutation switch is `gate` (`...: a gate lot waits for it`); a gate
|
|
443
|
+
lot with no run of its branch (or a merged one) reported on the tree the hand-over commits
|
|
444
|
+
(`gate lot: run dialecte mutants run on this tree first`); an invalid `dialecte.mutation` or lot switch,
|
|
445
|
+
with its reason. `!` (does not block): a run of the branch still running on a plain hand-over
|
|
446
|
+
(`...: its survivors are not in yet`). Otherwise `✓ mutation nothing pending`. To unblock: kill each
|
|
447
|
+
survivor with a test, record its reason
|
|
448
|
+
(`dialecte mutants record --key <key> --family <family> --reason <why>`), or
|
|
449
|
+
`dialecte mutants schedule <follow-up> <key>`; rerun a died run or `dialecte mutants abandon <run id>`;
|
|
450
|
+
wait for a running run; run `dialecte mutants run` on the tree for a gate lot. The switch is the
|
|
451
|
+
hand-over folder's `lot.json` when it holds one, else `.dialecte/lot.json`.
|
|
452
|
+
- `tdd`: the lot's exemption; only the cases of the change count, those the gate's tdd step listed on
|
|
453
|
+
this tree (a retitled or removed case's receipts are not counted under the old title); without a gate
|
|
454
|
+
record of this tree that lists them, one line `counts from the last gate: run the gate on this tree`
|
|
455
|
+
replaces the counts, groups, entries and flags; each case counted once by the status the gate gave
|
|
456
|
+
it (red then green as proven, kept when its last receipt is a kept after a green; accepted and
|
|
457
|
+
revised only in their groups)
|
|
458
|
+
(`<n> proven red → green · <m> unchanged`, and `· <k> kept` when any); the accepted cases: a head
|
|
459
|
+
line `<n> accepted`, then one row per reason of the lot file (`<count> <reason>`, the largest group
|
|
460
|
+
first, a tie in the lot file's order, each reason wrapped under itself); the accepted and revised receipts
|
|
461
|
+
of earlier lots, which the lot file no longer names, on one line
|
|
462
|
+
(`earlier lots: 410 accepted, 12 revised (not in the lot file)`); then
|
|
463
|
+
`<n> revised · <m> gone · <k> unused` with `to read ↓` at its right edge and one entry each: a revised case `<file> › <title>` (named by the lot file exactly, or by a file or glob entry)
|
|
464
|
+
with its reason under it, a helper a red run froze for a `revised` entry as `revised <helper>` with its
|
|
465
|
+
reason under it, a `gone` entry with its reason (whether one covers a finding is the gate's
|
|
466
|
+
to say), an `accept` or `revised` entry no case used. Then one line per kind of flag with its count of
|
|
467
|
+
cases (`dialecte tdd status --flags` lists them); cases whose only flag is `test code changed around it`
|
|
468
|
+
and whose receipts are otherwise only unchanged are counted apart (a case flagged rollback or red after
|
|
469
|
+
green never is), as
|
|
470
|
+
`helper code changed near unchanged cases (noise)`.
|
|
471
|
+
- `notes`: the lots file's `gates` text, as written; only on the cards printed before a run (the
|
|
472
|
+
written card, a rehearsal's), never on the card after a real run.
|
|
473
|
+
|
|
474
|
+
Its closing rule reads `dialecte handover --legend · details: dialecte tdd status` (in a box too narrow
|
|
475
|
+
for it, that text is printed inside, above a plain closing rule). The command stays
|
|
476
|
+
under the box until every lot is committed. `dialecte handover --legend` prints every term the card can
|
|
477
|
+
print, each in two lines: what it means, and whether to look.
|
|
478
|
+
|
|
479
|
+
- `dialecte handover run <folder>` is what `commit.sh` runs. Each guard prints one line with its result
|
|
480
|
+
and its time (`✓ snapshot 110 file(s) 0.4 s`): repository, the lots file as reviewed, hooks
|
|
481
|
+
folder, branch, HEAD, empty index, the files against the snapshot, deleted files, files outside the
|
|
482
|
+
lots, plan tags and citations, and last `mutation`: the card's `mutation` verdict computed again when the
|
|
483
|
+
guard runs (never taken from the card), so a run that reported a survivor, or died, after the card was
|
|
484
|
+
written refuses the run with exit 1 and nothing committed (`✗ mutation <detail>`, each survivor and died
|
|
485
|
+
run indented under it, then what to do with each); a run still running on a plain hand-over passes with
|
|
486
|
+
its warning; `✓ mutation no mutation scope declared` for a package without one. A rehearsal runs the
|
|
487
|
+
same guard. When the staged files are exactly the next lot's (a run stopped after
|
|
488
|
+
staging it), the index guard prints the command that unstages them, with its `cd`.
|
|
489
|
+
Then each lot announced before its work: off a terminal `▶ lot n/N` with its files and subject, and a
|
|
490
|
+
line every 30 s in which nothing of the lot was shown (`… <lot> running 2 m 10 s`: hook lines the view
|
|
491
|
+
leaves out do not count); on a terminal one spinner line naming the lot,
|
|
492
|
+
what runs and the time. The commit's hook output is read as steps, from npm's script headers: a script
|
|
493
|
+
that runs others (`npm run`, `run-p`, `run-s`, `npm-run-all`) is their parent, and the lines of the
|
|
494
|
+
scripts a parent runs in parallel stay the parent's. While the hook runs, only the current step and the
|
|
495
|
+
warning and error lines show (lint, format, type-check and build warnings and errors, failing tests),
|
|
496
|
+
each labelled by the step that printed it (`[lint:check] <line>`): on a terminal the step with its
|
|
497
|
+
elapsed time and those lines live under the spinner, off one `│ ▶ <step>` per step and those lines
|
|
498
|
+
behind `│`. A test step (a `test` segment in its name: `test`, `test:run`, `unit:test`; or a test
|
|
499
|
+
runner on its command line: `vitest`, `jest`, `node --test`) shows its failing tests and failed scripts
|
|
500
|
+
only: the warnings its tests print are theirs, not the repository's. A line its step printed already
|
|
501
|
+
(the same text: Vite's `configLoader` notice, 2-3 times per build) is not a new line: on a terminal
|
|
502
|
+
the first one carries the count, `<line> (×3)`, updated in place; off a terminal (a log) a line is
|
|
503
|
+
written as it is read, its identical repeats right after it are counted, and when that run of repeats
|
|
504
|
+
ends (another warning or error line, the next step, the hook's end) a run of two or more is written
|
|
505
|
+
again as `<line> (×<n>)`. Lines of different steps never merge. Every byte goes to the hook's full
|
|
506
|
+
log as it comes. After a passing hook, one summary line
|
|
507
|
+
(`check ✓ · test:run ✓ 1214 · build ✓ · 1 lint warning in lint:check`: the scripts the hook runs, a
|
|
508
|
+
script they run only when it printed counts or failed; the warnings counted per step and kind, in the
|
|
509
|
+
order first printed, each distinct line once: the same text printed again in its step counts once),
|
|
510
|
+
the labelled warning lines (each once, where it was first printed, with its step's total as
|
|
511
|
+
`(×<n>)` from 2) and `full log: <path>`; after a failing hook, the
|
|
512
|
+
summary with `✗`, the labelled error lines not among the failing step's last 30 lines (each once, with
|
|
513
|
+
its count), those 30 lines
|
|
514
|
+
and the log's path. A hook that ended (passed or failed; not one stopped as stalled) is recorded in
|
|
515
|
+
the git folder of the repository it committed in (`dialecte-gate-hook.json`, mode `hook`): HEAD after
|
|
516
|
+
it (the new commit, or the base when it failed), the state hash of the tree before the commit and the
|
|
517
|
+
steps its summary names with their status and counts; the card reads it with the gate records, so a
|
|
518
|
+
lot committed where no `dialecte gate` ran still shows its gates, until a newer gate record replaces
|
|
519
|
+
it. The record holds its key too (the tree the hook ran on, what npm installed, the `file:` dependencies,
|
|
520
|
+
and for `commandHash` the hook files git runs: husky's `.husky/<hook>` scripts, else the hooks folder's
|
|
521
|
+
executable files) and goes to the repository's store of records by tree. A rehearsal writes it in its
|
|
522
|
+
scratch clone's git folder and in the repository's store, marked `origin: "rehearsal"`, never in the
|
|
523
|
+
repository's own `dialecte-gate-hook.json`. A hook that prints nothing gets `hook ✓` (or
|
|
524
|
+
`hook ✗`) and the log's path; a repository with no commit hook prints none of it (in husky's `.husky/_`,
|
|
525
|
+
which holds a wrapper for every hook name, a hook counts only when its script exists in `.husky/`). Then the commit with
|
|
526
|
+
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
|
|
527
|
+
finds the lots already committed on top of the recorded HEAD (same message, same paths, same content)
|
|
528
|
+
and resumes at the next one; anything else on top of HEAD is refused with what was found. It never
|
|
529
|
+
pushes. `--rehearse` first decides, per lot and before any clone, whether rehearsing it can find
|
|
530
|
+
something new, and prints one line per lot: `lot <n>/<N> reused <reason>` or
|
|
531
|
+
`lot <n>/<N> rehearse <reason>`. A plain lot is reused when the store holds a green `gate --full` of
|
|
532
|
+
the tree its commit will hold (HEAD with every lot up to it on top) with the key of now - the same
|
|
533
|
+
`node_modules`, `file:` dependencies and `--full` steps - the lot does not change `package-lock.json`,
|
|
534
|
+
and the commit hook stages no files of its own (its text names `git add`, `git stage`, `lint-staged` or
|
|
535
|
+
`git update-index`): `green gate --full on tree <tree>`. A merge lot is reused when the tree it leaves
|
|
536
|
+
(its trial merge with its resolutions) is its tip's tree and a green record of that tree - the branch
|
|
537
|
+
commit's hook record or a `gate --full`, with the key of now - is in the store, under the same
|
|
538
|
+
conditions: `green hook record of the tip's tree <tree>`. Otherwise the line says the first reason that
|
|
539
|
+
holds: `no green gate --full on tree <tree>`, `the lot changes package-lock.json`,
|
|
540
|
+
`the hook stages files (<match>)`, `node_modules changed since the record`,
|
|
541
|
+
`a linked dependency changed since the record`,
|
|
542
|
+
`<branch> moved: the merge leaves tree <tree>, the tip holds <tree>` (`<branch>` the one the hand-over
|
|
543
|
+
commits on: `main moved: ...`), `no green record of the tip's tree <tree>`; `--rehearse --full`
|
|
544
|
+
rehearses every lot (`--full`). The decisions go to `rehearsal.json` in the hand-over folder
|
|
545
|
+
(when, and per lot its tree, `reused` or `rehearsed`, the reason and the record reused: mode, time,
|
|
546
|
+
HEAD). When every lot is reused no clone is made: the guards, a reused merge's `tree <sha>`, then
|
|
547
|
+
`rehearsal skipped: every lot's tree has a green record` and the card. Otherwise the clone is made and
|
|
548
|
+
the reused lots are committed in it with `--no-verify` (their hook skipped, in the clone only), the
|
|
549
|
+
others with their hook. A real run (no `--rehearse`) runs every commit's hook, whatever the store holds.
|
|
550
|
+
The rehearsal clone (`▶ rehearsal clone`) warns naming the untracked files outside
|
|
551
|
+
`.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
|
|
552
|
+
HEAD, your working tree on top, the hooks folder, a copy-on-write copy of `node_modules` - so the hooks
|
|
553
|
+
run as they will for real. The clone sits in a rehearsal folder under a short root, `/tmp` on macOS
|
|
554
|
+
and Linux (the system's temporary folder on Windows):
|
|
555
|
+
`/tmp/dialecte-rehearse-<random>/<repository folder name>`, so a tool's socket under the hook's
|
|
556
|
+
temporary folder stays within the system's path limit; the hook runs with `TMPDIR` set to a folder
|
|
557
|
+
inside the rehearsal folder. Beside the clone, a link per relative `file:` / `link:` dependency of the
|
|
558
|
+
repository's package.json that leaves the repository, to the folder the same path reaches from the
|
|
559
|
+
repository (`file:../core`: `<rehearsal folder>/core` -> the repository's `../core`), so the clone
|
|
560
|
+
resolves it as the checkout does; one line names the links, and a path that leaves the rehearsal
|
|
561
|
+
folder too, or whose target is missing, is not linked (a line says why). The whole rehearsal folder is
|
|
562
|
+
removed at the end - its links unlinked, never what they reach - (`--keep` keeps it and names it:
|
|
563
|
+
`kept the rehearsal folder: <path>`), and on Ctrl-C or SIGTERM, with the hook and every process it
|
|
564
|
+
started stopped. The clone's git folder holds a marker naming the process that made it
|
|
565
|
+
(`dialecte-rehearsal.json`). A real run marks its hand-over folder with `running.json` (its pid and
|
|
566
|
+
start time) while it runs, removed at its end, on a failure, and on Ctrl-C, SIGTERM or SIGHUP received
|
|
567
|
+
while a commit (its hook) or an install runs; a run stopped at another moment leaves it, and a marker whose
|
|
568
|
+
process is gone counts as no run.
|
|
569
|
+
- A lot of `lots.json` can be a merge (git 2.38 or later, for its trial merge):
|
|
570
|
+
`{ "kind": "merge", "branch": "<branch or tag>", "tip": "<sha>", "resolved": { "<path>": "<file>" | null }, "message": "...", "tree": "<sha>" }`
|
|
571
|
+
(`null`: the merge removes the file). Merge lots are trial-merged in sequence: each on the tree the lots
|
|
572
|
+
before it leave - HEAD's, each earlier plain lot's files as they are in the working tree, each earlier
|
|
573
|
+
merge's trial tree with its resolutions - so a conflict that appears only on top of an earlier merge is
|
|
574
|
+
found at the write and needs a resolution, instead of stopping the run. The write refuses a branch that
|
|
575
|
+
is gone or moved since its tip was reviewed, a missing resolution file, a resolution holding conflict
|
|
576
|
+
markers, a conflict of the trial merge without a resolution or on a symlink or a submodule, and a file
|
|
577
|
+
the merge changes that has working-tree changes outside the resolutions (a file an earlier lot commits
|
|
578
|
+
aside). It records the conflicts, each resolution's hash and the tree the merge was trial-merged on
|
|
579
|
+
(`onTree`) in `merges.json`, under the review hash like `lots.json` (`--rehash` after a review). A resolution may
|
|
580
|
+
cover a file that merges cleanly (the lot changes it on top of the merge). Rehearse first:
|
|
581
|
+
`--rehearse` prints the merge's `tree <sha>` (a reused merge too), which goes into the lot as `tree`;
|
|
582
|
+
a real run requires it ("tree not recorded: rehearse first"). Before merging, the run refuses the lot
|
|
583
|
+
when HEAD's tree is not its `onTree` - an earlier lot committed other content (a hook staged files of
|
|
584
|
+
its own) - naming both trees, with nothing merged, and the next step (see what the lots before it
|
|
585
|
+
committed, then write the hand-over again from this HEAD for the lots left). A `merges.json` without
|
|
586
|
+
`onTree` (written by an earlier cli) is refused at the read: write the hand-over again, then
|
|
587
|
+
`--rehash` after a review. The run merges the recorded tip (`git merge --no-ff --no-commit`; a branch
|
|
588
|
+
moved since is a note) and refuses a merge in progress, leaving it - except one of the lot's own tip
|
|
589
|
+
that this cli started (its marker in the git folder) or with `--resume-merge`, aborted and redone. It
|
|
590
|
+
checks the conflicts against the recorded ones, copies the resolutions (hash-checked), refuses
|
|
591
|
+
conflict markers in the result, and checks the staged tree against the recorded one before the commit
|
|
592
|
+
(else the merge is aborted) and the commit's tree after it (a hook may stage files). A merge whose
|
|
593
|
+
hook refuses it is aborted, for a clean rerun. A rerun recognises a done merge by its subject, the
|
|
594
|
+
tip as its second parent and its tree. Before any commit whose staged `package-lock.json` differs
|
|
595
|
+
from HEAD's, `node_modules` are brought to it: the staged lock and `package.json` written over the
|
|
596
|
+
working copies (the working ones saved first in the git folder's `dialecte-install-backup`, put back
|
|
597
|
+
after the install, on an interrupt too; a backup a crash left is restored by the next run when the
|
|
598
|
+
files still hold the staged bytes, else refused naming it),
|
|
599
|
+
`npm ci --ignore-scripts --prefer-offline --no-audit --no-fund` (no install script runs: a `prepare`
|
|
600
|
+
or `postinstall` could change git config, hooks or any file; `npm ci` reinstalls every package, so
|
|
601
|
+
the note after the sync names each installed package of the staged lock that has one,
|
|
602
|
+
`install scripts not run: <names>`: each package once by its name, a nested copy too, five named then
|
|
603
|
+
`and <n> more`), the working copies put back byte for byte;
|
|
604
|
+
refused when the install changed the staged files or the versions still differ (dev, peer and optional
|
|
605
|
+
packages an install leaves out aside). A real run that leaves every lot committed then moves the worktree's `.dialecte/lot.json`
|
|
606
|
+
into the hand-over folder as `lot.json`, after the card is built, and leaves an empty declaration
|
|
607
|
+
(`{}`) in its place, saying so in one line (`lot file archived: <folder>/lot.json`): the next lot on
|
|
608
|
+
the branch does not inherit its entries. No lot file, an empty one, a rehearsal, a stopped run, or a
|
|
609
|
+
folder that holds a `lot.json` already (a second run) leave the lot file as it is.
|
|
610
|
+
- `dialecte handover list [--root <dir>] [--json]` lists every hand-over folder under the workspace's
|
|
611
|
+
`_commit-plan/` (or the folder given, or the current one): repository, worktree, branch, lots, age, and
|
|
612
|
+
its state - pending, partly committed, committed, or stale when something else moved the branch. A
|
|
613
|
+
folder holding a hand-written `commit*.sh` and no lots file shows as "legacy script, state unknown".
|
|
614
|
+
- `dialecte worktree add <repository> <branch> [--from <ref>] [--json]` makes a worktree under the
|
|
615
|
+
workspace's `.worktrees/<repository>-<branch tail>` (the last segment of the branch: `core-depth` for
|
|
616
|
+
`feat/depth`; a new branch starts from `--from`, else the base
|
|
617
|
+
branch): it copies the hooks folder `core.hooksPath` names (husky's `.husky/_` is ignored by git, so a
|
|
618
|
+
plain worktree misses it), copies the main checkout's `node_modules` copy-on-write where the file system
|
|
619
|
+
can (links kept, a relative link to a sibling re-pointed so it still reaches it) - from the worktree that
|
|
620
|
+
has the `--from` branch checked out when it has one, else from the main checkout - lists `.dialecte/`
|
|
621
|
+
once in the exclude file of the repository's common git folder (so for the main checkout and every
|
|
622
|
+
worktree of it), and writes the hygiene baseline `gate --fast` compares with; it prints a card.
|
|
623
|
+
Before the copy it makes the links the worktree's `file:` and `link:` dependencies need (`dependencies`,
|
|
624
|
+
`devDependencies`, `optionalDependencies`, `peerDependencies`): a relative path that leaves the worktree
|
|
625
|
+
into the workspace's `.worktrees/` (`file:../core` from `.worktrees/cli-x` reaches `.worktrees/core`)
|
|
626
|
+
gets a relative link there to the folder the same path reaches from the main checkout
|
|
627
|
+
(`.worktrees/core -> ../core`). Each dependency gets one outcome, in the card's `links` row and the
|
|
628
|
+
JSON's `siblingLinks` (`dependency`, `link`, `target`, `outcome`): `created`; `present` (a link that
|
|
629
|
+
already reaches it: a second worktree changes nothing); `skipped: <target> missing`;
|
|
630
|
+
`skipped: <folder> missing` for a path into a sibling whose own folder is not under `.worktrees/` yet
|
|
631
|
+
(`file:../core/sub/pkg` without `.worktrees/core`); `skipped: outside .worktrees/`;
|
|
632
|
+
`skipped: cannot make the link (<code>)` when the file system refuses it (`EACCES`, ...);
|
|
633
|
+
`kept: points to <its text>, not <target>` or `kept: a real folder` (or file): what is there is never
|
|
634
|
+
replaced. A path inside the repository needs no link and is not listed. After the copy it reads
|
|
635
|
+
`node_modules` against the worktree's `package-lock.json` (its `packages` map, lockfileVersion 2 or 3,
|
|
636
|
+
nested packages included, bundled ones left out): each package installed at its locked version
|
|
637
|
+
(`missing`, `<installed> installed, lock <locked>`, `package.json unreadable`), each link reaching what
|
|
638
|
+
the lockfile resolves it to (`link to <path> missing`, `… points elsewhere`). A package npm may leave
|
|
639
|
+
out of this machine's install is not missing when absent: `optional`, or an `os` / `cpu` list this
|
|
640
|
+
platform does not match (`!x` excluding x); a `devOptional` one is, since a development install puts it
|
|
641
|
+
in. The card's `lockfile` row says
|
|
642
|
+
`✓ node_modules matches package-lock.json (<n> packages)`, or the count of packages that differ with the
|
|
643
|
+
first five, and a `next` row holds the command that puts it right, `cd '<worktree>' && npm ci`. Without
|
|
644
|
+
a lockfile it says `no package-lock.json: not checked`; a lockfile that is not JSON, or has no `packages`
|
|
645
|
+
map (lockfileVersion 1), is not checked either (`package-lock.json unreadable: not checked`,
|
|
646
|
+
`package-lock.json has no packages map: not checked`). The JSON carries it as `nodeModulesCheck`
|
|
647
|
+
(`lockfile`, `notChecked`, `problems`: `package`, `problem`; `command` when there are problems). The
|
|
648
|
+
exit code stays 0 whatever the links and the lockfile say: the worktree exists, and its card says what
|
|
649
|
+
to run.
|
|
650
|
+
- `dialecte lot exempt <reason>`, `lot accept <case> <reason>`, `lot revised <case|file|glob> <reason>`,
|
|
651
|
+
`lot gone <file|glob> <reason>` write the lot declaration `.dialecte/lot.json` at the package root (the
|
|
652
|
+
nearest package.json above the current folder) as tab-indented JSON, keeping what it holds; the same
|
|
653
|
+
case (or file) again replaces its reason. `accept` needs a case `<file>::<name>`; `gone` refuses one
|
|
654
|
+
(it writes `"gone": [{ "file": "<file or glob>", "reason": "..." }]`).
|
|
655
|
+
- `dialecte lot mutation <off|changed|audit|gate>` writes the lot's mutation switch (`"mutation"`, no
|
|
656
|
+
reason). Without it, `dialecte mutants run` mutates the changed lines when the lot's diff touches the
|
|
657
|
+
declared scope and nothing otherwise; `audit` mutates the whole scope; `gate` runs as `changed`.
|
|
658
|
+
- `dialecte mutants run [--mode changed|audit] [--base <ref>]` runs StrykerJS (resolved from the package,
|
|
659
|
+
its devDependency) on the scope `package.json` declares:
|
|
660
|
+
`"dialecte": { "mutation": { "scope": [...], "exclude": [...], "errorFactories": [...], "fast": { "vitestConfig": "..." }, "full": { "command": "..." } } }`.
|
|
661
|
+
`changed` mutates the scope lines changed since the merge base with the base branch (`dialecte.baseBranch`,
|
|
662
|
+
`main` when not said; then the remote's default branch, `refs/remotes/origin/HEAD`; with neither the run
|
|
663
|
+
is refused, exit 2, naming `dialecte.baseBranch` and `--base`) or `--base <ref>`, untracked scope files
|
|
664
|
+
whole; `audit` the whole scope (no base needed). Without `--mode` the lot's switch decides; with no switch,
|
|
665
|
+
`changed` when the change touches the scope, else `mutation off for this lot` and exit 0. A detached HEAD is
|
|
666
|
+
refused: a run is filed under its branch. Before Stryker starts, the run is written `running` with its
|
|
667
|
+
process id and that process's start time to `<git-common-dir>/dialecte-mutation/runs/<run id>.json` (every
|
|
668
|
+
worktree of the repository reads it); a run whose process is gone before it reports, or whose pid now
|
|
669
|
+
belongs to a process that started at another time, reads `died`. Every Stryker call names an empty config
|
|
670
|
+
file (`configFile`), so a `stryker.config.json` of the package is never merged in, and only the fast tier is
|
|
671
|
+
incremental. The fast tier runs first, then the timed-out mutants alone, then the declared full tier on the
|
|
672
|
+
survivors no committed record (`.dialecte/mutation-records.json`) lists; the entry is then replaced
|
|
673
|
+
`reported` with the counts, the survivors and the keys of the mutants it detected (killed or timed out), and
|
|
674
|
+
each survivor no record lists enters the ledger (`<git-common-dir>/dialecte-mutation/ledger.json`) as `new`,
|
|
675
|
+
keyed `<package>::<survivor key>`. A `new` or `scheduled` survivor becomes `killed` only when a later run
|
|
676
|
+
detected that exact mutant, and never by a run that started before the last run reporting it (that run tested
|
|
677
|
+
older code); a record with a reason and a family makes it `recorded` (a scheduled one keeps its follow-up
|
|
678
|
+
name). Any other run leaves it as it is: a survivor whose line changed or went away stays pending until the
|
|
679
|
+
lot tests it, records its reason or schedules it. The ledger's readers and writers hold a lock file beside it
|
|
680
|
+
(one whose owner process is gone, or that names no owner and is a few seconds old, is taken over) and first
|
|
681
|
+
take in every reported run the ledger has not taken in yet, in the order they started, so a run whose ledger
|
|
682
|
+
update was missed still reaches it, once. The last lines name the package, lot (the branch), tree (12
|
|
683
|
+
characters), mode, counts, each new survivor `file:line mutation` and each ledger item the run moved
|
|
684
|
+
(`<key> file:line killed|recorded`). Exit 1 only when Stryker fails (the run stays `running` until the
|
|
685
|
+
process ends); survivors never fail the command. Reports and sandboxes go under `.tmp/mutants/<run id>/`,
|
|
686
|
+
removed once the run reported. Stryker's incremental file lives in the run's work folder, seeded from and
|
|
687
|
+
written back to `<git-common-dir>/dialecte-mutation/incremental/<package hash>-<key>.json` after a reported
|
|
688
|
+
fast tier. The key holds the whole tree (`.dialecte/` left out), the package's path, the installed lock, the
|
|
689
|
+
linked `file:` dependencies, the fast tier's options, the cli version and the ignorer plugin's bytes, so the
|
|
690
|
+
file is reused on an identical tree only (a rerun, other targets, `changed` then `audit`, another worktree at
|
|
691
|
+
the same tree, a rerun after recording reasons) and never across edits. The store keeps the newest 4 files of
|
|
692
|
+
a package. A write-back that fails prints one warning on stderr and the run goes on.
|
|
693
|
+
- `dialecte mutants status [--json]`: the package's running runs with their age, died runs, `new`
|
|
694
|
+
survivors grouped by the lot that first saw them and `scheduled` ones by follow-up.
|
|
695
|
+
`dialecte mutants schedule <follow-up> <key>...` (or `--all-new`) moves `new` survivors to `scheduled`
|
|
696
|
+
under that follow-up (an unknown key refuses the whole call); `dialecte mutants abandon <run id>` marks a
|
|
697
|
+
died run `abandoned` and keeps it (a running or reported run is refused); `dialecte mutants migrate`
|
|
698
|
+
turns `scripts/mutants/equivalent-mutants.json` into `.dialecte/mutation-records.json` (same keys and
|
|
699
|
+
reasons, family `unclassified`, the line's hash), never overwriting an existing file. The store is
|
|
700
|
+
written by the cli only: never edit it by hand.
|
|
701
|
+
- `dialecte mutants judge [--file <file>]` prints, per file (sorted), the package's `new` survivors as a judge
|
|
702
|
+
packet: each survivor's key, line and mutation, a family guess with its reason (the first rule its code
|
|
703
|
+
matches: an `errors/` file or error wording, a `.constants.ts` file or a module-level declaration, an
|
|
704
|
+
exhaustive `default:`; `unclassified` when none does), the covering tests the last run that reported it named
|
|
705
|
+
(five, then `…and <n> more`), the code around it as the file is now (5 lines above and below, 21 at most, each
|
|
706
|
+
line cut at 160 characters, the mutated lines marked `>`, `line changed since the run` when its text differs
|
|
707
|
+
from the reported one) and the `record` and `schedule` commands that close it. A packet holds 10 survivors at
|
|
708
|
+
most and its JSON and its text stay within 12000 bytes each: the rest is counted (`…and <n> more survivors`);
|
|
709
|
+
a lone survivor over the cap loses window lines (context first), then test names, then the end of its mutation
|
|
710
|
+
text, each counted. A run entry stores at most five covering test names per survivor, and how many more.
|
|
711
|
+
`dialecte mutants record (--key <key>... | --file <file>) --family <family> --reason <text> [--removable]`
|
|
712
|
+
writes each survivor's record to `.dialecte/mutation-records.json` (family, trimmed reason of at most 200
|
|
713
|
+
characters, the hashes of its line and tests; `removable` for `invariant-guard` and `fallback-never-taken`
|
|
714
|
+
only; other records kept, files and records sorted), then moves each `new` or `scheduled` one to `recorded`
|
|
715
|
+
(a killed or recorded one stays as it is), both under the ledger lock, the records first: a crash between the
|
|
716
|
+
two leaves the survivor `new` until a later run or `record` takes the record in. `--key` repeats or takes
|
|
717
|
+
several keys; `--file` takes every `new` or `scheduled` survivor of the file. An unknown family, `unclassified`,
|
|
718
|
+
an empty or too long reason, `--removable` with another family, an unknown key, or a `--file` holding no `new`
|
|
719
|
+
or `scheduled` survivor refuses the whole call (exit 1, nothing written); both `--key` and `--file`, neither, no
|
|
720
|
+
`--family` or `--reason`, or an option given another of the verb's options as its value (`--reason --json`) is a
|
|
721
|
+
usage error (exit 2). `dialecte mutants drop <run id>` removes an abandoned run, or a reported run, from the
|
|
722
|
+
store; a running or died run (abandon it first) and the latest reported run of its branch (it is that branch's
|
|
723
|
+
evidence: drop it once a newer run of the branch reported) are refused. Every verb but `run` takes `--json` and
|
|
724
|
+
then prints exactly one JSON object on stdout, a refusal included: `{ "verb", "ok": true, ... }` or
|
|
725
|
+
`{ "verb", "ok": false, "reason" }` with the usual exit code (`status --json` prints the status itself).
|
|
726
|
+
- A `new` survivor or a died run blocks every hand-over of the package (the card's `mutation` line and
|
|
727
|
+
`handover run`'s guard) until it is killed, recorded, scheduled, rerun or abandoned; a running run blocks a
|
|
728
|
+
merge hand-over and a gate lot; `dialecte worktree prune` keeps the worktree of a running or died run.
|
|
729
|
+
- `dialecte worktree prune [--root <workspace>] [--yes] [--json]` lists, per repository of the workspace,
|
|
730
|
+
the worktrees and local branches whose commits are all in the base branch, the hand-over folders whose
|
|
731
|
+
lots are all committed (never `_commit-plan` itself, nor a folder holding other folders) and the
|
|
732
|
+
rehearsals whose process is gone - the rehearsal folders under `/tmp` (each goes whole) and the clones
|
|
733
|
+
earlier cli versions made in the system's temporary folder, each judged by its marker - with the
|
|
734
|
+
command that removes each (its absolute `cd` first).
|
|
735
|
+
`--yes` runs them after a confirmation on a terminal; without a terminal it refuses, so hand the
|
|
736
|
+
commands (or the `--yes` command) to a person. Kept, each with why: an unmerged branch; the branch the
|
|
737
|
+
main checkout is on; a worktree a mutation run was started from while that run still runs
|
|
738
|
+
(`mutation run <id> still running (pid <pid>)`) or after it died before reporting
|
|
739
|
+
(`mutation run <id> died before reporting: rerun or dialecte mutants abandon <id>`; a reported or
|
|
740
|
+
abandoned run keeps nothing); a worktree a hand-over is pending in, or with uncommitted changes; a branch whose
|
|
741
|
+
reflog still reaches commits the base does not hold (reset onto a newer base after commits of its own:
|
|
742
|
+
its reflog is the only way back to them); a worktree or branch with no commit of its own in its reflog
|
|
743
|
+
(just made); a worktree holding ignored files that removing it would delete (anything but
|
|
744
|
+
`node_modules`, `dist`, `.vitepress/cache`, `.vitepress/dist`, `.DS_Store` and the hooks folder; a long
|
|
745
|
+
list is counted, the first three named); a rehearsal clone whose process still runs, or without a
|
|
746
|
+
marker. It never removes, nor offers to remove, a symbolic link or what a link reaches. A worktree
|
|
747
|
+
path, a hand-over folder or a rehearsal clone that is a link, or a hand-over folder reached through a
|
|
748
|
+
linked folder under the workspace at any depth, is kept with
|
|
749
|
+
`a link: prune never removes a link nor what it points to` (a dangling link included). A worktree,
|
|
750
|
+
hand-over folder or rehearsal clone that a link reaches (links looked for one level under the
|
|
751
|
+
workspace, its `.worktrees/`, its `_commit-plan/` and the scratch folder) is kept with
|
|
752
|
+
`the link <link> points to it`. `git worktree prune` unregisters every worktree whose folder holds no
|
|
753
|
+
checkout, a link's too: while a registered worktree of the repository is a link, a worktree deleted
|
|
754
|
+
from disk is kept, naming that link, and no `git worktree prune` is offered. The sibling links
|
|
755
|
+
`worktree add` makes (`.worktrees/core -> ../core`) are in no item. It reads each worktree with
|
|
756
|
+
`git --no-optional-locks`, so it never rewrites an index. `handover list` follows a link to a hand-over
|
|
757
|
+
folder and lists a folder reached by its path and through a link once.
|
|
758
|
+
- `dialecte record review|decision|snapshot` and `dialecte review delta` keep a lot's review rounds in its
|
|
759
|
+
hand-over folder (`_commit-plan/<topic>-<date>/`), which stays outside every repository: each refuses a
|
|
760
|
+
folder inside a git work tree or a git folder (`.git/`, a bare repository). `--` ends the options: the
|
|
761
|
+
words after it are taken as they are, so a finding or a reason may start with `--`.
|
|
762
|
+
- `record review <folder> --round <n> --severity <blocking|should-fix|nit> --at <file:line> <finding>`
|
|
763
|
+
appends the row `| R<n>-<k> | <n> | <severity> | <file:line> | <finding> | open |` to
|
|
764
|
+
`<folder>/findings-ledger.md` (the folder, the file and its table made when absent; k one past the
|
|
765
|
+
highest of the round). A `|` is written `\|`; a line break is refused. A hand-written ledger keeps
|
|
766
|
+
every other byte.
|
|
767
|
+
- `record decision <folder> <id> <state>` rewrites that row's state cell: `open`, `fix-to-verify`,
|
|
768
|
+
`fixed <round> [note]` (a round after the one that raised it), `accepted <reason>`, `logged <where>`.
|
|
769
|
+
An id not in the ledger is refused, naming the ids it holds.
|
|
770
|
+
- `record choice <folder> --by <who> <decision>` appends `| <decision> | <who> | <yyyy-mm-dd> |` to
|
|
771
|
+
`<folder>/decisions.md` (made with its title and table when absent): a decision made outside the
|
|
772
|
+
findings ledger, the user's above all. A `|` is written `\|`; an empty `--by`, a line break, or more
|
|
773
|
+
than one decision word (quote it) is refused.
|
|
774
|
+
- `record snapshot <folder> --round <n>` copies every file `git status --porcelain -z
|
|
775
|
+
--untracked-files=all` lists at the worktree root (the old path of a rename included) to
|
|
776
|
+
`round-<n>/` at its repository-relative path - bytes, mode, a symlink as a symlink; a path gone from
|
|
777
|
+
disk (or now a folder) that HEAD holds goes in `round-<n>.deleted`, NUL-separated, sorted; HEAD in
|
|
778
|
+
`round-<n>.base`. An existing round, an untracked nested repository and a submodule (a gitlink in the
|
|
779
|
+
index or at HEAD) are refused; a run that
|
|
780
|
+
stops part-way leaves only `.partial` names, which the next run removes. `.dialecte/lot.json` is
|
|
781
|
+
never part of it.
|
|
782
|
+
- `review delta <folder> --round <n> [--worktree] [--json]` (n ≥ 2) prints, for each file of
|
|
783
|
+
`round-<n-1>/`, of `round-<n-1>.deleted` or of the worktree's status, what changed since round n-1,
|
|
784
|
+
in the form that fits where the file is: the snapshot copy against the worktree file (or
|
|
785
|
+
`/dev/null` when it is gone), `/dev/null` against a file deleted then and back now or new and absent
|
|
786
|
+
from the base, `git diff HEAD` for a file round n-1 had at the base. Files unchanged since round n-1
|
|
787
|
+
are left out; colour, external diff and textconv settings never apply. It refuses when HEAD moved
|
|
788
|
+
since `round-<n-1>.base`, and refuses a nested repository or a submodule as `record snapshot` does. `--worktree` adds a throwaway worktree on the branch
|
|
789
|
+
`<lot branch>-round-<n-1>` from the lot's branch tip: the deletions applied with `git rm
|
|
790
|
+
--pathspec-from-file`, then `round-<n-1>/` copied over, so a new test can run on the old code; it
|
|
791
|
+
prints its path and the removal command with its absolute `cd`. The lot's worktree is never
|
|
792
|
+
changed.
|
|
793
|
+
|
|
794
|
+
`gate --fast` starts with the hygiene of the worktree: nothing staged; no stash entry pushed on this
|
|
795
|
+
worktree's branch since `worktree add` made it (the baseline keeps every stash entry it saw, so another
|
|
796
|
+
session dropping one changes nothing; one stash is shared by every worktree and session: a new entry of
|
|
797
|
+
another branch is only noted, naming it; without a baseline the stash is not compared); and
|
|
798
|
+
every new file one the change declares (`--declare <path>`, repeatable; an undeclared one is a warning).
|
|
799
|
+
A failure says what changed and how to look at it with read-only commands.
|
|
800
|
+
|
|
801
|
+
Steps run with the runner's defaults - no lock, no `nice`, no worker cap - whoever else shares the machine.
|
|
802
|
+
A step that counts tests and runs vitest (its command, or the npm script it runs, names `vitest`) and fails
|
|
803
|
+
on its exit code or its counts is run once more with `--no-file-parallelism`, on the failing files the first
|
|
804
|
+
run named (through `npm run <script>` after one `--`; the whole step when the output names no file). The
|
|
805
|
+
rerun passes when it exits 0, counts no failed test and at least one passed: the step then passes,
|
|
806
|
+
flagged - `serial rerun of <n> file(s): exit 0, <counts> flaky in parallel` on its line, one
|
|
807
|
+
`flaky <file>` line under it per file, the note kept in the gate record. Otherwise the step fails as a
|
|
808
|
+
`real failure: <why>`, each file listed under it as `failed <file>` when it failed again or `flaky <file>`
|
|
809
|
+
when it passed serially, the rerun's last lines as the tail. While the rerun runs, the step's line still
|
|
810
|
+
shows its own command. A step that stalled, counts no tests, runs no vitest, or already runs one file at a time
|
|
811
|
+
(`--no-file-parallelism` in its command) is never rerun. `--json` carries the rerun of
|
|
812
|
+
each step (`rerun`: files, the files still failing, status, exit code, counts).
|
|
813
|
+
|
|
814
|
+
`gate --fast` and `--full` run a `tdd` step after the hygiene (first in `--full`): every test-code file
|
|
815
|
+
changed since the base (test files, helpers, fixtures, snapshots) must be as the red run that last froze it
|
|
816
|
+
("test code changed outside tdd red"), and every case of the change red then green, or unchanged; the
|
|
817
|
+
others fail the gate with the list. The flags of the receipts and the deleted cases are printed under the
|
|
818
|
+
step. The lot file may also accept cases without a red - a new test of behaviour that already exists, an honest
|
|
819
|
+
cut of an assertion: `"accept": [{ "case": "<file>::<name> [project]", "reason": "..." }]`. An accepted
|
|
820
|
+
case passes `tdd red` as accepted and does not block its file; the gate lists each acceptance with its
|
|
821
|
+
reason, the hand-over card counts them by reason from the receipts (those of earlier lots, which the file
|
|
822
|
+
no longer names, counted on one line), and both report an acceptance or a `revised` entry no case used. The card
|
|
823
|
+
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
|
|
824
|
+
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
|
|
825
|
+
and what the change touches: `{ "tdd": "exempt: <reason>" }` in `.dialecte/lot.json` at the package root
|
|
826
|
+
prints "exempt: <reason> (n production file(s), m test file(s) changed)". The hygiene and the hand-over
|
|
827
|
+
leave the file out (never committed); the hand-over card shows the exemption and the flags. A package that
|
|
828
|
+
does not test with vitest skips the step.
|
|
829
|
+
|
|
830
|
+
A package tunes them in its package.json:
|
|
831
|
+
|
|
832
|
+
```json
|
|
833
|
+
"dialecte": {
|
|
834
|
+
"gate": {
|
|
835
|
+
"fast": [
|
|
836
|
+
{
|
|
837
|
+
"name": "tests",
|
|
838
|
+
"run": "npx vitest run --project unit --changed",
|
|
839
|
+
"counts": "tests",
|
|
840
|
+
"changedOnly": true
|
|
841
|
+
}
|
|
842
|
+
]
|
|
843
|
+
},
|
|
844
|
+
"generatedDocs": [".vitepress/data/elements-catalog.json"],
|
|
845
|
+
"referencePatterns": ["SPEC-[0-9]+"],
|
|
846
|
+
"baseBranch": "main"
|
|
847
|
+
}
|
|
848
|
+
```
|
|
849
|
+
|
|
850
|
+
`gate.fast` / `gate.full` replace the default steps of that mode (`counts: "tests"` makes a step fail
|
|
851
|
+
when it counts no test; `changedOnly: true` marks a step that runs only the tests the change affects,
|
|
852
|
+
so "No test files found" passes with a note instead of failing; `restoresGeneratedDocs: true` restores the `generatedDocs` byte for byte after
|
|
853
|
+
it); `baseBranch` is the branch
|
|
854
|
+
`worktree add` starts from and `worktree prune` compares with (default `main`); `referencePatterns` adds the package's own patterns (extended regular expressions) to the plan
|
|
855
|
+
tags and citations `rules` and `handover` refuse.
|
|
856
|
+
|
|
857
|
+
### GitHub text: recap and text check
|
|
858
|
+
|
|
859
|
+
Text written with an assistant tends to retell the diff and grow long. The pull request splits in two:
|
|
860
|
+
an expandable part made from records, and a short human part that is checked before it is posted. Both
|
|
861
|
+
commands only print; the user posts.
|
|
862
|
+
|
|
863
|
+
- `dialecte recap <hand-over folder>` prints the expandable part (`<details>`) as GitHub markdown, from the
|
|
864
|
+
records only: the commits of the lots (or `not committed yet`), the test cases the newest gate record of the
|
|
865
|
+
current tree judged red then green, counted per test file, the gate and rules lines (and `mutation`), the
|
|
866
|
+
lot's mutation runs (`Mutation`: each run of the branch and of the branches it merges, oldest first, with
|
|
867
|
+
its mode, id and counts or its state; each survivor those runs killed or recorded; each survivor first seen
|
|
868
|
+
on those branches and scheduled, with its follow-up; `No mutation run.`, or `No mutation scope declared.`
|
|
869
|
+
for a package without one), the review rounds from
|
|
870
|
+
the findings ledger, the decisions (accepted findings, the lot declaration's `accept` and `revised` entries,
|
|
871
|
+
the rows of `decisions.md`), the logged findings as follow-ups, and who reviewed and posted it (`git config
|
|
872
|
+
user.name`; no name set is refused). Every section is always there, saying so in one line when empty; a
|
|
873
|
+
branch that does not hold the lots on top of the recorded base lists none as committed and says so. Each
|
|
874
|
+
finding is printed with its id, its text without one leading reviewer tag `[...]`. The ledger is read whole:
|
|
875
|
+
every row after its header with the header's cell count is a finding, whatever its id (`R<n>-<k>`, `TR3-1`,
|
|
876
|
+
`F-a`, printed as written), notes between rounds included; its round is the round cell's, else the one an
|
|
877
|
+
`R<n>-` id names, else the row is refused. A state is read as a history (`fix wrong 2 (...) - fixed 3
|
|
878
|
+
(reasoned)`): it starts with `fixed`, `accepted`, `logged`, `open`, `fix to verify`, `fix wrong` or
|
|
879
|
+
`reopened`, and a spaced dash starts a new part only before `fixed <n>`, `reopened <n> by <id>`, `fix wrong
|
|
880
|
+
<n>`, `fix to verify`, a closing `open`, or a later `accepted` or `logged` followed by ` (`, `: ` or a
|
|
881
|
+
spaced dash; any other spaced dash belongs to the text before it. The last part decides (`fix wrong`,
|
|
882
|
+
`reopened` and `fix to verify` leave the finding open), an accepted one's reason being the rest (in its
|
|
883
|
+
parentheses, or after `- ` / `: `); a state recap cannot read is refused with the row's id. A `file:line` is
|
|
884
|
+
printed relative to the repository, or to the workspace folder for a sibling repository (the parent of the
|
|
885
|
+
main checkout; of the `.worktrees` folder when the repository is gone), never absolute: an absolute path
|
|
886
|
+
outside both, or one the rewrite does not reach (a `/` starting a path segment after a backtick, a quote,
|
|
887
|
+
`=`, `[`, `-`; `~/`), is refused with the row's id; a `/` starting no segment (`a.ts / b.ts`, `+/- 2`) and
|
|
888
|
+
URLs stay. Where a finding was logged, the hand-over folder and the lots file's notes are left out. It writes
|
|
889
|
+
nothing.
|
|
890
|
+
- `dialecte text check <file> [--kind pr|issue|comment|commit]` checks every line before the first `<details`
|
|
891
|
+
line (the recap is not checked). A pull request or an issue holds the headings `What changes`, `Why`, `How
|
|
892
|
+
to check it` in this order, then `Watch out` only when it has something to say; each with text under it,
|
|
893
|
+
nothing before the first. A comment or a commit holds no heading; a commit's line 1 is its subject, not
|
|
894
|
+
empty and at most 72 characters (longer ones are cut in logs and in GitHub's list), with a blank line before
|
|
895
|
+
the body. The word cap: 150 for a pull request (the diff carries the rest), 200 for an issue (it stands
|
|
896
|
+
alone), 80 for a comment (it answers one point), 100 for a commit body (the why; the subject is not
|
|
897
|
+
counted). Words hold a letter or a digit; headings and fenced code blocks are not counted. Past the cap it
|
|
898
|
+
prints the count, the cap and every line from the one that passed it. Exit 0 when the text holds, 1 with one
|
|
899
|
+
line per problem.
|
|
900
|
+
|
|
901
|
+
## Run a script
|
|
902
|
+
|
|
903
|
+
`dialecte run <script.ts>` runs a script against an in-memory project of the dialecte your project
|
|
904
|
+
installs (with `@dialecte/core` 0.8.0 or later) and answers one structured outcome. The script is a
|
|
905
|
+
module whose default export receives `{ project, doc, documentId, dialecte, helpers, utils }`; what it
|
|
906
|
+
returns is the outcome's `result`.
|
|
907
|
+
|
|
908
|
+
```ts
|
|
909
|
+
// add-part.ts
|
|
910
|
+
export default async function addPart({ doc }) {
|
|
911
|
+
const [assembly] = await doc.query.findByAttributes({
|
|
912
|
+
tagName: 'Assembly',
|
|
913
|
+
attributes: { name: 'A1' },
|
|
914
|
+
})
|
|
915
|
+
await doc.transaction(async (tx) =>
|
|
916
|
+
tx.addChild(assembly, { tagName: 'Part', attributes: { name: 'P2' } }),
|
|
917
|
+
)
|
|
918
|
+
}
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
```
|
|
922
|
+
dialecte run add-part.ts --in assembly.xml --expect expected.json
|
|
923
|
+
failed: expectations not met
|
|
924
|
+
operations: Assembly +0 ~1 -0, Part +1 ~0 -0
|
|
925
|
+
diagnostics: none
|
|
926
|
+
expectations: 0 passed, 1 failed
|
|
927
|
+
✗ expected 3 Part under Assembly[name="A1"], found 2
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
- `--in <file>` imports a file first (an empty document otherwise); its import diagnostics are in the
|
|
931
|
+
outcome. `--out <file>` writes the document once the script ran.
|
|
932
|
+
- `--prepare` stages the script's first transaction instead of committing it and stops the script
|
|
933
|
+
there: the records it would write, and what its callback returned (a lifecycle report), nothing
|
|
934
|
+
committed. Any other write is refused and fails the run, even when the script catches the refusal:
|
|
935
|
+
a second transaction, `commit()` on a prepared transaction, a transaction on a document opened
|
|
936
|
+
through `project.openDocument`, the project's own writes (`importFile`, `removeDocument`,
|
|
937
|
+
`undo`, ...) and its raw database (`getDatabaseInstance`). In every mode the runner alone commits:
|
|
938
|
+
`tx.commit`, `tx.finishStaging` and `tx.clearStagedOperations` are refused inside a callback, and a
|
|
939
|
+
transaction nested in another fails with `CONCURRENT_TRANSACTION`. The guarantee covers the API a
|
|
940
|
+
script is handed; a deliberate call around it (`Object.getPrototypeOf(doc).transaction.call(...)`, a
|
|
941
|
+
store reached by other means) is outside it.
|
|
942
|
+
- `--expect <file>`: a JSON array of expectations `{ "tag", "where"?, "under"?, "count"? }`, checked on
|
|
943
|
+
the result (on the staged transaction under `--prepare`); each one not met is named with the count
|
|
944
|
+
found. `count: 0` means none, no `count` at least one.
|
|
945
|
+
- Deterministic: ids come from a seeded generator (`--seed <n>`, 0 by default), `--now <iso>` freezes
|
|
946
|
+
the clock, both from the moment the script module loads (an id minted at its top level is seeded
|
|
947
|
+
too). The same script, input and seed give the same outcome.
|
|
948
|
+
- Operations are counted per record, as each commit merges them: an element created then updated in
|
|
949
|
+
one transaction is one creation.
|
|
950
|
+
- A thrown structured error is answered as code, key, detail, `meta` and the element's path from the
|
|
951
|
+
root (`/Root/A/AA_2[2]`); `dialecte explain <code>` says what it means.
|
|
952
|
+
- `--json` prints the outcome as data. `--package <name>` names the dialecte when the project depends
|
|
953
|
+
on none or several (`@dialecte/scl/v2019C1`, `@dialecte/core/test`). `--timeout <ms>` (120 s by
|
|
954
|
+
default): the run then answers a timeout and the command exits; called as a library, the script may
|
|
955
|
+
keep running in the caller's process. Exit 0 ok, 1 failed or an expectation not met, 2 usage. The
|
|
956
|
+
script's own console output goes to stderr. A value the script returns that is not JSON (a cycle, a
|
|
957
|
+
BigInt) is given as text with a note.
|
|
958
|
+
- Needs Node 22.18 or later: a `.ts` script runs through Node's built-in type stripping, no build step
|
|
959
|
+
(erasable TypeScript only: types, no enums or namespaces).
|
|
960
|
+
|
|
961
|
+
`dialecte explain <code | key>` reads the error catalogue of the installed core and the error and
|
|
962
|
+
diagnostic catalogues the dialecte exports: the message, when it is raised, the usual fix, the docs
|
|
963
|
+
page. `--json` for the entries as data; exit 1 when no catalogue knows the code.
|
|
964
|
+
|
|
965
|
+
## A fixture from the engine
|
|
966
|
+
|
|
967
|
+
`dialecte fixture <Tag>` answers the smallest XML document holding `<Tag>` that is valid against the
|
|
968
|
+
dialecte's full schema, built by the engine of the dialecte your project installs - never written by hand.
|
|
969
|
+
It is a `dialecte run` of a script the command writes from the definition, read through core's readers:
|
|
970
|
+
|
|
971
|
+
- the chain of parents from the root down to the element: the shortest one (among chains as short, the
|
|
972
|
+
first in sequence order), or the one `--under A/B` names (the root may be named first or left out);
|
|
973
|
+
- every child an element on the way requires, as many times as it is required, and the first branch of
|
|
974
|
+
each choice it requires (unless a child already takes one), each with what it requires in turn; an
|
|
975
|
+
element declared with an abstract type names its first variant with `xsi:type`;
|
|
976
|
+
- a value for every required attribute, and text for an element whose type an empty text does not
|
|
977
|
+
satisfy: the fixed value, else the default, else the first value the type takes - an enumerated value,
|
|
978
|
+
a string its patterns match, a number counting up from the lowest its range allows, free text from the
|
|
979
|
+
tag name - checked against every facet (enumeration, pattern, length, range). Each sampled value is new
|
|
980
|
+
in the document, so unique and key fields never repeat one;
|
|
981
|
+
- every element a key selects holds its key fields, and every reference a keyref checks points at an
|
|
982
|
+
element of the key: one already planned when the values can meet (the element itself, for a reference to
|
|
983
|
+
its own key), else one planted along the key's selector, with what it requires in turn (its own
|
|
984
|
+
references included).
|
|
985
|
+
|
|
986
|
+
```
|
|
987
|
+
dialecte fixture AAA_1 --package @dialecte/core/test
|
|
988
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
989
|
+
<Root xmlns="http://dialecte.dev/XML/DEFAULT">
|
|
990
|
+
<A aA="A">
|
|
991
|
+
<AA_1 aAA_1="AA_1">
|
|
992
|
+
<AAA_1 aAAA_1="aaa">
|
|
993
|
+
<AAAA_1 aAAAA_1="AAAA_1"/>
|
|
994
|
+
</AAA_1>
|
|
995
|
+
</AA_1>
|
|
996
|
+
</A>
|
|
997
|
+
</Root>
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
What is guaranteed, and how it is proven: the document is valid against the dialecte's full XSD -
|
|
1001
|
+
structure, values, identity (unique and key) and references (keyref). The tests build the fixture of every
|
|
1002
|
+
element of core's test dialecte and of scl and judge each with `xmllint --schema` on the real XSD.
|
|
1003
|
+
|
|
1004
|
+
What is not:
|
|
1005
|
+
|
|
1006
|
+
- The hooks have the last word on what they fill: an attribute a hook already set when the element was
|
|
1007
|
+
added (an id, a derived name) keeps the hook's value. A dialecte whose hooks fill a key or reference
|
|
1008
|
+
field differently from the plan could break a reference the plan made good; the tests catch it for the
|
|
1009
|
+
dialectes they cover.
|
|
1010
|
+
- Only the first branch of a required choice, and the first variant of an abstract type, are taken; the
|
|
1011
|
+
fixture holds no optional content.
|
|
1012
|
+
- A reference whose key is declared on another element than the keyref, a key reached only through `.//`
|
|
1013
|
+
or through any element, and a field reaching past the selected element are not planted: the command
|
|
1014
|
+
exits 1 naming the constraint, never with a document that breaks it.
|
|
1015
|
+
- The document carries no record-id marks (`dev:db-id`): it is the plain export, as a user would get it.
|
|
1016
|
+
|
|
1017
|
+
- Ids are seeded and the clock is frozen: the same command and the same installed versions give the same
|
|
1018
|
+
bytes.
|
|
1019
|
+
- `--out <file>` writes the document and prints one line (the path of the element, the bytes); `--json`
|
|
1020
|
+
answers `{ ok, packageName, tag, path, bytes, xml }` (`out` in place of `xml` with `--out`).
|
|
1021
|
+
- Exit 1 with the reason when there is no fixture: an unknown tag (the closest tags named), a `--under`
|
|
1022
|
+
step its parent does not hold, an element only an endless chain of required children could hold, a
|
|
1023
|
+
value the fixture cannot make (the attribute named: a pattern construct it does not read, facets no
|
|
1024
|
+
value satisfies), a reference it cannot plant (the constraint named), or a write the engine refuses
|
|
1025
|
+
(its outcome, as `dialecte run` prints it). Exit 2: usage.
|
|
1026
|
+
- The command does not run a schema validator itself: no XSD ships with it.
|
|
1027
|
+
|
|
1028
|
+
## Developing the cli
|
|
1029
|
+
|
|
1030
|
+
The `schema`, `run`, `fixture` and `explain` tests drive `@dialecte/core`'s own test dialecte: they resolve core from the
|
|
1031
|
+
`@dialecte/core` devDependency, or from the built core checkout `DIALECTE_CORE_DIR` names
|
|
1032
|
+
(`DIALECTE_CORE_DIR=../core npm run test:run`); with neither they fail.
|
|
1033
|
+
|
|
1034
|
+
While the cli follows core's 0.8 train, the devDependency is `"@dialecte/core": "file:../core"`, and the lockfile
|
|
1035
|
+
holds it: the cli's checkout sits next to core's (`Dialecte/cli` and `Dialecte/core`), and a worktree under
|
|
1036
|
+
`Dialecte/.worktrees/` reaches it through the link `Dialecte/.worktrees/core` → `../core`, which
|
|
1037
|
+
`dialecte worktree add` makes (its card says `npm ci` when the copied `node_modules` differs from the
|
|
1038
|
+
lockfile). Build core there (`npm run build`) before running the tests. A release pins a published core again: `prepublishOnly` runs
|
|
1039
|
+
`src/release-check.ts` before the build, which refuses a package.json naming any dependency by a local folder
|
|
1040
|
+
(`file:`, `link:`, `git+file:`, a bare `../x`, `./x`, `/x` or `~/x` path) in `dependencies`, `devDependencies`, `peerDependencies` or `optionalDependencies`, one line
|
|
1041
|
+
per dependency (its field, name and spec), and says how to pin it
|
|
1042
|
+
(`npm install --save-exact <name>@<version>`).
|
|
1043
|
+
|
|
1044
|
+
The cli has a commit hook: `.husky/pre-commit` runs `npm run check`, then `npm run build`. `npm install` in the
|
|
1045
|
+
cli checkout activates it (`"prepare": "husky"` sets `core.hooksPath` to `.husky/_`), and `dialecte worktree add`
|
|
1046
|
+
copies `.husky/_` into each new worktree, so `handover run` proves a cli lot again at its commit. A hook
|
|
1047
|
+
runs with git's `GIT_DIR`, `GIT_INDEX_FILE` and the commit's identity set: the suite's setup file
|
|
1048
|
+
(`test/git-environment.setup.ts`, vitest `setupFiles`) clears them before any test, so a test's git acts on
|
|
1049
|
+
its scratch repository only, and the cli clears git's repository variables at its start.
|
|
1050
|
+
|
|
1051
|
+
The suite leaves no temporary folder behind: every test removes what it makes in its own teardown, also
|
|
1052
|
+
when it fails. A vitest global setup (`test/suite-guard/temp-folder-guard.setup.ts`, `globalSetup`) gives
|
|
1053
|
+
the run one short folder of its own (`dlt-<random>` under the system's temporary folder) and sets it as
|
|
1054
|
+
`TMPDIR` for the workers and the commands they spawn; at the end any entry left in it fails the run,
|
|
1055
|
+
named (ten, then `and <n> more`; Node's compile cache is not one), and the folder is removed whatever
|
|
1056
|
+
the outcome.
|
|
1057
|
+
|
|
1058
|
+
The cli does not re-declare core's types: the definition, record, diagnostic, error, expectation and reader shapes
|
|
1059
|
+
(`ResolvedDefinition`, `DataType`, `AttributeDefinition`, `AnyDialecteConfig`, `ChildOccurrences`, `Diagnostic`,
|
|
1060
|
+
`DialecteError`, `Expectation`, the readers of `@dialecte/core/utils`...) are `import type` from the `@dialecte/core`
|
|
1061
|
+
devDependency, which is erased from the build (the bin loads at run time the core each dialecte resolves, and
|
|
1062
|
+
`isCoreReaders` checks it holds the readers). Types the cli narrows, because a
|
|
1063
|
+
dialecte may run on an older core: the config found by shape (`isDialecteConfig` checks `rootElementName` and
|
|
1064
|
+
`definition` only, typed as `AnyDialecteConfig`), `CoreReaders` (typed from the core the cli is built against;
|
|
1065
|
+
`isCoreReaders` and the `requiredChoices` check report a reader an older core lacks), and `ElementDef` in
|
|
1066
|
+
`coverage` (every member optional). What `run` reads of a project and a document (`RunProject`, `RunDocument`,
|
|
1067
|
+
`RunQuery`) names only the members the runner calls.
|
|
1068
|
+
|
|
1069
|
+
`@dialecte/cli/lookups` (`src/lookups.ts`, built with declaration files) is the library entry of the lookup
|
|
1070
|
+
answers. Its declaration files import types from `@dialecte/core` (a loaded dialecte is typed by them): type-checking
|
|
1071
|
+
a program that uses the entry needs those types (`@dialecte/core` installed) or `skipLibCheck`.
|
|
1072
|
+
|
|
1073
|
+
The `fixture` tests judge every document twice:
|
|
1074
|
+
|
|
1075
|
+
- with core's `assertValidXml` (and scl's validator), which parse with the browser's `DOMParser`: in Node
|
|
1076
|
+
they borrow the cli's `@xmldom/xmldom` development dependency;
|
|
1077
|
+
- with `xmllint --noout --schema` (libxml2; the test fails when it is not installed - CI installs
|
|
1078
|
+
`libxml2-utils`), on the fixture of every element: core's test dialecte against the XSD core ships,
|
|
1079
|
+
`@dialecte/core/test/xsd/test.xsd` of the core the tests run on, always.
|
|
1080
|
+
|
|
1081
|
+
The scl cases run when `DIALECTE_SCL_DIR` names a built scl checkout; the scl validity case also needs
|
|
1082
|
+
`DIALECTE_SCL_XSD`, the path of the scl schema's entry XSD on your machine (the schema does not ship with any
|
|
1083
|
+
package). Both are skipped, by their name, otherwise, and are not run in CI.
|
|
1084
|
+
|
|
43
1085
|
## How it fits the ecosystem
|
|
44
1086
|
|
|
45
1087
|
| Package | Bin | Audience | Phase |
|