@zigrivers/scaffold 2.44.3 → 3.0.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 (41) hide show
  1. package/README.md +27 -7
  2. package/dist/cli/commands/build.d.ts +8 -1
  3. package/dist/cli/commands/build.d.ts.map +1 -1
  4. package/dist/cli/commands/build.js +166 -145
  5. package/dist/cli/commands/build.js.map +1 -1
  6. package/dist/cli/commands/build.test.js +111 -26
  7. package/dist/cli/commands/build.test.js.map +1 -1
  8. package/dist/cli/commands/init.d.ts.map +1 -1
  9. package/dist/cli/commands/init.js +20 -1
  10. package/dist/cli/commands/init.js.map +1 -1
  11. package/dist/cli/commands/init.test.js +39 -4
  12. package/dist/cli/commands/init.test.js.map +1 -1
  13. package/dist/core/adapters/claude-code.js +1 -1
  14. package/dist/core/adapters/claude-code.js.map +1 -1
  15. package/dist/core/adapters/claude-code.test.js +2 -2
  16. package/dist/core/adapters/claude-code.test.js.map +1 -1
  17. package/dist/core/adapters/codex.js +1 -1
  18. package/dist/core/adapters/codex.js.map +1 -1
  19. package/dist/core/adapters/codex.test.js +3 -3
  20. package/dist/core/adapters/codex.test.js.map +1 -1
  21. package/dist/core/adapters/universal.js +1 -1
  22. package/dist/core/adapters/universal.js.map +1 -1
  23. package/dist/core/adapters/universal.test.js +3 -3
  24. package/dist/core/adapters/universal.test.js.map +1 -1
  25. package/dist/e2e/init.test.js +24 -0
  26. package/dist/e2e/init.test.js.map +1 -1
  27. package/dist/project/gitignore.d.ts +9 -0
  28. package/dist/project/gitignore.d.ts.map +1 -0
  29. package/dist/project/gitignore.js +103 -0
  30. package/dist/project/gitignore.js.map +1 -0
  31. package/dist/project/gitignore.test.d.ts +2 -0
  32. package/dist/project/gitignore.test.d.ts.map +1 -0
  33. package/dist/project/gitignore.test.js +96 -0
  34. package/dist/project/gitignore.test.js.map +1 -0
  35. package/package.json +1 -1
  36. package/pipeline/build/multi-agent-resume.md +14 -6
  37. package/pipeline/build/multi-agent-start.md +14 -6
  38. package/pipeline/build/single-agent-resume.md +13 -5
  39. package/pipeline/build/single-agent-start.md +15 -7
  40. package/skills/scaffold-runner/SKILL.md +4 -1
  41. package/tools/review-code.md +319 -0
@@ -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).