@dialecte/cli 0.2.0 → 0.2.1

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 (3) hide show
  1. package/README.md +22 -2
  2. package/dist/cli.js +695 -536
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -32,6 +32,7 @@ dialecte models # which model each tier (fast, standard, strong, fron
32
32
  dialecte doctor # versions, core API generation, skills and station agents in sync, local checkouts
33
33
  dialecte rules # code-rules self-check of the changed files
34
34
  dialecte gate [--full] # the package's Definition of Done, with the real counts
35
+ dialecte gate --hook # in a commit hook: the suite, unless a green gate --full of the committed tree answers it
35
36
  dialecte tdd red|green|status # receipts: each new test failed on an assertion before the code, then passed untouched
36
37
  dialecte new verb <namespace> <query|transaction> <name>
37
38
  dialecte handover <lots.json> # the guarded commit-by-lots hand-over a human runs (run, list)
@@ -218,6 +219,22 @@ the answer.
218
219
  whatever the store holds. The key leaves out the Node version and the environment (a path given
219
220
  through an environment variable); a `file:` dependency edited and restored to the same size within
220
221
  the same modification time is not seen either.
222
+ - `dialecte gate --hook [--no-reuse]` runs in a commit hook: the test steps of `--full` (its steps counting
223
+ tests), unless a green `--full` record of what is committed answers them. Its key is the one a `--full` run of
224
+ that state stores - the tree, what npm installed, the `file:` dependencies, the full gate's command hash - with
225
+ the tree taken from the index git hands the hook (`GIT_INDEX_FILE`, else the worktree's index), never from the
226
+ working files: a merge commit and a partial commit check what they record. A green record of that key prints
227
+ one line, `gate --hook: tests reused from gate --full green on tree <tree> at <time> (HEAD <sha>)`, and runs
228
+ nothing; otherwise `gate --hook: no green gate --full of tree <tree> with this install: running the tests`, the
229
+ test steps (rerun serially on a failure, as the gate does), then one vitest summary line of their summed counts (what the hand-over's hook reader counts),
230
+ and `gate --hook: green` or `gate --hook: failed at <step>` (exit 1). It runs no hygiene and no tdd step,
231
+ reads no hand-over hold (it runs inside `handover run`'s own commit) and records nothing: `handover run`
232
+ records the hook. `--no-reuse` runs the tests whatever the store holds, and so does a hook whose git variables name another
233
+ repository than its folder's (the cli ignores them, so what is committed is unknown); `--hook` with `--fast` or `--full` is
234
+ refused (exit 2). Write it in the hook as an npm script (`"test:hook": "dialecte gate --hook"`), so the
235
+ hand-over reads it as a test step of its own: its card line reads `reused by the hook` when the hook answered
236
+ from a record. The cli's own hook runs `npm run check` (type-check, lint, format; no suite), `npm run
237
+ test:hook`, then `npm run build`.
221
238
  - A running step looks running. Each `gate` step and `tdd`'s vitest run is announced before its work:
222
239
  off a terminal a start line `▶ <step>` (then a line every 30 s of silence and the result), on a
223
240
  terminal one spinner line `⠋ <step> - <what runs> <elapsed>` that the step's result line replaces (the
@@ -1041,9 +1058,12 @@ lockfile). Build core there (`npm run build`) before running the tests. A releas
1041
1058
  per dependency (its field, name and spec), and says how to pin it
1042
1059
  (`npm install --save-exact <name>@<version>`).
1043
1060
 
1044
- The cli has a commit hook: `.husky/pre-commit` runs `npm run check`, then `npm run build`. `npm install` in the
1061
+ The cli has a commit hook: `.husky/pre-commit` runs `npm run check` (type-check, lint, format; no suite), then
1062
+ `npm run test:hook` (`dialecte gate --hook` from the sources: the suite, unless a green `gate --full` of the
1063
+ committed tree answers it), then `npm run build`. `npm install` in the
1045
1064
  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
1065
+ copies `.husky/_` into each new worktree, so `handover run` proves a cli lot again at its commit, running the
1066
+ suite only for a tree no green `gate --full` checked. A hook
1047
1067
  runs with git's `GIT_DIR`, `GIT_INDEX_FILE` and the commit's identity set: the suite's setup file
1048
1068
  (`test/git-environment.setup.ts`, vitest `setupFiles`) clears them before any test, so a test's git acts on
1049
1069
  its scratch repository only, and the cli clears git's repository variables at its start.