@dialecte/cli 0.2.3 → 0.3.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.
Files changed (4) hide show
  1. package/README.md +133 -24
  2. package/dist/cli.js +9605 -8703
  3. package/dist/lookups.js +138 -44
  4. package/package.json +5 -1
package/README.md CHANGED
@@ -24,6 +24,7 @@ dialecte audit # render the public type surface and flag readability
24
24
  dialecte skills sync # install the agent skills your dependencies ship, for your agents
25
25
  dialecte skills generate # refresh the generated blocks of this package's skills
26
26
  dialecte skills check # fail on a skill citing what the code no longer has, or an undocumented public function
27
+ dialecte skills changed # per skill touched: hand-written (its evals are due) or generated blocks only (no evals)
27
28
  dialecte api find "<need>" # find a method by what you need
28
29
  dialecte api show <path> # read one method's contract
29
30
  dialecte members <expr> # what an expression of the live types holds
@@ -40,6 +41,7 @@ dialecte handover --legend # every term of the hand-over card: what it mean
40
41
  dialecte worktree add|prune # a worktree ready to work in (sibling links, node_modules checked); what a merge left behind
41
42
  dialecte record review|decision|snapshot # a lot's findings ledger and round snapshots, in its hand-over folder
42
43
  dialecte record choice <folder> --by <who> <decision> # a decision made outside the ledger, in decisions.md
44
+ dialecte record standard <folder> consulted <note> # the standard check, read by the card's standard line
43
45
  dialecte recap <folder> # the pull request's expandable part, built from the hand-over's records only
44
46
  dialecte mutants run|status|schedule|abandon|migrate|judge|record|drop # mutation testing of the declared scope; survivors tracked until handled
45
47
  dialecte text check <file> # the human part of a GitHub text: its fixed headings and its word cap
@@ -176,25 +178,89 @@ Run outside a package (no `package.json`), each answers a usage error.
176
178
 
177
179
  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`.
178
180
 
181
+ ## Profiles
182
+
183
+ One field of package.json says what the package is to the cli:
184
+
185
+ ```json
186
+ "dialecte": { "profile": "contributor" }
187
+ ```
188
+
189
+ - `consumer` (the default, a package without the field): an app built on a dialecte. It runs the canon: the
190
+ gate steps, the tdd receipts, the review ledger, the hand-over. `rules` and `handover` refuse a citation
191
+ of a standard and the package's own `referencePatterns`; tags (`plan tag`, `acceptance criterion`,
192
+ `ticket number`) are allowed. Mutation testing is off unless `dialecte.mutation.scope` is declared
193
+ (`mutants run` without one says how to opt in). `dialecte contrib` refuses with exit 2.
194
+ - `contributor`: a package of the Dialecte family. The same canon, and the contributor checks: tags are
195
+ refused too (minus those `allowReferences` lifts), `dialecte contrib` runs the code rules, the docs build,
196
+ the type bench and the release guard, and `skills sync` installs the contributor skills (`--no-contributing`
197
+ is refused). A contributor never names the tools that consume it: list them once on the machine with
198
+ `git config --global dialecte.consumerNames "<name>, <name>"` (never committed, so the names stay out of the
199
+ repository) and `rules` and `handover` refuse them as whole words (`consumer tool name`).
200
+ - Any other value is refused by every command that reads it:
201
+ `dialecte.profile: "<value>" is not a profile; profiles: contributor, consumer`.
202
+
203
+ The profile is read from the package.json at the command's root, never from a flag or the environment: it
204
+ describes the package, not the session. `dialecte doctor` prints it (`profile consumer (default)`), warns on
205
+ an `allowReferences` a consumer does not need, on a contributor whose `dialecte.gate.full` still holds `docs`
206
+ or `type-bench` (they belong in `dialecte.contrib.steps`, or drop them for the defaults) and on a contributor
207
+ whose skills were synced without the contributor ones; an invalid value is an error line (`❌`).
208
+
209
+ `dialecte contrib` (in a contributor, after `gate --full` and before `dialecte handover`):
210
+
211
+ ```json
212
+ "dialecte": {
213
+ "profile": "contributor",
214
+ "contrib": { "steps": [{ "name": "docs", "run": "npm run doc:build", "restoresGeneratedDocs": true }] }
215
+ }
216
+ ```
217
+
218
+ `contrib.steps` replaces the default package steps (`docs`, `type-bench`); `[]` keeps the built-in rows only
219
+ (`rules`, `release`). See the command under [Contributing to a Dialecte package](#contributing-to-a-dialecte-package).
220
+
221
+ The hand-over follows the profile:
222
+
223
+ - A consumer's card holds, in `gates`, the gate steps, the review and the standard line, and a `mutation`
224
+ line only when a scope is declared: no `rules`, `docs`, `type-bench` or `release` line, no contrib
225
+ section. `handover run` has no `contrib` guard; its `references` guard refuses `a standard citation`.
226
+ - A contributor's card has the same `gates` and a `contrib` section after them: the rows of the
227
+ `dialecte contrib` record of the tree the lots leave (`rules`, the package's steps, `release`), then the
228
+ live `mutation` row. Every row green: one line, `✓ contrib rules · docs · type-bench · release`, with the
229
+ record's source (`· rehearsal`, `· from <commit>`); any `!` or `✗`: one line per row. No record of the
230
+ tree: `✗ contrib never run: dialecte contrib`. `handover run` checks a `contrib` guard between
231
+ `references` and `mutation`: a green contrib record of the tree the lots leave, at the lots file's HEAD,
232
+ against what is installed now; else `no green dialecte contrib of this tree: run dialecte contrib`, or the
233
+ failed rows' names. Its `references` guard refuses `a plan tag or a standard citation`. A rehearsal never
234
+ stops at the guard (a refusal prints `! contrib ... (the real run refuses; the rehearsal goes on)`): when
235
+ the tree the lots leave has no green contrib record (a merge lot's merged tree too), it runs
236
+ `dialecte contrib` in its scratch clone first, at the lots file's HEAD, and the card reads that record
237
+ `· rehearsal`. When the lots change what the record is keyed by (a merge bringing other contrib steps, the
238
+ install, the linked dependencies), no record can answer the real run: the rehearsal says which part, and
239
+ does not run contrib.
240
+ - Both profiles get the card's `standard` line (see the hand-over card below) and
241
+ `dialecte record standard <folder> consulted <note> | not-consulted <reason>`.
242
+
179
243
  ## Contributing to a Dialecte package
180
244
 
181
- Eleven commands for whoever changes a Dialecte package, a person or an agent. Each answers the same way
245
+ Twelve commands for whoever changes a Dialecte package, a person or an agent. Each answers the same way
182
246
  every time: exit 0 when green, 1 when a check fails, 2 on a usage error; `--json` where a program reads
183
247
  the answer.
184
248
 
185
249
  - `dialecte rules [<files...>] [--json]` checks the code rules on the syntax tree of the changed files
186
250
  (or the files given): exported types outside a `*.types.ts` file, module constants outside a
187
- `*.constants.ts` file, functions declared as `const`, an `await` inside an argument, plan tags and
188
- standard citations are errors, and so is a test that takes the system's temporary folder itself as
251
+ `*.constants.ts` file, functions declared as `const`, an `await` inside an argument, standard
252
+ citations and the package's `referencePatterns` (and, in a contributor, plan tags, acceptance criteria
253
+ and ticket numbers: see [Profiles](#profiles)) are errors, and so is a test that takes the system's temporary folder itself as
189
254
  its root (`tmpdir()` handed to a call that lists or scans a folder, or given as `root` / `cwd` /
190
255
  `scratchRoot`...: other tests and processes share it; `mkdtempSync(join(tmpdir(), '<prefix>-'))`
191
256
  gives the test a folder of its own); positional parameters (beyond a leading `query` / `tx`, a
192
257
  symmetric pair aside) and abbreviated names are warnings. Without file arguments it records its result
193
258
  in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the files, the errors
194
- and warnings), which the hand-over card reads; a run on named files records nothing.
259
+ and warnings), which `dialecte recap` reads; a run on named files records nothing.
195
260
  - `dialecte gate [--fast | --full] [--base <ref>] [--no-reuse] [--declare <path>]... [--json]` runs the Definition of Done: `--fast` (default) `check`,
196
- `skills:check` and the tests of the changed files; `--full` adds `build`, the whole suite (the runner's
197
- defaults: every file in parallel), `doc:build` and `type-bench:check`. Each step runs unfiltered, with
261
+ `skills:check` and the tests of the changed files; `--full` adds `build` and the whole suite (the
262
+ runner's defaults: every file in parallel). The docs build and the type bench are contributor checks:
263
+ `dialecte contrib` runs them (see [Profiles](#profiles)). Each step runs unfiltered, with
198
264
  `GIT_OPTIONAL_LOCKS=0` (a `git status` inside it never takes the index lock), and is judged on its exit
199
265
  code and on the counts it printed: a step exiting non-zero fails whatever it says, a test step that
200
266
  counts no test fails - except `--fast` on a change that touches no test (a doc edit): the changed-tests
@@ -292,6 +358,21 @@ the answer.
292
358
  stall of its own. Ctrl-C, SIGTERM or SIGHUP received by the cli is passed on to every running child's group.
293
359
  A child that asks the terminal (a gpg or ssh passphrase prompt) runs in a background group: it
294
360
  stops (state `T`) and is reported as stalled.
361
+ - `dialecte contrib [--no-reuse] [--json]` runs the contributor checks of a package whose profile is
362
+ `contributor`, after `gate --full` and before `dialecte handover`, one line per row: `rules` on the files
363
+ changed against HEAD (recorded as `dialecte rules` records it), the package's `dialecte.contrib.steps`
364
+ (default: `docs`, `npm run doc:build` with the `generatedDocs` restored, and `type-bench`,
365
+ `npm run type-bench:check`; `[]` keeps the built-in rows only) run as the gate runs its steps (a missing
366
+ npm script skips the step), `release` (no dependency named by a local folder), then `mutation` when the
367
+ package declares a mutation scope (read from the mutation store now, never recorded). A package step a
368
+ green `gate --full` record of this tree and install passed with the same name and command is not run
369
+ again: its row says `reused from gate --full at <time>`. The run is recorded as `dialecte-gate-contrib.json`
370
+ in the worktree's git folder and stored by tree like a gate record, its key holding HEAD too (the rules
371
+ row reads the changed files against it); a green record of the same key answers the rows
372
+ (`reused: contrib green on this tree at <time> (HEAD <sha>)`), `--no-reuse` runs them and every step a
373
+ `gate --full` passed. Exit 0 green, 1 a row failed, 2 refused (a consumer, where nothing is written, or
374
+ a value of package.json no command accepts). `--json`: `{ profile, rows: [{ name, status, detail }],
375
+ reused?: { at, head } }`.
295
376
  - `dialecte tdd red|green|status [<test file> | <test file>::<case name>]... [--base <ref>] [--json]` makes
296
377
  the order of the work visible: tests written from the spec before any code, red for a real reason, then
297
378
  made green by an implementation that did not touch them. The ledger lives in the worktree's git folder,
@@ -430,15 +511,16 @@ the answer.
430
511
  none. The card reads the gates from their records.
431
512
  It refuses (and writes nothing) when the branch or HEAD differ, `core.hooksPath` names a folder that
432
513
  does not exist (git would skip every hook; it says how to restore it), something is staged, a changed
433
- file is in no lot or in two, or a lot file (evals included) or message holds a plan tag or a standard
434
- citation. Otherwise it writes the hand-over folder - the lots file, the snapshot (`files.txt`,
514
+ file is in no lot or in two, or a lot file (evals included) or message holds a standard citation, one
515
+ of the package's `referencePatterns`, or, in a contributor, a tag (see [Profiles](#profiles)). Otherwise it writes the hand-over folder - the lots file, the snapshot (`files.txt`,
435
516
  `files.sha256`, `files.deleted`, and `lots.sha256`: the lots file as reviewed) and a one-line
436
517
  `commit.sh` that runs
437
518
  `npx --no-install @dialecte/cli handover run <folder>` (bash, also run with `sh`; when the repository
438
519
  installs no cli that can, it says so in one line with the fix) - and prints the hand-over card, the
439
- command with its absolute `cd` under it. `--json` answers the card as data: the verdict, `failedGates`,
440
- `otherTreeGates`, `declarations` (the entries to read), `gates` (the gate lines: name, status, detail),
441
- `tdd` (the tdd lines as the text a person reads, no layout and no padding), `notes`, and each lot with
520
+ command with its absolute `cd` under it. `--json` answers the card as data: the verdict, `profile`,
521
+ `failedGates`, `otherTreeGates`, `declarations` (the entries to read), `gates` (the gate lines: name,
522
+ status, detail), `contrib` (a contributor's contrib rows, one per row: name, status, detail, and `stale`
523
+ or `source` - `rehearsal`, `from <commit>` - when they apply), `tdd` (the tdd lines as the text a person reads, no layout and no padding), `notes`, and each lot with
442
524
  `pending` until it is committed. Edited a file after the review? `--rehash` (also after
443
525
  editing `lots.json`). The repository stays held until every lot is committed: `dialecte gate` runs
444
526
  only under this hand-over (see `gate`), and a hand-over of another folder is refused, naming the script
@@ -458,13 +540,12 @@ the answer.
458
540
  - `gates`: one line per gate step from the gate records (the latest record of each step over `--fast`,
459
541
  `--full` and the commit hook's record, a line of the hook's ending with `commit hook`:
460
542
  `✓ test:run 1214/1214 · commit hook`; a gate record newer than the hook's replaces its lines whole,
461
- since the hook names its own scripts, not the gate's steps), then `rules` from its record, then
462
- `mutation` when the package declares a mutation scope (below), then
463
- `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots. `✓` passed; `!` to
464
- look at (a step not run here, with its reason, or not run after a failure; `rules` never run; no
543
+ since the hook names its own scripts, not the gate's steps), then, in a consumer, `mutation` when the
544
+ package declares a mutation scope (below), then
545
+ `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots, then `standard`. `✓`
546
+ passed; `!` to look at (a step not run here, with its reason, or not run after a failure; no
465
547
  findings ledger, or one holding no row yet: `no findings recorded`; only nits open); `✗` failed (a
466
- failed step,
467
- a rules error, a blocking or should-fix finding open, `gate never run on this tree` when there is no
548
+ failed step, a blocking or should-fix finding open, `gate never run on this tree` when there is no
468
549
  record). The records read are the worktree's last runs and the store's records of the tree the
469
550
  hand-over commits - the worktree's tree, or for a hand-over holding a merge lot the tree its last lot
470
551
  leaves (the trial merge with its resolutions) - the newest record of each step winning; a tdd step
@@ -489,6 +570,22 @@ the answer.
489
570
  `dialecte mutants schedule <follow-up> <key>`; rerun a died run or `dialecte mutants abandon <run id>`;
490
571
  wait for a running run; run `dialecte mutants run` on the tree for a gate lot. The switch is the
491
572
  hand-over folder's `lot.json` when it holds one, else `.dialecte/lot.json`.
573
+ The `standard` line says whether the standard was consulted. A standard is configured when
574
+ `DIALECTE_STANDARD` names a file or folder that exists (the environment only: no committed file names
575
+ it). `✓ standard consulted · <note>` when one is configured and the station recorded a consultation;
576
+ `✗ standard configured, not consulted: dialecte record standard <folder> consulted <note>` (blocks) when
577
+ one is configured and none is recorded; `! standard not consulted: none configured (DIALECTE_STANDARD)`
578
+ otherwise, with the recorded not-consulted reason when there is one: a warning that never blocks. The station records it
579
+ with `dialecte record standard <folder> consulted <note>` or `not-consulted <reason>`.
580
+ - `contrib` (a contributor's): the rows of the `dialecte contrib` record of the tree the hand-over commits,
581
+ read as gate lines (`rules` with its errors and warnings, the package's steps, `release`), then the live
582
+ `mutation` row. A stored record counts when its key is the one the `contrib` guard asks for: a run at
583
+ the lots file's HEAD on that tree, against what is installed now, with the package's contrib rows. Else
584
+ the worktree's last contrib record, each row stale and saying what changed: `(the tree changed since)`,
585
+ `(HEAD moved since: run dialecte contrib again)`, or `(the install or the contrib rows changed since)`;
586
+ else `✗ contrib never run: dialecte contrib`. Every row green prints one line naming the rows, with the
587
+ record's source; any other row expands the section to one line per row. A failed or stale row counts
588
+ with the failed gates and the gates of another tree.
492
589
  - `tdd`: the lot's exemption; only the cases of the change count, those the gate's tdd step listed on
493
590
  this tree (a retitled or removed case's receipts are not counted under the old title); without a gate
494
591
  record of this tree that lists them, one line `counts from the last gate: run the gate on this tree`
@@ -519,7 +616,9 @@ the answer.
519
616
  - `dialecte handover run <folder>` is what `commit.sh` runs. Each guard prints one line with its result
520
617
  and its time (`✓ snapshot 110 file(s) 0.4 s`): repository, the lots file as reviewed, hooks
521
618
  folder, branch, HEAD, empty index, the files against the snapshot, deleted files, files outside the
522
- lots, plan tags and citations, and last `mutation`: the card's `mutation` verdict computed again when the
619
+ lots, references (citations, declared patterns, and the tags of a contributor), `contrib` in a contributor
620
+ (a green `dialecte contrib` record of the tree the lots leave, at the lots file's HEAD, against what is
621
+ installed now; a rehearsal never stops there), and last `mutation`: the card's `mutation` verdict computed again when the
523
622
  guard runs (never taken from the card), so a run that reported a survivor, or died, after the card was
524
623
  written refuses the run with exit 1 and nothing committed (`✗ mutation <detail>`, each survivor and died
525
624
  run indented under it, then what to do with each); a run still running on a plain hand-over passes with
@@ -583,8 +682,12 @@ the answer.
583
682
  commits on: `main moved: ...`), `no green record of the tip's tree <tree>`; `--rehearse --full`
584
683
  rehearses every lot (`--full`). The decisions go to `rehearsal.json` in the hand-over folder
585
684
  (when, and per lot its tree, `reused` or `rehearsed`, the reason and the record reused: mode, time,
586
- HEAD). When every lot is reused no clone is made: the guards, a reused merge's `tree <sha>`, then
587
- `rehearsal skipped: every lot's tree has a green record` and the card. Otherwise the clone is made and
685
+ HEAD, and `contrib: "run"` on a contributor's last lot whose tree has no green contrib record). When every
686
+ lot is reused and no contrib run is needed, no clone is made: the guards, a reused merge's `tree <sha>`,
687
+ then `rehearsal skipped: every lot's tree has a green record` and the card. Otherwise the clone is made
688
+ (`▶ rehearsal contrib` then runs `dialecte contrib` in it at the lots file's HEAD on the tree the lots
689
+ leave, before any commit, its record going to the repository's store as a rehearsal's; the clone is put
690
+ back after it, the files the run left removed) and
588
691
  the reused lots are committed in it with `--no-verify` (their hook skipped, in the clone only), the
589
692
  others with their hook. A real run (no `--rehearse`) runs every commit's hook, whatever the store holds.
590
693
  The rehearsal clone (`▶ rehearsal clone`) warns naming the untracked files outside
@@ -795,6 +898,10 @@ the answer.
795
898
  `worktree add` makes (`.worktrees/core -> ../core`) are in no item. It reads each worktree with
796
899
  `git --no-optional-locks`, so it never rewrites an index. `handover list` follows a link to a hand-over
797
900
  folder and lists a folder reached by its path and through a link once.
901
+ - `dialecte record standard <folder> consulted <note> | not-consulted <reason>` writes `<folder>/standard.json`
902
+ (`{ state, note, at }`, the note's words joined by single spaces) for the card's `standard` line; the line
903
+ references of what was read stay in the findings ledger. Another state, or no note, is a usage error
904
+ (exit 2); a folder inside a repository is refused as below.
798
905
  - `dialecte record review|decision|snapshot` and `dialecte review delta` keep a lot's review rounds in its
799
906
  hand-over folder (`_commit-plan/<topic>-<date>/`), which stays outside every repository: each refuses a
800
907
  folder inside a git work tree or a git folder (`.git/`, a bare repository). `--` ends the options: the
@@ -881,6 +988,7 @@ A package tunes them in its package.json:
881
988
  }
882
989
  ]
883
990
  },
991
+ "profile": "contributor",
884
992
  "generatedDocs": [".vitepress/data/elements-catalog.json"],
885
993
  "referencePatterns": ["SPEC-[0-9]+"],
886
994
  "allowReferences": ["ticket number"],
@@ -892,10 +1000,11 @@ A package tunes them in its package.json:
892
1000
  when it counts no test; `changedOnly: true` marks a step that runs only the tests the change affects,
893
1001
  so "No test files found" passes with a note instead of failing; `restoresGeneratedDocs: true` restores the `generatedDocs` byte for byte after
894
1002
  it); `baseBranch` is the branch
895
- `worktree add` starts from and `worktree prune` compares with (default `main`); `referencePatterns` adds the package's own patterns (extended regular expressions) to the plan
896
- tags and citations `rules` and `handover` refuse; `allowReferences` lifts the generic tags the package commits on
897
- purpose - `ticket number`, `acceptance criterion`, `plan tag` (an app that cites its issue numbers) - and
898
- refuses any other label: a citation of a standard is never allowed. A lot may hold a symbolic link, a link to a
1003
+ `worktree add` starts from and `worktree prune` compares with (default `main`); `referencePatterns` adds the package's own patterns (extended regular expressions) to the
1004
+ citations (and, in a contributor, the tags) `rules` and `handover` refuse; `allowReferences` is the contributor's
1005
+ opt-out: it lifts generic tags a contributor commits on purpose - `ticket number`, `acceptance criterion`,
1006
+ `plan tag` - and refuses any other label in either profile: a citation of a standard is never allowed. A consumer
1007
+ allows every tag already, so `allowReferences` changes nothing there (`dialecte doctor` says to remove it). A lot may hold a symbolic link, a link to a
899
1008
  folder included: it is hashed and scanned as its target text and committed as a link, the way git stores it (a
900
1009
  rehearsal copies it as the same relative link).
901
1010