@zigrivers/scaffold 2.44.3 → 2.45.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Scaffold
2
2
 
3
- A TypeScript CLI that assembles AI-powered prompts at runtime to guide you from "I have an idea" to working software. Scaffold walks you through 60 structured pipeline steps — organized into 16 phases — plus 9 utility tools, and Claude Code handles the research, planning, and implementation for you.
3
+ A TypeScript CLI that assembles AI-powered prompts at runtime to guide you from "I have an idea" to working software. Scaffold walks you through 60 structured pipeline steps — organized into 16 phases — plus 10 utility tools, and Claude Code handles the research, planning, and implementation for you.
4
4
 
5
5
  By the end, you'll have a fully planned, standards-documented, implementation-ready project with working code.
6
6
 
@@ -696,10 +696,13 @@ These are orthogonal to the pipeline — usable at any time, not tied to pipelin
696
696
  | `scaffold run update` | Update Scaffold to the latest version. |
697
697
  | `scaffold run dashboard` | Open a visual progress dashboard in your browser. |
698
698
  | `scaffold run prompt-pipeline` | Print the full pipeline reference table. |
699
+ | `scaffold run review-code` | Run all 3 code review channels on local code before commit or push. |
699
700
  | `scaffold run review-pr` | Run all 3 code review channels (Codex CLI, Gemini CLI, Superpowers) on a PR. |
700
701
  | `scaffold run post-implementation-review` | Full 3-channel codebase review after an AI agent completes all tasks — checks requirements coverage, security, architecture alignment, and more. |
701
702
  | `scaffold run session-analyzer` | Analyze Claude Code session logs for patterns and insights. |
702
703
 
704
+ Use `scaffold run review-code` before commit or push when you want a local gate on the current delivery candidate. Use `scaffold run review-pr` after a GitHub PR exists.
705
+
703
706
  All of these are also available as slash commands (`/scaffold:release`, `/scaffold:quick-task`, etc.) when the plugin is installed.
704
707
 
705
708
  ## Releasing Your Project
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zigrivers/scaffold",
3
- "version": "2.44.3",
3
+ "version": "2.45.0",
4
4
  "description": "AI-powered software project scaffolding pipeline",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -163,12 +163,19 @@ Once in-progress work is complete (or if there was none):
163
163
  - Run `make check` (or equivalent from CLAUDE.md Key Commands)
164
164
  - If `tests/evals/` exists, run `make eval` (or equivalent eval command)
165
165
 
166
- 2. **Create PR** (if not already created for in-progress work)
166
+ 2. **Pre-push local code review (when requested or required)**
167
+ - If the user says to review before committing or pushing, or the project's workflow requires a local multi-model gate before `git push`, run `scaffold run review-code`
168
+ - This reviews the local delivery candidate without requiring a PR
169
+ - Surface auth failures immediately and retry after recovery
170
+ - If recovery is not possible, document reduced review coverage and continue with the available channels
171
+ - Fix any P0/P1/P2 findings before proceeding
172
+
173
+ 3. **Create PR** (if not already created for in-progress work)
167
174
  - Push the branch: `git push -u origin HEAD`
168
175
  - Create a pull request: `gh pr create`
169
176
  - Include agent name in PR description for traceability
170
177
 
171
- 3. **Run code reviews (MANDATORY)**
178
+ 4. **Run code reviews (MANDATORY)**
172
179
  - Run the review-pr tool: `scaffold run review-pr` (CLI) or `/scaffold:review-pr` (plugin)
173
180
  - This runs **all three** review channels on the PR diff:
174
181
  1. **Codex CLI**: `codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT" 2>/dev/null`
@@ -179,11 +186,11 @@ Once in-progress work is complete (or if there was none):
179
186
  - Fix any P0/P1/P2 findings before proceeding
180
187
  - Do NOT move to the next task until all channels have run
181
188
 
182
- 4. **Between-task cleanup**
189
+ 5. **Between-task cleanup**
183
190
  - `git fetch origin --prune && git clean -fd`
184
191
  - Run the install command from CLAUDE.md Key Commands
185
192
 
186
- 5. **Claim next task**
193
+ 6. **Claim next task**
187
194
  - Branch from remote: `git fetch origin && git checkout -b <branch-name> origin/main`
188
195
  - Pick the next task following the same process as `/scaffold:multi-agent-start`
189
196
  - Continue the TDD execution loop
@@ -230,8 +237,9 @@ Once in-progress work is complete (or if there was none):
230
237
  4. **Clean between tasks** — Run cleanup after each task to prevent state leakage.
231
238
  5. **TDD is not optional** — Continue the red-green-refactor cycle for any in-progress work.
232
239
  6. **Quality gates before PR** — Never create a PR with failing checks.
233
- 7. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
234
- 8. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
240
+ 7. **Honor pre-push review when requested** — If the user or project workflow asks for pre-push multi-model review, run `scaffold run review-code` after quality gates and before `git push`.
241
+ 8. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
242
+ 9. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
235
243
 
236
244
  ---
237
245
 
@@ -166,13 +166,20 @@ For each task:
166
166
  - If `tests/evals/` exists, run `make eval` (or equivalent eval command)
167
167
  - Fix any failures before proceeding
168
168
 
169
- 6. **Create PR**
169
+ 6. **Pre-push local code review (when requested or required)**
170
+ - If the user says to review before committing or pushing, or the project's workflow requires a local multi-model gate before `git push`, run `scaffold run review-code`
171
+ - This reviews the local delivery candidate without requiring a PR
172
+ - Surface auth failures immediately and retry after recovery
173
+ - If recovery is not possible, document reduced review coverage and continue with the available channels
174
+ - Fix any P0/P1/P2 findings before proceeding
175
+
176
+ 7. **Create PR**
170
177
  - Push the branch: `git push -u origin HEAD`
171
178
  - Create a pull request: `gh pr create`
172
179
  - Include in the PR description: what was implemented, key decisions, files changed, agent name
173
180
  - Follow the PR workflow from `docs/git-workflow.md` or CLAUDE.md
174
181
 
175
- 7. **Run code reviews (MANDATORY)**
182
+ 8. **Run code reviews (MANDATORY)**
176
183
  - Run the review-pr tool: `scaffold run review-pr` (CLI) or `/scaffold:review-pr` (plugin)
177
184
  - This runs **all three** review channels on the PR diff:
178
185
  1. **Codex CLI**: `codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT" 2>/dev/null`
@@ -183,7 +190,7 @@ For each task:
183
190
  - Fix any P0/P1/P2 findings before proceeding
184
191
  - Do NOT move to the next task until all channels have run
185
192
 
186
- 8. **Between-task cleanup**
193
+ 9. **Between-task cleanup**
187
194
  - `git fetch origin --prune && git clean -fd`
188
195
  - Run the install command from CLAUDE.md Key Commands
189
196
  - This ensures a clean state before the next task
@@ -222,9 +229,10 @@ For each task:
222
229
  3. **Clean between tasks** — Run cleanup after each task to prevent state leakage.
223
230
  4. **TDD is not optional** — Write failing tests before implementation. No exceptions.
224
231
  5. **Quality gates before PR** — Never create a PR with failing checks.
225
- 6. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
226
- 7. **Avoid task conflicts** — Check what other agents are working on before claiming.
227
- 8. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
232
+ 6. **Honor pre-push review when requested** — If the user or project workflow asks for pre-push multi-model review, run `scaffold run review-code` after quality gates and before `git push`.
233
+ 7. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
234
+ 8. **Avoid task conflicts** — Check what other agents are working on before claiming.
235
+ 9. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
228
236
 
229
237
  ---
230
238
 
@@ -140,12 +140,19 @@ Once in-progress work is complete (or if there was none):
140
140
  - Run `make check` (or equivalent from CLAUDE.md Key Commands)
141
141
  - If `tests/evals/` exists, run `make eval` (or equivalent eval command)
142
142
 
143
- 2. **Create PR** (if not already created for in-progress work)
143
+ 2. **Pre-push local code review (when requested or required)**
144
+ - If the user says to review before committing or pushing, or the project's workflow requires a local multi-model gate before `git push`, run `scaffold run review-code`
145
+ - This reviews the local delivery candidate without requiring a PR
146
+ - Surface auth failures immediately and retry after recovery
147
+ - If recovery is not possible, document reduced review coverage and continue with the available channels
148
+ - Fix any P0/P1/P2 findings before proceeding
149
+
150
+ 3. **Create PR** (if not already created for in-progress work)
144
151
  - Push the branch: `git push -u origin HEAD`
145
152
  - Create a pull request: `gh pr create`
146
153
  - Follow the PR workflow from `docs/git-workflow.md` or CLAUDE.md
147
154
 
148
- 3. **Run code reviews (MANDATORY)**
155
+ 4. **Run code reviews (MANDATORY)**
149
156
  - Run the review-pr tool: `scaffold run review-pr` (CLI) or `/scaffold:review-pr` (plugin)
150
157
  - This runs **all three** review channels on the PR diff:
151
158
  1. **Codex CLI**: `codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT" 2>/dev/null`
@@ -156,7 +163,7 @@ Once in-progress work is complete (or if there was none):
156
163
  - Fix any P0/P1/P2 findings before proceeding
157
164
  - Do NOT move to the next task until all channels have run
158
165
 
159
- 4. **Claim next task**
166
+ 5. **Claim next task**
160
167
  - Return to main: `git checkout main && git pull origin main`
161
168
  - Pick the next task following the same process as `/scaffold:single-agent-start`
162
169
  - Continue the TDD execution loop
@@ -195,8 +202,9 @@ Once in-progress work is complete (or if there was none):
195
202
  3. **Reconcile task status** — Merged PRs must be reflected in the task tracker.
196
203
  4. **TDD is not optional** — Continue the red-green-refactor cycle for any in-progress work.
197
204
  5. **Quality gates before PR** — Never create a PR with failing checks.
198
- 6. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
199
- 7. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
205
+ 6. **Honor pre-push review when requested** — If the user or project workflow asks for pre-push multi-model review, run `scaffold run review-code` after quality gates and before `git push`.
206
+ 7. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
207
+ 8. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
200
208
 
201
209
  ---
202
210
 
@@ -145,13 +145,20 @@ For each task:
145
145
  - If `tests/evals/` exists, run `make eval` (or equivalent eval command)
146
146
  - Fix any failures before proceeding
147
147
 
148
- 6. **Create PR**
148
+ 6. **Pre-push local code review (when requested or required)**
149
+ - If the user says to review before committing or pushing, or the project's workflow requires a local multi-model gate before `git push`, run `scaffold run review-code`
150
+ - This reviews the local delivery candidate without requiring a PR
151
+ - Surface auth failures immediately and retry after recovery
152
+ - If recovery is not possible, document reduced review coverage and continue with the available channels
153
+ - Fix any P0/P1/P2 findings before proceeding
154
+
155
+ 7. **Create PR**
149
156
  - Push the branch: `git push -u origin HEAD`
150
157
  - Create a pull request: `gh pr create`
151
158
  - Include in the PR description: what was implemented, key decisions, files changed
152
159
  - Follow the PR workflow from `docs/git-workflow.md` or CLAUDE.md
153
160
 
154
- 7. **Run code reviews (MANDATORY)**
161
+ 8. **Run code reviews (MANDATORY)**
155
162
  - Run the review-pr tool: `scaffold run review-pr` (CLI) or `/scaffold:review-pr` (plugin)
156
163
  - This runs **all three** review channels on the PR diff:
157
164
  1. **Codex CLI**: `codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT" 2>/dev/null`
@@ -162,7 +169,7 @@ For each task:
162
169
  - Fix any P0/P1/P2 findings before proceeding
163
170
  - Do NOT move to the next task until all channels have run
164
171
 
165
- 8. **Update status**
172
+ 9. **Update status**
166
173
  - If Beads: task status is managed via `bd` commands
167
174
  - Without Beads: mark the task as complete in the plan/playbook
168
175
 
@@ -193,10 +200,11 @@ For each task:
193
200
  1. **TDD is not optional** — Write failing tests before implementation. No exceptions.
194
201
  2. **One task at a time** — Complete the current task fully before starting the next.
195
202
  3. **Quality gates before PR** — Never create a PR with failing checks.
196
- 4. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
197
- 5. **Update status immediately** — Mark tasks complete as soon as review passes.
198
- 6. **Consult lessons.md** — Check for relevant anti-patterns before each task.
199
- 7. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
203
+ 4. **Honor pre-push review when requested** — If the user or project workflow asks for pre-push multi-model review, run `scaffold run review-code` after quality gates and before `git push`.
204
+ 5. **Code review before next task** — After creating a PR, run all three review channels (Codex CLI, Gemini CLI, Superpowers code-reviewer) and fix all P0/P1/P2 findings before moving on.
205
+ 6. **Update status immediately** — Mark tasks complete as soon as review passes.
206
+ 7. **Consult lessons.md** — Check for relevant anti-patterns before each task.
207
+ 8. **Follow CLAUDE.md** — It is the authority on project conventions and commands.
200
208
 
201
209
  ---
202
210
 
@@ -148,7 +148,7 @@ If no prior activity is detected, suggest `single-agent-start` or `multi-agent-s
148
148
 
149
149
  ## Tool Execution
150
150
 
151
- Tools (version-bump, release, version, update, dashboard, prompt-pipeline, session-analyzer, review-pr, post-implementation-review) are utility commands orthogonal to the pipeline.
151
+ Tools (version-bump, release, version, update, dashboard, prompt-pipeline, session-analyzer, review-code, review-pr, post-implementation-review) are utility commands orthogonal to the pipeline.
152
152
 
153
153
  ### Differences from Pipeline Steps
154
154
 
@@ -202,6 +202,7 @@ When the user asks "what tools are available?", "what can I build?", or "show me
202
202
  | `scaffold run update` | Update scaffold to the latest version |
203
203
  | `scaffold run dashboard` | Open a visual progress dashboard in your browser |
204
204
  | `scaffold run prompt-pipeline` | Print the full pipeline reference table |
205
+ | `scaffold run review-code` | Run all 3 code review channels on local code before commit or push |
205
206
  | `scaffold run review-pr` | Run all 3 code review channels (Codex CLI, Gemini CLI, Superpowers) on a PR |
206
207
  | `scaffold run post-implementation-review` | Full 3-channel codebase review after an AI agent completes all tasks |
207
208
  | `scaffold run session-analyzer` | Analyze Claude Code session logs for patterns and insights |
@@ -223,6 +224,7 @@ Track these preferences within the current session to avoid re-asking:
223
224
  | Methodology | "I'm using MVP" | Informs default recommendations |
224
225
  | Batch mode | "Run the next 3 steps" | Execute sequentially, surface decisions for each |
225
226
  | Compact status | User is mid-pipeline, only cares about remaining work | Default to `scaffold status --compact` |
227
+ | Pre-push review | "Run review-code before committing and pushing" | Remember to insert `scaffold run review-code` before `git push` in build flows |
226
228
 
227
229
  When the user sets a preference, acknowledge it and apply it to subsequent steps. Don't ask about it again unless the context changes.
228
230
 
@@ -262,6 +264,7 @@ Respond to these natural language requests:
262
264
  | "Create release" / "Release" | `scaffold run release` |
263
265
  | "What tools are available?" | Run `scaffold list --section tools --format json`, render as two-section grouped display — see [Tool Listing](#tool-listing) |
264
266
  | "Show version" | `scaffold run version` |
267
+ | "Review local code" / "Review before push" / "Review before committing and pushing" | `scaffold run review-code` |
265
268
  | "Review PR" / "Run code review" | `scaffold run review-pr` |
266
269
 
267
270
  ### Re-running Steps
@@ -0,0 +1,319 @@
1
+ ---
2
+ name: review-code
3
+ description: Run all configured code review channels on local code before commit or push
4
+ summary: "Review the current local delivery candidate with Codex CLI, Gemini CLI, and Superpowers before committing or pushing, using staged changes, an explicit ref range, or the current branch diff."
5
+ phase: null
6
+ order: null
7
+ dependencies: []
8
+ outputs: []
9
+ conditional: null
10
+ stateless: true
11
+ category: tool
12
+ knowledge-base: [multi-model-review-dispatch, automated-review-tooling]
13
+ argument-hint: "[--base <ref>] [--head <ref>] [--staged] [--report-only]"
14
+ ---
15
+
16
+ ## Purpose
17
+
18
+ Run the same three-channel review stack used by `review-pr`, but on local code
19
+ before commit or push. This is the preflight review entry point for bug fixes,
20
+ small features, and quick tasks when the user wants multi-model review before
21
+ anything leaves the machine.
22
+
23
+ The three channels are:
24
+ 1. **Codex CLI** — implementation correctness, security, API contracts
25
+ 2. **Gemini CLI** — architectural patterns, broad-context reasoning
26
+ 3. **Superpowers code-reviewer** — Claude subagent review of code quality, tests, and plan alignment
27
+
28
+ ## Inputs
29
+
30
+ - `$ARGUMENTS` (optional) — review scope flags:
31
+ - `--base <ref>` — explicit base ref for diff review
32
+ - `--head <ref>` — explicit head ref for diff review
33
+ - `--staged` — review only staged changes (`git diff --cached`)
34
+ - `--report-only` — collect findings and verdict, but do not apply fixes
35
+ - `docs/coding-standards.md` (required) — coding conventions for review context
36
+ - `docs/tdd-standards.md` (optional) — test expectations
37
+ - `docs/review-standards.md` (optional) — severity definitions and review criteria
38
+ - `AGENTS.md` (optional) — project-specific reviewer rules
39
+ - Local git state — staged diff, unstaged diff, branch diff, and changed file contents
40
+
41
+ ## Expected Outputs
42
+
43
+ - A three-channel review summary for the local delivery candidate
44
+ - One of these verdicts: `pass`, `degraded-pass`, `blocked`, `needs-user-decision`
45
+ - Fixed code when findings are resolved in normal mode
46
+
47
+ ## Instructions
48
+
49
+ ### Step 1: Detect Mode
50
+
51
+ Parse `$ARGUMENTS` and set:
52
+
53
+ - `REPORT_ONLY=true` if `$ARGUMENTS` contains `--report-only`
54
+ - `STAGED_ONLY=true` if `$ARGUMENTS` contains `--staged`
55
+ - `BASE_REF` from `--base <ref>` if present
56
+ - `HEAD_REF` from `--head <ref>` if present
57
+
58
+ If `--head` is provided without `--base`, stop and tell the user both refs are
59
+ required for explicit-range review.
60
+
61
+ ### Step 2: Build the Review Scope
62
+
63
+ Determine the delivery candidate to review.
64
+
65
+ #### Mode A: Explicit ref range
66
+
67
+ If both `BASE_REF` and `HEAD_REF` are provided:
68
+
69
+ ```bash
70
+ git rev-parse --verify "$BASE_REF"
71
+ git rev-parse --verify "$HEAD_REF"
72
+ REVIEW_DIFF=$(git diff "$BASE_REF...$HEAD_REF")
73
+ CHANGED_FILES=$(git diff --name-only "$BASE_REF...$HEAD_REF")
74
+ ```
75
+
76
+ Set the scope label to:
77
+
78
+ ```text
79
+ ref-range: BASE_REF...HEAD_REF
80
+ ```
81
+
82
+ If the diff is empty, stop and tell the user there is nothing to review in that range.
83
+
84
+ #### Mode B: Staged-only review
85
+
86
+ If `--staged` is provided:
87
+
88
+ ```bash
89
+ REVIEW_DIFF=$(git diff --cached)
90
+ CHANGED_FILES=$(git diff --cached --name-only)
91
+ ```
92
+
93
+ Set the scope label to:
94
+
95
+ ```text
96
+ staged changes
97
+ ```
98
+
99
+ If the staged diff is empty, stop and tell the user there are no staged changes.
100
+
101
+ #### Mode C: Default local delivery candidate
102
+
103
+ If no scope flags are provided, review everything that would be part of the next
104
+ delivery candidate:
105
+
106
+ 1. Determine a reasonable base for committed work:
107
+ - Prefer `origin/main` if it exists
108
+ - Otherwise prefer `main`
109
+ - Otherwise use `HEAD~1` if it exists
110
+ - Otherwise treat this as a working-tree-only review
111
+ 2. Collect these diff segments:
112
+ - **Committed branch diff** from the base ref to `HEAD` (if a base ref exists and differs)
113
+ - **Staged diff** from `git diff --cached`
114
+ - **Unstaged diff** from `git diff`
115
+ 3. Concatenate all non-empty segments into one review bundle with labels:
116
+
117
+ ```text
118
+ === COMMITTED DIFF (BASE...HEAD) ===
119
+ [diff]
120
+
121
+ === STAGED DIFF ===
122
+ [diff]
123
+
124
+ === UNSTAGED DIFF ===
125
+ [diff]
126
+ ```
127
+
128
+ 4. Build `CHANGED_FILES` as the union of file names from all non-empty segments
129
+
130
+ If all three segments are empty, stop and tell the user there is nothing to review.
131
+
132
+ ### Step 3: Gather Review Context
133
+
134
+ Read these files if they exist:
135
+ - `docs/coding-standards.md`
136
+ - `docs/tdd-standards.md`
137
+ - `docs/review-standards.md`
138
+ - `AGENTS.md`
139
+
140
+ Then read the full contents of changed files from `CHANGED_FILES`, excluding:
141
+ - `node_modules/`
142
+ - `.git/`
143
+ - build artifacts (`dist/`, `build/`, `coverage/`, `.next/`)
144
+
145
+ If more than 15 files changed, prioritize:
146
+ 1. Production files directly modified
147
+ 2. New files
148
+ 3. Test files covering the change
149
+ 4. Config files affecting behavior or quality gates
150
+
151
+ Format the changed-file context like:
152
+
153
+ ```text
154
+ === relative/path/to/file.ts ===
155
+ [full file contents]
156
+ ```
157
+
158
+ ### Step 4: Run All Three Review Channels
159
+
160
+ Each channel reviews independently. Do NOT share one channel's output with another.
161
+
162
+ #### Channel 1: Codex CLI
163
+
164
+ Check installation and auth:
165
+
166
+ ```bash
167
+ command -v codex >/dev/null 2>&1
168
+ codex login status 2>/dev/null
169
+ ```
170
+
171
+ - If `codex` is not installed: skip this channel and record `skipped (not installed)`
172
+ - If auth fails: tell the user to run `! codex login`, retry after recovery, and if recovery is not possible, record `skipped (auth failed)` and continue with the remaining channels
173
+
174
+ Build the prompt in a temporary file and pass it over stdin:
175
+
176
+ ```bash
177
+ PROMPT_FILE=$(mktemp)
178
+ # ...write the full review prompt to "$PROMPT_FILE"...
179
+ codex exec --skip-git-repo-check -s read-only --ephemeral - < "$PROMPT_FILE" 2>/dev/null
180
+ ```
181
+
182
+ #### Channel 2: Gemini CLI
183
+
184
+ Check installation and auth:
185
+
186
+ ```bash
187
+ command -v gemini >/dev/null 2>&1
188
+ NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1
189
+ ```
190
+
191
+ - If `gemini` is not installed: skip this channel and record `skipped (not installed)`
192
+ - If auth fails (including exit 41): tell the user to run `! gemini -p "hello"`, retry after recovery, and if recovery is not possible, record `skipped (auth failed)` and continue with the remaining channels
193
+
194
+ Build the prompt in a temporary file and pass it as a single prompt string:
195
+
196
+ ```bash
197
+ PROMPT_FILE=$(mktemp)
198
+ # ...write the full review prompt to "$PROMPT_FILE"...
199
+ NO_BROWSER=true gemini -p "$(cat "$PROMPT_FILE")" --output-format json --approval-mode yolo 2>/dev/null
200
+ ```
201
+
202
+ #### Channel 3: Superpowers code-reviewer
203
+
204
+ Dispatch the `superpowers:code-reviewer` subagent.
205
+
206
+ - If explicit refs are being reviewed, provide `BASE_SHA` and `HEAD_SHA`
207
+ - Otherwise provide:
208
+ - the scope label
209
+ - the unified review diff bundle
210
+ - the changed-file contents
211
+ - project review standards
212
+
213
+ This channel must review the same local delivery candidate, even when no PR or
214
+ clean ref range exists.
215
+
216
+ ### Step 5: Use This Review Prompt
217
+
218
+ All channels should receive an equivalent prompt bundle built from the local review scope:
219
+
220
+ ```text
221
+ You are reviewing local code changes before commit or push. Report only P0, P1,
222
+ and P2 issues.
223
+
224
+ ## Scope
225
+ [scope label]
226
+
227
+ ## Review Standards
228
+ [docs/review-standards.md if present, otherwise define P0/P1/P2]
229
+
230
+ ## Coding Standards
231
+ [docs/coding-standards.md]
232
+
233
+ ## Test Standards
234
+ [docs/tdd-standards.md if present]
235
+
236
+ ## Project Review Rules
237
+ [AGENTS.md excerpts if present]
238
+
239
+ ## Delivery Candidate Diff
240
+ [review diff bundle]
241
+
242
+ ## Changed File Contents
243
+ [changed file contents]
244
+
245
+ ## Output Format
246
+ Respond with JSON:
247
+ {
248
+ "approved": true/false,
249
+ "findings": [
250
+ {
251
+ "severity": "P0" | "P1" | "P2",
252
+ "location": "file:line or section",
253
+ "description": "what is wrong",
254
+ "suggestion": "specific fix"
255
+ }
256
+ ],
257
+ "summary": "one-line assessment"
258
+ }
259
+ ```
260
+
261
+ ### Step 6: Reconcile Findings
262
+
263
+ Use these rules:
264
+
265
+ | Scenario | Action |
266
+ |----------|--------|
267
+ | Same issue flagged by 2+ channels | High confidence — fix immediately |
268
+ | Any single P0 | Fix immediately |
269
+ | Any single P1 | Fix immediately |
270
+ | Any single P2 | Fix unless clearly inapplicable; if disputed, surface to user |
271
+ | All executed channels approve | Candidate passes review |
272
+ | Strong contradiction on a medium-severity issue | Verdict becomes `needs-user-decision` |
273
+
274
+ ### Step 7: Apply Fixes Unless in Report-Only Mode
275
+
276
+ If `REPORT_ONLY=true`:
277
+ - Do NOT edit code
278
+ - Output the review summary and final verdict
279
+ - Stop
280
+
281
+ Otherwise:
282
+ 1. Fix all P0/P1/P2 findings
283
+ 2. Re-run the channels that produced findings
284
+ 3. Repeat for up to 3 fix rounds
285
+ 4. If any finding remains unresolved after 3 rounds, stop with verdict `needs-user-decision`
286
+
287
+ ### Step 8: Final Verdict
288
+
289
+ Return exactly one verdict:
290
+
291
+ - `pass` — all available channels ran and no unresolved P0/P1/P2 findings remain
292
+ - `degraded-pass` — at least one channel was skipped because the tool is not installed or auth could not be recovered, but all executed channels passed
293
+ - `blocked` — reviewer execution failure or unresolved mandatory findings
294
+ - `needs-user-decision` — reviewer disagreement or findings still unresolved after 3 fix rounds
295
+
296
+ ### Step 9: Report Results
297
+
298
+ Output a concise summary in this format:
299
+
300
+ ```text
301
+ ## Code Review Summary — Local Delivery Candidate
302
+
303
+ ### Scope
304
+ [scope label]
305
+
306
+ ### Channels Executed
307
+ - Codex CLI — [completed / skipped (not installed) / skipped (auth failed) / error]
308
+ - Gemini CLI — [completed / skipped (not installed) / skipped (auth failed) / error]
309
+ - Superpowers code-reviewer — [completed / error]
310
+
311
+ ### Findings
312
+ [consensus findings first, then single-source findings]
313
+
314
+ ### Verdict
315
+ [pass / degraded-pass / blocked / needs-user-decision]
316
+ ```
317
+
318
+ If the verdict is `pass` or `degraded-pass`, explicitly say the code is ready
319
+ for the next delivery step (commit, push, or PR creation).