criteria-review 0.3.0 → 0.3.2

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/agents/README.md CHANGED
@@ -15,14 +15,14 @@ The whole protocol is four ideas. Everything in `skills/` is these, spelled out
15
15
 
16
16
  ### 1. The queue is ordered, and the order is not yours to change
17
17
 
18
- `criteria-review queue` returns what still needs a human decision, most important first: flagged
18
+ `npx criteria-review queue` returns what still needs a human decision, most important first: flagged
19
19
  items, then grouped by document with the riskiest documents leading. The page uses the same
20
20
  ordering from the same module. Reordering it in conversation leaves the architect looking at two
21
21
  different "most important" and unable to tell which is right.
22
22
 
23
23
  ### 2. Show the scenario, do not summarise it
24
24
 
25
- `criteria-review show <ID>` prints the title, status, persona, flags, intent, the Given/When/Then
25
+ `npx criteria-review show <ID>` prints the title, status, persona, flags, intent, the Given/When/Then
26
26
  clauses, and every note. Present all of it, including **an intent line that says it is missing**.
27
27
  A scenario whose intent was never sourced is the most dangerous kind, because a test citing it can
28
28
  never disagree with the software, and omitting the line makes it look fine.
@@ -35,15 +35,15 @@ requirement.
35
35
  Prose in reply to a presented scenario is a note, written verbatim:
36
36
 
37
37
  ```bash
38
- criteria-review note <ID> --message "<their words>"
38
+ npx criteria-review note <ID> --message "<their words>"
39
39
  ```
40
40
 
41
41
  Status moves are separate, named, and never taken unasked:
42
42
 
43
43
  ```bash
44
- criteria-review accept <ID> # what the software SHOULD do
45
- criteria-review verify <ID> --commit <sha> # a person watched it happen
46
- criteria-review reject <ID> # back to derived
44
+ npx criteria-review accept <ID> # what the software SHOULD do
45
+ npx criteria-review verify <ID> --commit <sha> # a person watched it happen
46
+ npx criteria-review reject <ID> # back to derived
47
47
  ```
48
48
 
49
49
  `verify` resolves the commit from the project under review and reports which one it recorded, so a
@@ -77,14 +77,24 @@ not in a session that can end.
77
77
  | `@looknow` | an agent, via `ask` or `flag` | the architect must look at this |
78
78
  | `@review` | the architect writing a note | an agent must act on what they wrote |
79
79
 
80
- An agent asks with `criteria-review ask <ID> --message "..."`, which puts the question beside the
80
+ An agent asks with `npx criteria-review ask <ID> --message "..."`, which puts the question beside the
81
81
  scenario rather than in a transcript that scrolls away. It reads replies with
82
- `criteria-review notes`, acts, then runs `criteria-review handled <ID>`, which clears the
82
+ `npx criteria-review notes`, acts, then runs `npx criteria-review handled <ID>`, which clears the
83
83
  discussion and hands the item back for re-review.
84
84
 
85
85
  **Never clear `@review` by hand.** It is the architect's request, and `handled` is the only thing
86
86
  entitled to retire it.
87
87
 
88
+ ### A note on invoking it
89
+
90
+ Commands here use `npx criteria-review`, which resolves a project's pinned copy first and works
91
+ when there is no package context at all - the situation an agent is usually in.
92
+
93
+ **A GATE must not use `npx`.** It fetches from the registry when the package is absent, which puts
94
+ a network download inside the check and lets a missing dependency read as a pass. A gate resolves
95
+ `node_modules/.bin/criteria-review`, falls back to `PATH`, and fails when neither exists. See
96
+ `docs/standard/emit-contract.md`.
97
+
88
98
  ### And one standing rule
89
99
 
90
100
  **A session that edits an acceptance document regenerates before running tests.** Otherwise the
@@ -17,7 +17,7 @@ open page updates itself, because the server watches the criteria directories.
17
17
  ## Looking one thing up
18
18
 
19
19
  ```bash
20
- criteria-review show <ID> [project]
20
+ npx criteria-review show <ID> [project]
21
21
  ```
22
22
 
23
23
  Present what it prints, in full, as prose the architect can read without decoding:
@@ -55,7 +55,7 @@ every time, and the whole point is that it does not.
55
55
  When the architect answers with prose rather than a command, that prose is the note. Write it:
56
56
 
57
57
  ```bash
58
- criteria-review note <ID> [project] --message "<their words>"
58
+ npx criteria-review note <ID> [project] --message "<their words>"
59
59
  ```
60
60
 
61
61
  **Use their words, not a summary.** The note is sourced intent, which is the one thing that cannot
@@ -119,7 +119,7 @@ If the finding is worth keeping - a real contradiction, or a clause nobody can t
119
119
  record it. It is the agent's finding, so it goes in as the agent:
120
120
 
121
121
  ```bash
122
- criteria-review ask <ID> [project] --message "DRIFT: <clause> is contradicted by <file:line>: <what the code does>" --as <who>
122
+ npx criteria-review ask <ID> [project] --message "DRIFT: <clause> is contradicted by <file:line>: <what the code does>" --as <who>
123
123
  ```
124
124
 
125
125
  That raises `@looknow` rather than `@review`, which is correct: the finding is a question for the
@@ -138,7 +138,7 @@ up. Accepting it is correct even though the software fails it, because `accepted
138
138
  intent, not about the implementation:
139
139
 
140
140
  ```bash
141
- criteria-review accept <ID> --message "WRITE THE CODE TO MATCH: <what the software does instead, in their words>"
141
+ npx criteria-review accept <ID> --message "WRITE THE CODE TO MATCH: <what the software does instead, in their words>"
142
142
  ```
143
143
 
144
144
  Then say plainly how the gap stays visible: a journey citing this scenario now goes **red**, which
@@ -151,7 +151,7 @@ inferred, or it describes an intention nobody holds. Send it back to `derived`,
151
151
  what that status means - written up from the delivered software, describing what it appears to do:
152
152
 
153
153
  ```bash
154
- criteria-review reject <ID> --message "WRITE THE TEST TO MATCH THE CODE: <what the software actually does, in their words>"
154
+ npx criteria-review reject <ID> --message "WRITE THE TEST TO MATCH THE CODE: <what the software actually does, in their words>"
155
155
  ```
156
156
 
157
157
  Both raise `@review`, which hands the item to an agent. Report which one was recorded and what
@@ -173,7 +173,7 @@ mid-pass is how a review of seventy-five scenarios becomes an afternoon on the f
173
173
  ## Walking the queue
174
174
 
175
175
  ```bash
176
- criteria-review queue --limit 10
176
+ npx criteria-review queue --limit 10
177
177
  ```
178
178
 
179
179
  Ordered exactly as the page orders it: flagged items first, then grouped by document with the
@@ -215,11 +215,11 @@ If **you** need the architect's ruling on something and they are not in the conv
215
215
  question belongs beside the scenario rather than in a transcript that scrolls away:
216
216
 
217
217
  ```bash
218
- criteria-review ask <ID> [project] --message "the question" --as <who>
218
+ npx criteria-review ask <ID> [project] --message "the question" --as <who>
219
219
  ```
220
220
 
221
221
  That raises `@looknow` and puts the question in their queue. Read what came back with
222
- `criteria-review notes`, act, then `criteria-review handled <ID>` to hand the item back for
222
+ `npx criteria-review notes`, act, then `npx criteria-review handled <ID>` to hand the item back for
223
223
  re-review.
224
224
 
225
225
  ## Ambiguity
@@ -230,7 +230,7 @@ exists to prevent.
230
230
 
231
231
  ## Related
232
232
 
233
- - `criteria-review guide` and the standard in `docs/standard/` for what the statuses mean and how
233
+ - `npx criteria-review guide` and the standard in `docs/standard/` for what the statuses mean and how
234
234
  criteria are written.
235
- - The visual tool (`criteria-review here`) for a long pass beside the recordings, which is still
235
+ - The visual tool (`npx criteria-review here`) for a long pass beside the recordings, which is still
236
236
  the better surface when there is video to watch.
@@ -17,6 +17,7 @@ import { ejectStandard } from '../src/standard.js';
17
17
  import { isUntracked, needsReview } from '../src/parse.js';
18
18
  import { addNote, setStatus, ACTOR_ARCHITECT } from '../src/write.js';
19
19
  import { orderQueue } from '../public/queue-order.js';
20
+ import { STANDARD_VERSION } from '../src/version.js';
20
21
  import { buildModel, RENDERERS } from '../src/emit.js';
21
22
  import { scanAll as scanAllRoots } from '../src/scan.js';
22
23
  import {
@@ -200,6 +201,7 @@ function usage() {
200
201
  criteria-review flag <ID> mark it LOOK NOW
201
202
  criteria-review unflag <ID> clear LOOK NOW
202
203
  criteria-review standard eject <dir> copy the standard into this project to own it
204
+ criteria-review version package and standard version (also --version)
203
205
  criteria-review guide [skill] print the agent instruction set
204
206
  criteria-review queue what needs a decision here, most important first
205
207
  --limit <n> how many to list (default 10)
@@ -561,6 +563,19 @@ async function main() {
561
563
 
562
564
  if (cmd === 'help' || args._.includes('--help') || args._.includes('-h')) return usage();
563
565
 
566
+ // A gate pins an exact version, so it must be able to report which version ran. Without
567
+ // this an unrecognised flag fell through to STARTING THE REVIEW SERVER and died on
568
+ // EADDRINUSE - a version query that boots a web server is the wrong answer twice over.
569
+ if (cmd === 'version' || args._.includes('--version') || args._.includes('-v')) {
570
+ const pkg = JSON.parse(
571
+ await readFile(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8')
572
+ );
573
+ // Both numbers, because they answer different questions: the package is what you
574
+ // pinned and downloaded, the standard is what your criteria conform to.
575
+ console.log(`criteria-review ${pkg.version} (standard ${STANDARD_VERSION})`);
576
+ return;
577
+ }
578
+
564
579
  if (cmd === 'add') {
565
580
  const path = resolve(args._[1] ?? process.cwd());
566
581
  const name = args._[2] ?? basename(path);
@@ -829,6 +844,15 @@ async function main() {
829
844
 
830
845
  if (cmd === 'list') return cmdList(roots);
831
846
 
847
+ // Anything that looks like a command or a flag but was not recognised is an error, not
848
+ // an instruction to open the review UI. The old fallthrough turned a typo - or a flag a
849
+ // newer version understands - into a server start, which in a pipeline is a hang and on
850
+ // a desk is EADDRINUSE from the server already running.
851
+ if (cmd !== undefined || args._.some((a) => a.startsWith('-'))) {
852
+ const what = cmd ?? args._.find((a) => a.startsWith('-'));
853
+ throw new Error(`unknown command "${what}". Run: criteria-review help`);
854
+ }
855
+
832
856
  const cfg = await loadConfig();
833
857
  const mediaRoot = await resolveMediaRoot(cfg.mediaRoot);
834
858
  // Re-read the config per request so `here` takes effect without a restart.
@@ -33,7 +33,7 @@ Everything else in the tool exists to make one of those three steps cheaper.
33
33
  From inside any working tree:
34
34
 
35
35
  ```bash
36
- criteria-review here
36
+ npx criteria-review here
37
37
  ```
38
38
 
39
39
  That registers the tree, starts the server if it is down, and opens the page on this project.
@@ -43,7 +43,7 @@ repository without checking anything first.
43
43
  Give it a name when the directory name is not distinctive:
44
44
 
45
45
  ```bash
46
- criteria-review here . playwright-worktree
46
+ npx criteria-review here . playwright-worktree
47
47
  ```
48
48
 
49
49
  Several trees can be registered at once, **including two checkouts of the same repository**. A
@@ -112,19 +112,19 @@ The loop closes like this, and each step hands the item to exactly one side:
112
112
 
113
113
  1. A session asks a question beside the scenario it is about:
114
114
  ```bash
115
- criteria-review ask CO-TYPES-006 myproject --message "Blank cell, or the word none?" --as claude
115
+ npx criteria-review ask CO-TYPES-006 myproject --message "Blank cell, or the word none?" --as claude
116
116
  ```
117
117
  That writes the question as a note and raises `@looknow`.
118
118
  2. You answer in the same pane by writing a note. That raises `@review` and clears `@looknow`.
119
- 3. The session reads it with `criteria-review notes`, acts, and runs
120
- `criteria-review handled CO-TYPES-006`, which removes the discussion and raises `@looknow` so
119
+ 3. The session reads it with `npx criteria-review notes`, acts, and runs
120
+ `npx criteria-review handled CO-TYPES-006`, which removes the discussion and raises `@looknow` so
121
121
  the item comes back to you for re-review.
122
122
 
123
123
  **Acting on a flagged scenario clears the flag.** Accepting it, marking it verified, sending it
124
124
  back, writing a note - each one is you looking, so none of them leaves a badge behind demanding
125
125
  attention you have already given.
126
126
 
127
- There is also `criteria-review push`, which changes what an open page is showing and never
127
+ There is also `npx criteria-review push`, which changes what an open page is showing and never
128
128
  touches disk. Use it when someone is at the screen; use a flag when the finding should wait for
129
129
  the next review pass.
130
130
 
@@ -133,8 +133,8 @@ the next review pass.
133
133
  The last step, and the one that stops the criteria and the tests drifting apart:
134
134
 
135
135
  ```bash
136
- criteria-review generate . --out tests/e2e/support/scenarios.generated.ts
137
- criteria-review generate . --out tests/e2e/support/scenarios.generated.ts --check
136
+ npx criteria-review generate . --out tests/e2e/support/scenarios.generated.ts
137
+ npx criteria-review generate . --out tests/e2e/support/scenarios.generated.ts --check
138
138
  ```
139
139
 
140
140
  A journey's step names are supposed to be the scenario's own Given/When/Then wording. Typing
@@ -152,10 +152,10 @@ Full detail in **The emit contract**, and the step-by-step in **Adopting the sta
152
152
  ## Housekeeping
153
153
 
154
154
  ```bash
155
- criteria-review status # exits 1 when down, 0 when up
156
- criteria-review list # a summary in the terminal, touches nothing
157
- criteria-review projects # what is registered, and where
158
- criteria-review stop | restart
155
+ npx criteria-review status # exits 1 when down, 0 when up
156
+ npx criteria-review list # a summary in the terminal, touches nothing
157
+ npx criteria-review projects # what is registered, and where
158
+ npx criteria-review stop | restart
159
159
  ```
160
160
 
161
161
  The server exits on its own after two hours with no page open, so there is nothing to remember to
@@ -11,13 +11,13 @@ bump rather than quietly. See `../decisions.md` D-003, D-004, D-005.
11
11
  ```bash
12
12
  # Write the artefact. The consumer's package script is where this lives, so it travels
13
13
  # with the repository and works on a machine that has never registered anything.
14
- criteria-review generate . --out tests/e2e/support/scenarios.generated.ts
14
+ npx criteria-review generate . --out tests/e2e/support/scenarios.generated.ts
15
15
 
16
16
  # Verify it matches the documents, change nothing, exit non-zero if it does not.
17
- criteria-review generate . --out tests/e2e/support/scenarios.generated.ts --check
17
+ npx criteria-review generate . --out tests/e2e/support/scenarios.generated.ts --check
18
18
 
19
19
  # The neutral artefact, for a consumer that is not TypeScript.
20
- criteria-review generate . --out build/scenarios.json --format json
20
+ npx criteria-review generate . --out build/scenarios.json --format json
21
21
  ```
22
22
 
23
23
  `--format` defaults from the output extension.
@@ -46,6 +46,33 @@ Three places, each doing a different job:
46
46
  tool is needed to regenerate and to verify, never to compile. A build that could not run without
47
47
  a locally-installed personal tool would be an unacceptable dependency for a project.
48
48
 
49
+ ### Resolving the binary in a gate, which is NOT `npx`
50
+
51
+ A gate must resolve the project's own pinned copy, fall back to whatever is on `PATH`, and
52
+ **fail loudly when neither exists**:
53
+
54
+ ```sh
55
+ BIN="$(git rev-parse --show-toplevel)/<pkg-dir>/node_modules/.bin/criteria-review"
56
+ [ -x "$BIN" ] || BIN="$(command -v criteria-review || true)"
57
+ [ -n "$BIN" ] || { echo "criteria-review not installed; the criteria gate cannot run" >&2; exit 1; }
58
+ "$BIN" generate . --out ... --check
59
+ ```
60
+
61
+ **Do not use `npx` here.** It fetches from the registry when the package is absent, which puts a
62
+ network download inside the gate and lets a missing devDependency read as a pass - the check
63
+ appears to run, against a version nobody pinned. `npx` is right for ad-hoc use and for an agent
64
+ that may have no package context at all; it is wrong for anything whose job is to fail.
65
+
66
+ The same reason rules out a bare `command -v criteria-review` guard: a project that pinned the
67
+ tool as a devDependency has no such binary on `PATH`, so the guard skips the gate on exactly the
68
+ machine that configured it correctly.
69
+
70
+ **Report the version the gate ran**, so a failure names it:
71
+
72
+ ```sh
73
+ "$BIN" --version # criteria-review 0.3.2 (standard 1.1.2)
74
+ ```
75
+
49
76
  ## What is emitted
50
77
 
51
78
  Only scenarios that can be cited. A scenario with no id or no status is excluded, because
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "criteria-review",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "private": false,
5
5
  "description": "Review acceptance criteria across projects, and generate the scenario clauses your tests cite.",
6
6
  "license": "MIT",