slicekit 0.7.1 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicekit",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Spec-driven agentic workflow kit",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12,7 +12,8 @@ import { readSlice } from '../state/index.js';
12
12
  import { titleSlice } from '../check/rules/ci-title.js';
13
13
  import { posixRel } from './red.js';
14
14
  import { commits } from './sync.js';
15
- import { independentVerdictPath } from './verdict.js';
15
+ import { extraRounds, independentBlockers, independentRoundAllowed, independentVerdictPath, stopText } from './verdict.js';
16
+ import { parseVerdict } from '../verdict.js';
16
17
  import { BuildError, listWorktrees, reviewBranch, reviewWorktreeDir, samePath } from './worktree.js';
17
18
 
18
19
  const fwd = (p) => p.replaceAll('\\', '/');
@@ -58,8 +59,8 @@ function clearOld(root, id, dir, branch) {
58
59
  if (lines(git(root, ['branch', '--list', branch])).length > 0) git(root, ['branch', '-q', '-D', branch]);
59
60
  }
60
61
 
61
- // The pull request number the slice's state on `ref` records, or null when it records none.
62
- function recordedNumber(root, cfg, id, ref) {
62
+ // The slice's state as `ref` holds it, or null when it holds none or it does not parse.
63
+ function stateOn(root, cfg, id, ref) {
63
64
  const rel = posixRel(root, path.join(kitPaths(root, cfg).state, stateFileName(id)));
64
65
  let text;
65
66
  try {
@@ -69,15 +70,39 @@ function recordedNumber(root, cfg, id, ref) {
69
70
  return null;
70
71
  }
71
72
  try {
72
- return JSON.parse(text).pr?.number ?? null;
73
+ return JSON.parse(text);
73
74
  } catch {
74
75
  return null;
75
76
  }
76
77
  }
77
78
 
79
+ // The independent round budget (REQ-2.8, D-101), judged on the slice's state on `ref`: one round, a
80
+ // second only when the first left a blocker, any later one only with a decision row for it. A refusal
81
+ // names the latest round's open blockers and the three choices.
82
+ function assertRoundLeft(root, cfg, id, number, ref, state) {
83
+ const verdicts = Array.isArray(state?.verdicts) ? state.verdicts : [];
84
+ const counts = independentBlockers(verdicts);
85
+ if (independentRoundAllowed(counts, extraRounds(root, cfg, id))) return;
86
+ const latest = verdicts.filter((v) => v.independent).sort((a, b) => a.round - b.round).at(-1);
87
+ if (counts.at(-1) === 0) {
88
+ const decisions = posixRel(root, kitPaths(root, cfg).decisions);
89
+ throw new BuildError(
90
+ `the independent review of ${id} left no blocker in round ${latest.round}; another independent round starts only after a blocker, or with a decision row in ${decisions} whose answer names ${id} and says "one more round" (D-101)`,
91
+ );
92
+ }
93
+ let blockers;
94
+ try {
95
+ blockers = parseVerdict(git(root, ['show', `${ref}:${latest.path}`]), latest.path).findings.filter((f) => f.kind === 'blocker');
96
+ } catch (e) {
97
+ if (!(e instanceof GitError)) throw e;
98
+ blockers = [];
99
+ }
100
+ throw new BuildError(stopText(root, cfg, id, number, latest.round, blockers));
101
+ }
102
+
78
103
  // -> {id, worktree, branch, round, verdictPath}: `round` is the slice's verdict count plus one, and
79
104
  // `verdictPath` the absolute session-root path of that round's independent verdict. Every refusal
80
- // comes before an earlier review worktree is touched.
105
+ // comes before an earlier review worktree is touched, the round budget's too (D-101).
81
106
  export function startReview(root, cfg, host, number) {
82
107
  const pr = host.getPullRequest(number);
83
108
  const id = titleSlice(pr.title ?? '');
@@ -108,8 +133,13 @@ export function startReview(root, cfg, host, number) {
108
133
  if (typeof pr.headSha === 'string' && pr.headSha !== '' && pr.headSha !== tip) {
109
134
  throw new BuildError(`pull request #${number}'s head ${pr.headSha.slice(0, 7)} is not origin/${headRef}; is it from a fork? If the branch was just pushed, run the same command again in a minute`);
110
135
  }
111
- const recorded = recordedNumber(root, cfg, id, tracking);
136
+ // The default branch as origin has it now: the round budget reads its decision rows there, so a row
137
+ // merged on origin since the last fetch counts (D-101).
138
+ git(root, ['fetch', '-q', 'origin', `+refs/heads/${cfg.defaultBranch}:refs/remotes/origin/${cfg.defaultBranch}`]);
139
+ const onOrigin = stateOn(root, cfg, id, tracking);
140
+ const recorded = onOrigin?.pr?.number ?? null;
112
141
  if (recorded !== null && recorded !== number) throw new BuildError(`pull request #${number} is not the one recorded for ${id} (#${recorded})`);
142
+ assertRoundLeft(root, cfg, id, number, tracking, onOrigin);
113
143
 
114
144
  const dir = reviewWorktreeDir(root, addr);
115
145
  clearOld(root, id, dir, branch);
@@ -7,14 +7,17 @@
7
7
  //
8
8
  // Two in-loop rounds (D-18): a third is refused before anything moves, and a blocker left at round 2
9
9
  // records `changes-requested` and stops the loop with the pull request still a draft. After every
10
- // verdict the body's "Reviewer blocked" names each blocker and whether it was fixed.
10
+ // verdict the body's "Reviewer blocked" names each blocker and whether it was fixed. The independent
11
+ // rounds have their own budget (D-101): one, a second only after a blocker, any later one only with a
12
+ // decision row; a blocker left at the last allowed round records `changes-requested` the same way.
11
13
  //
12
14
  // Finding IDs name one finding for the whole slice: a finding that survives keeps its ID, a new one
13
15
  // takes a number never used before in the slice (B and H counted apart). An ID absent from the
14
16
  // previous verdict is new, so a finding that vanished and came back must take a new number.
15
17
  import fs from 'node:fs';
16
18
  import path from 'node:path';
17
- import { git, headSha, pushBranch } from '../git.js';
19
+ import { GitError, git, headSha, pushBranch } from '../git.js';
20
+ import { defaultRef } from '../runbook.js';
18
21
  import { sliceFromBranch, verdictFileName, verdictFilePattern } from '../ids.js';
19
22
  import { readSlice } from '../state/index.js';
20
23
  import { headCovers } from '../state/covers.js';
@@ -23,6 +26,8 @@ import { bannedPhrasesIn } from '../check/rules/style.js';
23
26
  import { buildContext } from '../check/context.js';
24
27
  import references from '../check/rules/references.js';
25
28
  import { loadConfig } from '../config.js';
29
+ import { readDecisions } from '../decisions.js';
30
+ import { kitPaths } from '../paths.js';
26
31
  import { lines as splitLines } from '../markdown.js';
27
32
  import { PrBodyError, getSection, prBodyProblems, setSection } from '../prbody.js';
28
33
  import { parseVerdict, verdictProblems } from '../verdict.js';
@@ -133,6 +138,62 @@ function verdictSource(wt, id, k, src, dest, rel, shown) {
133
138
 
134
139
  const inLoop = (verdicts) => verdicts.filter((x) => !x.independent).length;
135
140
 
141
+ // ---- The independent round budget (REQ-2.8, D-101) ----
142
+
143
+ const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
144
+
145
+ // The settled decision rows of `<docsRoot>/decisions.md` that allow `id` one more independent round:
146
+ // the answer names the slice ID and the words "one more round". The file is read as committed on the
147
+ // default branch (origin's tip, else the local one), so an uncommitted row or one on another branch
148
+ // allows nothing. 0 when that commit holds no file.
149
+ export function extraRounds(root, cfg, id) {
150
+ const rel = posixRel(root, kitPaths(root, cfg).decisions);
151
+ let text;
152
+ try {
153
+ text = git(root, ['show', `${defaultRef(root, cfg)}:${rel}`]);
154
+ } catch (e) {
155
+ if (!(e instanceof GitError)) throw e;
156
+ return 0;
157
+ }
158
+ const names = new RegExp(`(?<![\\w/])${escapeRe(id)}(?!\\d)`);
159
+ return readDecisions(text).rows.filter((r) => r.table === 'settled' && names.test(r.answer) && /\bone more round\b/i.test(r.answer)).length;
160
+ }
161
+
162
+ // Whether one more independent round may start after the independent verdicts recorded, given as
163
+ // their blocker counts in round order: the first always; a second only when the first left a blocker;
164
+ // any later one only with a decision row for it (`extra` rows allow `extra` rounds beyond those).
165
+ export function independentRoundAllowed(blockerCounts, extra = 0) {
166
+ const n = blockerCounts.length;
167
+ if (n === 0) return true;
168
+ const base = blockerCounts[0] > 0 ? 2 : 1;
169
+ if (n < base && blockerCounts.at(-1) > 0) return true;
170
+ return n - base < extra;
171
+ }
172
+
173
+ // The blocker counts of the independent verdicts in the slice's state entries, in round order.
174
+ export const independentBlockers = (verdicts) =>
175
+ [...verdicts]
176
+ .filter((v) => v.independent)
177
+ .sort((a, b) => a.round - b.round)
178
+ .map((v) => Number(v.blockers ?? 0));
179
+
180
+ // The three choices for a person when the independent rounds are used (REQ-2.8, D-101): `review start`
181
+ // and `build verdict --independent` both print them.
182
+ export const STOP_CHOICES = [
183
+ 'fix the open blockers by hand in the slice worktree and push them with slicekit build pr <id>',
184
+ 're-scope the slice: amend the slice file so the blockers fall outside it, or move them to a new slice',
185
+ 'allow one more round: record a decision row in <decisions> whose answer names <id> and says "one more round", commit it on the default branch and push it to origin, then run slicekit review start <n> again',
186
+ ];
187
+
188
+ // The stop text: the open blockers of the latest independent round, each with its "what is wrong",
189
+ // then the three choices.
190
+ export function stopText(root, cfg, id, number, round, blockers) {
191
+ const decisions = posixRel(root, kitPaths(root, cfg).decisions);
192
+ const open = blockers.map((f) => `- ${f.id} ${quoted(f.wrong)}`);
193
+ const choices = STOP_CHOICES.map((c, i) => `${i + 1}. ${c.replaceAll('<id>', id).replaceAll('<n>', String(number)).replaceAll('<decisions>', decisions)}`);
194
+ return [`no independent round is left for ${id} (D-101); round ${round}'s verdict holds open blockers:`, ...open, 'choose one:', ...choices].join('\n');
195
+ }
196
+
136
197
  // A verdict file's absolute path in the session root, with forward slashes: the reviewer works in
137
198
  // the worktree, so a relative path would land there.
138
199
  const inSessionRoot = (root, name) => path.resolve(root, ...REVIEWS.split('/'), name).split(path.sep).join('/');
@@ -165,18 +226,32 @@ const withNextPath = (root, id, result, verdicts, independent) => ({
165
226
  verdictPath: !independent && (result.next === 'fix' || result.next === 'ask') ? nextVerdictPath(root, id, verdicts) : null,
166
227
  });
167
228
 
168
- // An independent verdict sits outside the in-loop cap (D-18): its blockers ask for a fix, never
169
- // `stuck`, and without blockers it goes to CI; its should-haves are the review procedure's to list.
170
- function outcome(k, v, verdicts, independent) {
229
+ // An independent verdict sits outside the in-loop cap (D-18): its blockers ask for a fix while
230
+ // another independent round is left (`left`, D-101), else `stuck`; without blockers it goes to CI;
231
+ // its should-haves are the review procedure's to list.
232
+ function outcome(k, v, verdicts, independent, left = true) {
171
233
  const blockers = v.findings.filter((f) => f.kind === 'blocker').map((f) => f.id);
172
234
  const shouldHaves = v.findings.filter((f) => f.kind === 'should-have').map((f) => f.id);
173
235
  const roundsUsed = inLoop(verdicts);
174
236
  let next = 'ci';
175
- if (blockers.length > 0) next = independent || roundsUsed < LOOP_ROUNDS ? 'fix' : 'stuck';
237
+ if (blockers.length > 0) next = (independent ? left : roundsUsed < LOOP_ROUNDS) ? 'fix' : 'stuck';
176
238
  else if (shouldHaves.length > 0 && !independent) next = 'ask';
177
239
  return { round: k, blockers, shouldHaves, roundsUsed, next };
178
240
  }
179
241
 
242
+ // The independent outcome with what a person needs (D-101): on `fix`, `reviewStart`, the command of
243
+ // the next independent round; on `stuck`, `stop`, the open blockers and the three choices.
244
+ function independentOutcome(root, cfg, id, number, k, v, verdicts) {
245
+ const left = independentRoundAllowed(independentBlockers(verdicts), extraRounds(root, cfg, id));
246
+ const result = outcome(k, v, verdicts, true, left);
247
+ if (result.next === 'fix') return { ...result, reviewStart: `slicekit review start ${number}` };
248
+ if (result.next === 'stuck') return { ...result, stop: stopText(root, cfg, id, number, k, v.findings.filter((f) => f.kind === 'blocker')) };
249
+ return result;
250
+ }
251
+
252
+ const outcomeOf = (root, cfg, id, number, k, v, verdicts, independent) =>
253
+ independent ? independentOutcome(root, cfg, id, number, k, v, verdicts) : outcome(k, v, verdicts, false);
254
+
180
255
  const push = (wt, cfg) => pushBranch(wt, { protectedBranches: cfg.protectedBranches, defaultBranch: cfg.defaultBranch });
181
256
 
182
257
  const blockersOf = (v) => (v?.findings ?? []).filter((f) => f.kind === 'blocker');
@@ -338,7 +413,10 @@ function assertBuilt(wt, id, current) {
338
413
  // -> {round, blockers, shouldHaves, roundsUsed, next, verdictPath}: `blockers` and `shouldHaves` are
339
414
  // finding IDs; `next` is `fix`, `ask`, `ci`, or `stuck` when an in-loop verdict leaves blockers at the last round.
340
415
  // `stuck` is returned, not thrown: the loop has stopped and changes-requested is recorded, and a
341
- // caller must exit 1 on it (the CLI does). `verdictPath` is the next round's file (nextVerdictPath)
416
+ // caller must exit 1 on it (the CLI does). An independent verdict is `stuck` when it leaves a blocker
417
+ // and no independent round is left (D-101); it then carries `stop`, the open blockers and the three
418
+ // choices to print, and on `fix` `reviewStart`, the command of the next independent round.
419
+ // `verdictPath` is the next round's file (nextVerdictPath)
342
420
  // on `fix` or `ask` of an in-loop verdict, else null.
343
421
  //
344
422
  // `independent` (D-39): the verdict of an independent review, named `<P-S>i-r<k>.md`, recorded from
@@ -397,7 +475,8 @@ export function recordVerdict(root, cfg, host, id, file, { worktree, independent
397
475
  fs.rmSync(src);
398
476
  }
399
477
  const v = checked(text, rel, name, independent);
400
- return withNextPath(root, id, finish(wt, cfg, host, id, current, outcome(k, v, verdicts, independent), verdicts, independent), verdicts, independent);
478
+ const result = outcomeOf(root, cfg, id, current.pr.number, k, v, verdicts, independent);
479
+ return withNextPath(root, id, finish(wt, cfg, host, id, current, result, verdicts, independent), verdicts, independent);
401
480
  }
402
481
 
403
482
  // D-18: two in-loop rounds; independent verdicts (D-39) do not count against them.
@@ -420,7 +499,8 @@ export function recordVerdict(root, cfg, host, id, file, { worktree, independent
420
499
  const unknown = referenceProblems(wt, rel, text, shown);
421
500
  if (unknown.length > 0) throw new BuildError(unknown.join('\n'));
422
501
  // The line this round would write, judged against the live body before anything moves.
423
- const stuck = outcome(k, v, [...verdicts, { independent }], independent).next === 'stuck';
502
+ const blockerCount = v.findings.filter((f) => f.kind === 'blocker').length;
503
+ const stuck = outcomeOf(root, cfg, id, current.pr.number, k, v, [...verdicts, { round: k, independent, blockers: blockerCount }], independent).next === 'stuck';
424
504
  const line = reviewerBlocked([...parsedVerdicts(wt, verdicts), { round: k, findings: v.findings, headSha: current.pr.headSha, independent }], {
425
505
  stuck,
426
506
  covers: coversIn(wt),
@@ -433,7 +513,7 @@ export function recordVerdict(root, cfg, host, id, file, { worktree, independent
433
513
  if (here && moved) fs.rmSync(src);
434
514
  else if (here) move(src, dest);
435
515
  commitBookkeeping(wt, id, `verdict r${k}`, [rel]);
436
- const blockers = v.findings.filter((f) => f.kind === 'blocker').length;
437
- const state = recordState(wt, cfg, id, 'in-review', { verdict: { round: k, path: rel, blockers, independent } });
438
- return withNextPath(root, id, finish(wt, cfg, host, id, state, outcome(k, v, state.verdicts, independent), state.verdicts, independent), state.verdicts, independent);
516
+ const state = recordState(wt, cfg, id, 'in-review', { verdict: { round: k, path: rel, blockers: blockerCount, independent } });
517
+ const result = outcomeOf(root, cfg, id, state.pr.number, k, v, state.verdicts, independent);
518
+ return withNextPath(root, id, finish(wt, cfg, host, id, state, result, state.verdicts, independent), state.verdicts, independent);
439
519
  }
package/src/cli/build.js CHANGED
@@ -172,9 +172,11 @@ function verdictStep(root, io, positionals, values) {
172
172
  const out = [`next: ${r.next}`, `blockers: ${list(r.blockers)}`, `should-haves: ${list(r.shouldHaves)}`, `rounds: ${r.roundsUsed} of ${LOOP_ROUNDS}`];
173
173
  if (r.next === 'ask' && r.roundsUsed >= LOOP_ROUNDS) out.push('fix: not available after round 2; decline or leave for the independent review');
174
174
  if (r.verdictPath) out.push(`verdict ${r.verdictPath}`);
175
+ // D-101: the command of the next independent round, when one is left after a blocker.
176
+ if (r.reviewStart) out.push(`review: ${r.reviewStart}`);
175
177
  io.stdout(out.map((l) => `${l}\n`).join(''));
176
178
  if (r.next === 'stuck') {
177
- io.stderr(`slicekit: stopped: ${r.blockers.join(', ')} survive round ${r.round}; the pull request stays draft\n`);
179
+ io.stderr(`slicekit: stopped: ${r.blockers.join(', ')} survive round ${r.round}; the pull request stays draft\n${r.stop ? `${r.stop}\n` : ''}`);
178
180
  return 1;
179
181
  }
180
182
  return 0;
@@ -1,10 +1,10 @@
1
1
  # Brief: reviewer
2
2
 
3
- You review one slice and write one verdict file. You try to break the change: run its tests, read its diff against the slice file, the requirements it cites and the writing rules.
3
+ You review one slice and write one verdict file. You try to break the change: run its tests and read its diff against the slice file, its requirements and the writing rules.
4
4
 
5
5
  ## You write
6
6
 
7
- One verdict file and nothing else. The command gives you the absolute path to write it at; the path ends `.slicekit/reviews/P<n>-S-<nn>[i]-r<k>.md` and is in the session root, never under the worktree. `k` is the round; the letter `i` marks an independent review. The file has this shape:
7
+ One verdict file and nothing else. The command gives you the absolute path: it ends `.slicekit/reviews/P<n>-S-<nn>[i]-r<k>.md` and is in the session root, never under the worktree. `k` is the round; the letter `i` marks an independent review. The file has this shape:
8
8
 
9
9
  ```
10
10
  Verdict: BLOCK
@@ -41,23 +41,23 @@ The rest of the file:
41
41
 
42
42
  ## Reviewing a slice
43
43
 
44
- The command gives you the pull request number, the worktree, the round `k` and the verdict file's absolute path. Write the verdict at that path.
44
+ The command gives you the pull request, the worktree, the round `k` and the verdict path. Your round budget (REQ-2.6, REQ-2.8): two build rounds, one independent round and a second only after a blocker; a blocker left in the last round stops the slice.
45
45
 
46
46
  1. Read the slice file in the worktree, the change with `git diff <base>...HEAD` run in the worktree (read only; `<base>` is `defaultBranch` in `.slicekit/config.json`), and the pull request body.
47
- 2. Run the test command and `{{cli}} check` in the worktree. Quote each one's summary line in the "How verified" column of the findings it supports.
48
- 3. A blocker is one of these: a Done when check that fails; a REQ or D row the change breaks; a rule weakened or a baseline raised (REQ-3.7); a writing-rule breach in the pull request body. Every other finding is a should-have.
49
- 4. Finding IDs are unique within the slice. A finding that survives from an earlier round keeps its ID. A new finding takes the next number never used in this slice, B and H counted apart: after B-1 and B-2, a new blocker is B-3 even when B-2 was fixed. A verdict that reuses a number, or gives a finding that went away its old ID, is refused.
50
- 5. A verdict that uses a phrase from `style.banned` in `.slicekit/config.json`, or names missing IDs or backticked paths, is refused; reword it. The pull request body quotes each "What is wrong" as a code span, so a `<!--` in it is refused.
51
- 6. A should-have whose issue the pull request body lists under "Should-haves declined" is not raised again.
52
- 7. A finding states the fault and stops: no praise, no question, no code.
47
+ 2. Run the test command and `{{cli}} check` in the worktree. Quote each summary line in the "How verified" column of the findings it supports.
48
+ 3. A blocker is: a Done when check that fails; a REQ or D row the change breaks; a rule weakened or a baseline raised (REQ-3.7); a writing-rule breach in the pull request body. Every other finding is a should-have.
49
+ 4. A finding that survives from an earlier round keeps its ID. A new finding takes the next number never used in this slice, B and H counted apart: after B-1 and B-2, a new blocker is B-3 even if B-2 was fixed. Any other ID is refused.
50
+ 5. A verdict with a phrase from `style.banned` in `.slicekit/config.json`, an unknown slice, requirement or decision ID, a missing backticked path, or a `<!--` in a "What is wrong", is refused; reword it.
51
+ 6. A should-have the pull request body lists under "Should-haves declined" is not raised again.
52
+ 7. A finding states the fault and stops; it holds no code. You report no finding on wording, formatting or naming alone, and no finding when you have none: then write `Verdict: APPROVE` with an empty findings table.
53
53
 
54
54
  ## You never
55
55
 
56
56
  - Write or change code, tests or any file other than the verdict.
57
- - Ask a question. A doubt you cannot settle is a finding or a `## Not checked` item.
57
+ - Ask a question; a doubt is a finding or a `## Not checked` item.
58
58
  - Praise the change.
59
59
  - Run git, except the read-only `git diff`, `git log`, `git show` and `git status`. You never commit or push the verdict; the command does that.
60
60
 
61
61
  ## Your report
62
62
 
63
- Your reply names the verdict file's path and its verdict line. It ends with a `Skipped:` line and then a `Not checked:` line. Each of these lines starts at the beginning of its line, with no list marker, bold or backticks. When you stop, the newest verdict file of this slice is checked against the shape above; a missing or malformed file is refused.
63
+ Your reply names the verdict file's path and verdict line. It ends with a `Skipped:` line and then a `Not checked:` line. Each of these lines starts at the beginning of its line, with no list marker, bold or backticks. When you stop, the newest verdict file of this slice is checked against the shape above.
@@ -18,6 +18,10 @@ it is left to the person who started this session. When this session built the s
18
18
  the building session's context, stop and tell the human to run `/slicekit review <PR>` in a new
19
19
  session.
20
20
 
21
+ A reviewer subagent started by `{{cli}} review start <PR>` from the main checkout, given only the
22
+ pull request and the reviewer's brief and no build context, counts as independent, and
23
+ `/slicekit review` in a new session is the stronger form (D-104).
24
+
21
25
  When the arguments are `(none)`, ask the human for the pull request's number and use it in place of
22
26
  `{{args}}` below. Call that number `<n>`.
23
27
 
@@ -39,6 +43,13 @@ refusal and stop, since the human decides each of these. A refusal that names
39
43
  `build pr <id> --worktree <dir>` means an earlier review session committed a fix it did not push:
40
44
  run `{{cli}} build pr <id> --worktree <dir>` with the path it names, then this step again.
41
45
 
46
+ The independent review has one round, and a second only when the first left a blocker (D-101). A
47
+ refusal that `no independent round is left` names the latest round's open blockers and three
48
+ choices: fix them by hand, re-scope the slice, or record a decision row that allows one more round,
49
+ committed on the default branch and pushed to origin.
50
+ A refusal that the review `left no blocker` means the slice has its independent verdict. Print
51
+ either refusal and stop: the human decides.
52
+
42
53
  ## 3. The reviewer gives the independent verdict
43
54
 
44
55
  Run `{{cli}} instructions reviewer <id> --worktree <wt>`. Spawn the reviewer with that output as its
@@ -51,7 +62,9 @@ section lets it write that one file outside the worktree.
51
62
  When the reviewer stops, run `{{cli}} build verdict <id> <path> --independent --worktree <wt>` with
52
63
  step 2's verdict path. It commits the verdict into the review worktree, pushes it to the slice
53
64
  branch, and prints `next: <step>`, `blockers: <IDs or none>`, `should-haves: <IDs or none>` and
54
- `rounds: <used> of 2`; the rounds stay as they were. By what it prints:
65
+ `rounds: <used> of 2`; the rounds stay as they were. On `next: fix` it also prints
66
+ `review: <command>`, the `review start` command of the next independent round that the budget
67
+ allows (D-101); keep it for step 5. By what it prints:
55
68
 
56
69
  - A refusal that names the verdict's content (a finding with no "How verified", a reused finding
57
70
  number, a banned phrase, a `<!--`): send the reviewer back with the printed message, then run this
@@ -60,6 +73,10 @@ branch, and prints `next: <step>`, `blockers: <IDs or none>`, `should-haves: <ID
60
73
  session pushed since step 2. Run `{{cli}} build sync <id> --worktree <wt>`, then this command again.
61
74
  - `a new verdict needs a fresh fetch`: origin could not be reached. Print it and stop; tell the
62
75
  human to run this command again once origin answers.
76
+ - Exit 1 with `stopped:` and `next: stuck`: the round was the last one allowed and left a blocker
77
+ (D-101). The slice is `changes-requested`. Print the open blockers and the three choices it
78
+ prints and stop: the human fixes them by hand, re-scopes the slice, or records a decision row that
79
+ allows one more round, committed on the default branch and pushed to origin.
63
80
  - Any other refusal goes to the human: print it and stop.
64
81
 
65
82
  When the verdict lists should-haves, ask the human once, listing each with its ID and its "What is
@@ -91,7 +108,8 @@ When the fixer reports, run these two in this order:
91
108
  `pass --notes <file>`, the body lost a section: print the refusal and stop, since the notes are the
92
109
  building session's.
93
110
 
94
- Then start again at step 2 with `{{cli}} review start <n>`: the new head needs its own independent
111
+ Then start again at step 2 with the command step 4's `review:` line printed,
112
+ `{{cli}} review start <n>`: the new head needs its own independent
95
113
  verdict, at the next round. Tell the human that the slice branch moved under the building session:
96
114
  that session syncs its worktree with `build sync <id>` before its next push.
97
115