@zigrivers/scaffold 2.38.1 → 2.44.3
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 +10 -7
- package/dist/cli/commands/build.js +4 -4
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/check.test.js +11 -8
- package/dist/cli/commands/check.test.js.map +1 -1
- package/dist/cli/commands/complete.d.ts.map +1 -1
- package/dist/cli/commands/complete.js +2 -1
- package/dist/cli/commands/complete.js.map +1 -1
- package/dist/cli/commands/complete.test.js +4 -1
- package/dist/cli/commands/complete.test.js.map +1 -1
- package/dist/cli/commands/dashboard.js +4 -4
- package/dist/cli/commands/dashboard.js.map +1 -1
- package/dist/cli/commands/knowledge.js +2 -2
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/knowledge.test.js +5 -12
- package/dist/cli/commands/knowledge.test.js.map +1 -1
- package/dist/cli/commands/list.d.ts +1 -1
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +84 -3
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/list.test.js +82 -0
- package/dist/cli/commands/list.test.js.map +1 -1
- package/dist/cli/commands/next.test.js +4 -1
- package/dist/cli/commands/next.test.js.map +1 -1
- package/dist/cli/commands/reset.d.ts.map +1 -1
- package/dist/cli/commands/reset.js +5 -2
- package/dist/cli/commands/reset.js.map +1 -1
- package/dist/cli/commands/reset.test.js +4 -1
- package/dist/cli/commands/reset.test.js.map +1 -1
- package/dist/cli/commands/rework.d.ts.map +1 -1
- package/dist/cli/commands/rework.js +3 -2
- package/dist/cli/commands/rework.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +28 -13
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/run.test.js +1 -1
- package/dist/cli/commands/run.test.js.map +1 -1
- package/dist/cli/commands/skip.d.ts.map +1 -1
- package/dist/cli/commands/skip.js +2 -1
- package/dist/cli/commands/skip.js.map +1 -1
- package/dist/cli/commands/skip.test.js +4 -1
- package/dist/cli/commands/skip.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +88 -4
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/version.d.ts.map +1 -1
- package/dist/cli/commands/version.js +22 -3
- package/dist/cli/commands/version.js.map +1 -1
- package/dist/cli/commands/version.test.js +42 -0
- package/dist/cli/commands/version.test.js.map +1 -1
- package/dist/cli/output/context.test.js +14 -13
- package/dist/cli/output/context.test.js.map +1 -1
- package/dist/cli/output/interactive.js +4 -4
- package/dist/cli/output/json.d.ts +1 -0
- package/dist/cli/output/json.d.ts.map +1 -1
- package/dist/cli/output/json.js +14 -1
- package/dist/cli/output/json.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +10 -3
- package/dist/config/loader.js.map +1 -1
- package/dist/config/loader.test.js +28 -0
- package/dist/config/loader.test.js.map +1 -1
- package/dist/core/assembly/engine.d.ts.map +1 -1
- package/dist/core/assembly/engine.js +6 -1
- package/dist/core/assembly/engine.js.map +1 -1
- package/dist/e2e/init.test.js +3 -0
- package/dist/e2e/init.test.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/project/adopt.test.js +3 -0
- package/dist/project/adopt.test.js.map +1 -1
- package/dist/project/claude-md.d.ts.map +1 -1
- package/dist/project/claude-md.js +2 -1
- package/dist/project/claude-md.js.map +1 -1
- package/dist/project/detector.js +3 -3
- package/dist/project/detector.js.map +1 -1
- package/dist/project/signals.d.ts +1 -0
- package/dist/project/signals.d.ts.map +1 -1
- package/dist/state/decision-logger.d.ts.map +1 -1
- package/dist/state/decision-logger.js +7 -4
- package/dist/state/decision-logger.js.map +1 -1
- package/dist/state/lock-manager.js +1 -1
- package/dist/state/lock-manager.js.map +1 -1
- package/dist/state/lock-manager.test.js +27 -3
- package/dist/state/lock-manager.test.js.map +1 -1
- package/dist/state/state-manager.d.ts.map +1 -1
- package/dist/state/state-manager.js +6 -0
- package/dist/state/state-manager.js.map +1 -1
- package/dist/state/state-manager.test.js +7 -0
- package/dist/state/state-manager.test.js.map +1 -1
- package/dist/types/assembly.d.ts +2 -0
- package/dist/types/assembly.d.ts.map +1 -1
- package/dist/utils/eligible.d.ts +8 -0
- package/dist/utils/eligible.d.ts.map +1 -0
- package/dist/utils/eligible.js +36 -0
- package/dist/utils/eligible.js.map +1 -0
- package/dist/validation/config-validator.test.js +15 -13
- package/dist/validation/config-validator.test.js.map +1 -1
- package/dist/validation/index.test.js +1 -1
- package/dist/wizard/wizard.d.ts.map +1 -1
- package/dist/wizard/wizard.js +1 -0
- package/dist/wizard/wizard.js.map +1 -1
- package/dist/wizard/wizard.test.js +2 -0
- package/dist/wizard/wizard.test.js.map +1 -1
- package/knowledge/core/automated-review-tooling.md +4 -4
- package/knowledge/core/eval-craft.md +44 -0
- package/knowledge/core/multi-model-review-dispatch.md +8 -0
- package/knowledge/core/system-architecture.md +39 -0
- package/knowledge/core/task-decomposition.md +53 -0
- package/knowledge/core/testing-strategy.md +160 -0
- package/knowledge/finalization/implementation-playbook.md +24 -7
- package/knowledge/product/prd-craft.md +41 -0
- package/knowledge/review/review-adr.md +1 -1
- package/knowledge/review/review-api-design.md +1 -1
- package/knowledge/review/review-database-design.md +1 -1
- package/knowledge/review/review-domain-modeling.md +1 -1
- package/knowledge/review/review-implementation-tasks.md +1 -1
- package/knowledge/review/review-methodology.md +1 -1
- package/knowledge/review/review-operations.md +1 -1
- package/knowledge/review/review-prd.md +1 -1
- package/knowledge/review/review-security.md +1 -1
- package/knowledge/review/review-system-architecture.md +1 -1
- package/knowledge/review/review-testing-strategy.md +1 -1
- package/knowledge/review/review-user-stories.md +1 -1
- package/knowledge/review/review-ux-specification.md +1 -1
- package/knowledge/review/review-vision.md +1 -1
- package/knowledge/tools/post-implementation-review-methodology.md +107 -0
- package/knowledge/validation/critical-path-analysis.md +13 -0
- package/knowledge/validation/implementability-review.md +14 -0
- package/package.json +2 -1
- package/pipeline/architecture/review-architecture.md +8 -5
- package/pipeline/architecture/system-architecture.md +9 -3
- package/pipeline/build/multi-agent-resume.md +21 -7
- package/pipeline/build/multi-agent-start.md +22 -7
- package/pipeline/build/new-enhancement.md +20 -12
- package/pipeline/build/quick-task.md +18 -11
- package/pipeline/build/single-agent-resume.md +20 -6
- package/pipeline/build/single-agent-start.md +24 -8
- package/pipeline/consolidation/claude-md-optimization.md +8 -4
- package/pipeline/consolidation/workflow-audit.md +9 -5
- package/pipeline/decisions/adrs.md +7 -3
- package/pipeline/decisions/review-adrs.md +8 -5
- package/pipeline/environment/ai-memory-setup.md +6 -2
- package/pipeline/environment/automated-pr-review.md +79 -12
- package/pipeline/environment/design-system.md +9 -6
- package/pipeline/environment/dev-env-setup.md +8 -5
- package/pipeline/environment/git-workflow.md +16 -13
- package/pipeline/finalization/apply-fixes-and-freeze.md +10 -5
- package/pipeline/finalization/developer-onboarding-guide.md +10 -3
- package/pipeline/finalization/implementation-playbook.md +13 -4
- package/pipeline/foundation/beads.md +8 -5
- package/pipeline/foundation/coding-standards.md +13 -10
- package/pipeline/foundation/project-structure.md +16 -13
- package/pipeline/foundation/tdd.md +9 -4
- package/pipeline/foundation/tech-stack.md +7 -5
- package/pipeline/integration/add-e2e-testing.md +12 -8
- package/pipeline/modeling/domain-modeling.md +9 -7
- package/pipeline/modeling/review-domain-modeling.md +8 -6
- package/pipeline/parity/platform-parity-review.md +9 -6
- package/pipeline/planning/implementation-plan-review.md +10 -7
- package/pipeline/planning/implementation-plan.md +41 -9
- package/pipeline/pre/create-prd.md +7 -4
- package/pipeline/pre/innovate-prd.md +12 -8
- package/pipeline/pre/innovate-user-stories.md +10 -7
- package/pipeline/pre/review-prd.md +12 -10
- package/pipeline/pre/review-user-stories.md +12 -9
- package/pipeline/pre/user-stories.md +7 -4
- package/pipeline/quality/create-evals.md +6 -3
- package/pipeline/quality/operations.md +7 -3
- package/pipeline/quality/review-operations.md +12 -5
- package/pipeline/quality/review-security.md +11 -6
- package/pipeline/quality/review-testing.md +11 -6
- package/pipeline/quality/security.md +6 -2
- package/pipeline/quality/story-tests.md +14 -9
- package/pipeline/specification/api-contracts.md +9 -3
- package/pipeline/specification/database-schema.md +8 -2
- package/pipeline/specification/review-api.md +10 -4
- package/pipeline/specification/review-database.md +8 -3
- package/pipeline/specification/review-ux.md +9 -3
- package/pipeline/specification/ux-spec.md +9 -4
- package/pipeline/validation/critical-path-walkthrough.md +10 -5
- package/pipeline/validation/cross-phase-consistency.md +9 -4
- package/pipeline/validation/decision-completeness.md +8 -3
- package/pipeline/validation/dependency-graph-validation.md +8 -3
- package/pipeline/validation/implementability-dry-run.md +9 -5
- package/pipeline/validation/scope-creep-check.md +11 -6
- package/pipeline/validation/traceability-matrix.md +10 -5
- package/pipeline/vision/create-vision.md +7 -4
- package/pipeline/vision/innovate-vision.md +11 -8
- package/pipeline/vision/review-vision.md +15 -12
- package/skills/multi-model-dispatch/SKILL.md +6 -5
- package/skills/scaffold-runner/SKILL.md +47 -3
- package/tools/dashboard.md +53 -0
- package/tools/post-implementation-review.md +655 -0
- package/tools/prompt-pipeline.md +160 -0
- package/tools/release.md +440 -0
- package/tools/review-pr.md +229 -0
- package/tools/session-analyzer.md +299 -0
- package/tools/update.md +113 -0
- package/tools/version-bump.md +290 -0
- package/tools/version.md +82 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: post-implementation-review
|
|
3
|
+
description: Run a systematic three-channel post-implementation code review across the entire codebase
|
|
4
|
+
summary: "Run a systematic three-channel post-implementation code review across the entire codebase after an AI agent completes all implementation tasks."
|
|
5
|
+
phase: null
|
|
6
|
+
order: null
|
|
7
|
+
dependencies: []
|
|
8
|
+
outputs: [docs/reviews/post-implementation-review.md]
|
|
9
|
+
conditional: null
|
|
10
|
+
stateless: true
|
|
11
|
+
category: tool
|
|
12
|
+
knowledge-base: [multi-model-review-dispatch, automated-review-tooling, post-implementation-review-methodology]
|
|
13
|
+
argument-hint: "[--report-only]"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Purpose
|
|
17
|
+
|
|
18
|
+
Run a systematic three-channel post-implementation code review across the entire
|
|
19
|
+
scaffold-generated codebase. Unlike `/scaffold:review-pr` (which reviews a git diff),
|
|
20
|
+
this tool reviews the full implemented codebase against requirements, acceptance
|
|
21
|
+
criteria, and coding standards.
|
|
22
|
+
|
|
23
|
+
Run this after an AI agent has completed all implementation tasks and you want a
|
|
24
|
+
comprehensive quality check before releasing or handing off the project.
|
|
25
|
+
|
|
26
|
+
The three channels are:
|
|
27
|
+
1. **Codex CLI** — Implementation correctness, security, API contracts
|
|
28
|
+
2. **Gemini CLI** — Design reasoning, architectural patterns, broad context
|
|
29
|
+
3. **Superpowers code-reviewer** — Plan alignment, code quality, testing
|
|
30
|
+
|
|
31
|
+
## Inputs
|
|
32
|
+
|
|
33
|
+
- `$ARGUMENTS` — `--report-only` flag (optional; omit to review + fix)
|
|
34
|
+
- `docs/user-stories.md` (required) — user stories with acceptance criteria; organizing manifest for Phase 2
|
|
35
|
+
- `docs/implementation-plan.md` (optional) — implementation tasks; used to cross-check that all planned deliverables were built
|
|
36
|
+
- `docs/coding-standards.md` (required) — coding conventions for review context
|
|
37
|
+
- `docs/architecture.md` (optional) — used for architecture alignment checks
|
|
38
|
+
- `docs/adrs/` (optional) — architecture decision records for alignment checks
|
|
39
|
+
- `docs/tdd-standards.md` (optional) — test coverage expectations
|
|
40
|
+
- `docs/review-standards.md` (optional) — severity definitions and review criteria
|
|
41
|
+
- `docs/reviews/post-implementation-review.md` (optional) — prior report; triggers Update Mode if present
|
|
42
|
+
|
|
43
|
+
## Expected Outputs
|
|
44
|
+
|
|
45
|
+
- `docs/reviews/post-implementation-review.md` — consolidated findings report
|
|
46
|
+
- Fixed code (P0/P1/P2 findings resolved) — in review+fix and update modes
|
|
47
|
+
|
|
48
|
+
## Mode Detection
|
|
49
|
+
|
|
50
|
+
| Condition | Mode |
|
|
51
|
+
|-----------|------|
|
|
52
|
+
| No prior report, no `--report-only` | **Review + Fix** — run all phases, then fix P0/P1/P2 |
|
|
53
|
+
| No prior report, `--report-only` | **Report Only** — run all phases, write report, no code changes |
|
|
54
|
+
| Prior report exists, no `--report-only` | **Update Mode** — load prior findings, skip to Phase 3 fix execution |
|
|
55
|
+
| Prior report exists, `--report-only` | **Re-review** — run full review fresh, overwrite prior report |
|
|
56
|
+
|
|
57
|
+
## Instructions
|
|
58
|
+
|
|
59
|
+
### Step 1: Detect Mode
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Detect --report-only flag
|
|
63
|
+
REPORT_ONLY=false
|
|
64
|
+
[[ "$ARGUMENTS" == *"--report-only"* ]] && REPORT_ONLY=true
|
|
65
|
+
|
|
66
|
+
# Detect prior report
|
|
67
|
+
PRIOR_REPORT="docs/reviews/post-implementation-review.md"
|
|
68
|
+
[[ -f "$PRIOR_REPORT" ]] && PRIOR_EXISTS=true || PRIOR_EXISTS=false
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Determine the active mode from the combination of flags:
|
|
72
|
+
- `PRIOR_EXISTS=false`, `REPORT_ONLY=false` → **Review + Fix** (proceed to Step 3)
|
|
73
|
+
- `PRIOR_EXISTS=false`, `REPORT_ONLY=true` → **Report Only** (proceed to Step 3, skip Step 8)
|
|
74
|
+
- `PRIOR_EXISTS=true`, `REPORT_ONLY=false` → **Update Mode** (proceed to Step 2)
|
|
75
|
+
- `PRIOR_EXISTS=true`, `REPORT_ONLY=true` → **Re-review** (proceed to Step 3, overwrite report)
|
|
76
|
+
|
|
77
|
+
Tell the user which mode is active before proceeding.
|
|
78
|
+
|
|
79
|
+
### Step 2: Handle Update Mode
|
|
80
|
+
|
|
81
|
+
*Skip this step unless in Update Mode.*
|
|
82
|
+
|
|
83
|
+
1. Read `docs/reviews/post-implementation-review.md`.
|
|
84
|
+
2. Extract the "Remaining Findings" section. If it contains any entries, stop and
|
|
85
|
+
tell the user:
|
|
86
|
+
|
|
87
|
+
> These findings were unresolved in the prior review:
|
|
88
|
+
> [list each finding with its severity and description]
|
|
89
|
+
>
|
|
90
|
+
> How would you like to proceed?
|
|
91
|
+
> (a) Retry fixing them
|
|
92
|
+
> (b) Skip them and fix only new findings
|
|
93
|
+
> (c) Cancel
|
|
94
|
+
|
|
95
|
+
Wait for the user's response before continuing.
|
|
96
|
+
|
|
97
|
+
3. Load all unresolved findings from the prior report into memory as the fix queue.
|
|
98
|
+
4. Skip directly to Step 8 (Fix Execution).
|
|
99
|
+
|
|
100
|
+
### Step 3: Build Phase 1 Context Bundle
|
|
101
|
+
|
|
102
|
+
*Skip this step in Update Mode.*
|
|
103
|
+
|
|
104
|
+
Codex and Gemini cannot read files directly. Build a context bundle before
|
|
105
|
+
dispatching them. Superpowers code-reviewer does not need a bundle.
|
|
106
|
+
|
|
107
|
+
**Generate the file tree:**
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
find . -type f \
|
|
111
|
+
-not -path '*/node_modules/*' \
|
|
112
|
+
-not -path '*/.git/*' \
|
|
113
|
+
-not -path '*/dist/*' \
|
|
114
|
+
-not -path '*/build/*' \
|
|
115
|
+
-not -path '*/.next/*' \
|
|
116
|
+
-not -path '*/coverage/*' \
|
|
117
|
+
-not -path '*/.scaffold/*' \
|
|
118
|
+
| sort
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Read architecture docs (if present):**
|
|
122
|
+
|
|
123
|
+
Read `docs/architecture.md` if it exists. Read all files in `docs/adrs/` if
|
|
124
|
+
the directory exists. Combine into a single architecture context string. If
|
|
125
|
+
neither exists, use an empty string and note "Architecture docs not found."
|
|
126
|
+
|
|
127
|
+
**Read standards:**
|
|
128
|
+
|
|
129
|
+
Read `docs/coding-standards.md`. Also read `docs/tdd-standards.md` and
|
|
130
|
+
`docs/review-standards.md` if they exist; append to the standards string.
|
|
131
|
+
|
|
132
|
+
**Select and read up to 15 key files:**
|
|
133
|
+
|
|
134
|
+
From the file tree, identify and read files in this priority order (skip
|
|
135
|
+
categories absent from this project):
|
|
136
|
+
|
|
137
|
+
1. Entry points: `main.*`, `index.*`, `app.*`, `server.*` at root or `src/`
|
|
138
|
+
2. Core services: files under `src/services/`, `src/lib/`, `src/core/`, or similar
|
|
139
|
+
3. Auth layer: files with `auth`, `login`, `session`, or `token` in their path
|
|
140
|
+
4. Database layer: files with `db`, `database`, `model`, `schema`, or `migration` in path
|
|
141
|
+
5. Test examples: 2–3 test files from different areas of the codebase
|
|
142
|
+
|
|
143
|
+
Format key files for the bundle:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
=== relative/path/to/file.ts ===
|
|
147
|
+
[full file contents]
|
|
148
|
+
|
|
149
|
+
=== relative/path/to/next-file.ts ===
|
|
150
|
+
[full file contents]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Step 4: Run Phase 1 — Cross-Cutting Sweep
|
|
154
|
+
|
|
155
|
+
*Skip this step in Update Mode.*
|
|
156
|
+
|
|
157
|
+
All three channels run independently on the context bundle from Step 3.
|
|
158
|
+
No channel sees another's output.
|
|
159
|
+
|
|
160
|
+
Construct the Phase 1 review prompt using the bundle assembled in Step 3:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
You are reviewing a software codebase for systemic quality issues.
|
|
164
|
+
|
|
165
|
+
## Project File Tree
|
|
166
|
+
[FILE_TREE]
|
|
167
|
+
|
|
168
|
+
## Architecture Documentation
|
|
169
|
+
[ARCHITECTURE, or "Not provided" if absent]
|
|
170
|
+
|
|
171
|
+
## Coding Standards
|
|
172
|
+
[CODING_STANDARDS]
|
|
173
|
+
|
|
174
|
+
## Key Source Files
|
|
175
|
+
[KEY_FILE_CONTENTS]
|
|
176
|
+
|
|
177
|
+
## Review Task
|
|
178
|
+
|
|
179
|
+
Review for SYSTEMIC concerns only. Do NOT review individual feature logic.
|
|
180
|
+
Focus on these categories:
|
|
181
|
+
1. architecture-alignment — Does the code match the architecture docs and ADRs? Are layers respected?
|
|
182
|
+
2. security — Auth implementation, input validation, secrets in code, OWASP Top 10
|
|
183
|
+
3. error-handling — Is error handling consistent? Are errors swallowed silently?
|
|
184
|
+
4. test-coverage — Are critical paths tested? Are there obvious coverage gaps?
|
|
185
|
+
5. complexity — Over-engineered areas, dead code, unnecessary abstractions, functions doing too much
|
|
186
|
+
6. dependencies — Unused dependencies, obviously outdated packages
|
|
187
|
+
|
|
188
|
+
Return ALL findings as valid JSON:
|
|
189
|
+
{
|
|
190
|
+
"findings": [
|
|
191
|
+
{
|
|
192
|
+
"severity": "P0|P1|P2|P3",
|
|
193
|
+
"category": "architecture-alignment|security|error-handling|test-coverage|complexity|dependencies",
|
|
194
|
+
"file": "relative/path/to/file.ts",
|
|
195
|
+
"line": 42,
|
|
196
|
+
"description": "Specific description of the issue",
|
|
197
|
+
"suggestion": "How to fix it"
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
Severity:
|
|
203
|
+
- P0: Critical — security vulnerabilities, data loss risk, broken functionality
|
|
204
|
+
- P1: Important — bugs, missing critical-path tests, significant performance issues
|
|
205
|
+
- P2: Suggestion — inconsistent patterns, naming, minor improvements
|
|
206
|
+
- P3: Nit — style preferences, very minor optimizations
|
|
207
|
+
|
|
208
|
+
Return ONLY valid JSON. No markdown, no explanation outside the JSON object.
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
#### Channel 1: Codex CLI
|
|
212
|
+
|
|
213
|
+
**Auth check first** (tokens expire — always re-verify):
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
codex login status 2>/dev/null && echo "codex authenticated" || echo "codex NOT authenticated"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
If not authenticated: tell the user "Codex auth expired. Run: `! codex login`".
|
|
220
|
+
Do NOT silently skip. Retry after user re-authenticates.
|
|
221
|
+
If Codex is not installed: skip this channel and note it in the report.
|
|
222
|
+
|
|
223
|
+
**Run the review:**
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
codex exec --skip-git-repo-check -s read-only --ephemeral "[PHASE 1 REVIEW PROMPT]" 2>/dev/null
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Store the JSON output as `CODEX_PHASE1_FINDINGS`.
|
|
230
|
+
|
|
231
|
+
#### Channel 2: Gemini CLI
|
|
232
|
+
|
|
233
|
+
**Auth check first:**
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
If exit code is 41: tell the user "Gemini auth expired. Run: `! gemini -p \"hello\"`".
|
|
240
|
+
Do NOT silently skip.
|
|
241
|
+
If Gemini is not installed: skip this channel and note it in the report.
|
|
242
|
+
|
|
243
|
+
**Run the review (independent — do NOT include Codex output in this prompt):**
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
NO_BROWSER=true gemini -p "[PHASE 1 REVIEW PROMPT]" --output-format json --approval-mode yolo 2>/dev/null
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Store as `GEMINI_PHASE1_FINDINGS`.
|
|
250
|
+
|
|
251
|
+
#### Channel 3: Superpowers Code-Reviewer
|
|
252
|
+
|
|
253
|
+
Dispatch the `superpowers:code-reviewer` subagent. This channel always runs.
|
|
254
|
+
|
|
255
|
+
Provide:
|
|
256
|
+
- `WHAT_WAS_IMPLEMENTED`: "Cross-cutting systemic review of the full codebase"
|
|
257
|
+
- `PLAN_OR_REQUIREMENTS`: Content of `docs/coding-standards.md` plus any architecture docs
|
|
258
|
+
- `DESCRIPTION`: "Review the full codebase for systemic concerns: architecture alignment,
|
|
259
|
+
security, error handling consistency, test coverage gaps, complexity/dead code, and
|
|
260
|
+
dependency health. This is a whole-codebase review — read all source files directly.
|
|
261
|
+
Do not review individual feature logic."
|
|
262
|
+
|
|
263
|
+
Do NOT provide BASE_SHA / HEAD_SHA — this is not a diff review.
|
|
264
|
+
|
|
265
|
+
The subagent must return findings in this JSON shape (normalize any findings it
|
|
266
|
+
surfaces to this format before returning):
|
|
267
|
+
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"findings": [
|
|
271
|
+
{
|
|
272
|
+
"severity": "P0|P1|P2|P3",
|
|
273
|
+
"category": "architecture-alignment|security|error-handling|test-coverage|complexity|dependencies",
|
|
274
|
+
"file": "relative/path/to/file.ts",
|
|
275
|
+
"line": 42,
|
|
276
|
+
"description": "Specific description of the issue",
|
|
277
|
+
"suggestion": "How to fix it"
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Store as `SUPERPOWERS_PHASE1_FINDINGS`.
|
|
284
|
+
|
|
285
|
+
### Step 5: Run Phase 2 — Parallel User Story Review
|
|
286
|
+
|
|
287
|
+
*Skip this step in Update Mode.*
|
|
288
|
+
|
|
289
|
+
#### 5a: Parse User Stories
|
|
290
|
+
|
|
291
|
+
Read `docs/user-stories.md`. Extract each story:
|
|
292
|
+
- Story title
|
|
293
|
+
- Description
|
|
294
|
+
- Acceptance criteria (the checklist items)
|
|
295
|
+
|
|
296
|
+
Use story headings (`## Story: [title]`, `### US-[N]`, or similar) as story
|
|
297
|
+
boundaries. Adapt to whatever heading format is used in the document.
|
|
298
|
+
|
|
299
|
+
#### 5b: Map Stories to Files
|
|
300
|
+
|
|
301
|
+
For each story, identify the files that implement it:
|
|
302
|
+
|
|
303
|
+
1. Read the story's acceptance criteria
|
|
304
|
+
2. Extract domain keywords (e.g. "password reset" → look for `password`, `reset` in file paths)
|
|
305
|
+
3. Scan the file tree for paths containing those keywords
|
|
306
|
+
4. Include other files in the same directory or module as matched files
|
|
307
|
+
5. Aim for 3–15 files per story; when uncertain, include more rather than fewer
|
|
308
|
+
|
|
309
|
+
Read the identified files. Format as:
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
=== relative/path/to/file.ts ===
|
|
313
|
+
[full file contents]
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
#### 5c: Apply Grouping Rules
|
|
317
|
+
|
|
318
|
+
- **Fewer than 5 stories:** Group into 2–3 thematic batches; one subagent per batch
|
|
319
|
+
- **5–20 stories:** One subagent per story (standard case)
|
|
320
|
+
- **Story maps to more than 20 files:** The subagent for that story splits its
|
|
321
|
+
review by layer (run Codex on backend files, then frontend files separately)
|
|
322
|
+
|
|
323
|
+
#### 5d: Dispatch Parallel Subagents
|
|
324
|
+
|
|
325
|
+
Use `superpowers:dispatching-parallel-agents` to dispatch one subagent per
|
|
326
|
+
story (or group). Each subagent is dispatched with full tool access and **can
|
|
327
|
+
dispatch further subagents** — this is how each story subagent runs its own
|
|
328
|
+
`superpowers:code-reviewer` as Channel 3. This two-level nesting is intentional
|
|
329
|
+
and supported. Each subagent receives these instructions:
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
You are reviewing the implementation of one user story using all three review channels.
|
|
333
|
+
|
|
334
|
+
## User Story
|
|
335
|
+
[STORY_TITLE]
|
|
336
|
+
[STORY_DESCRIPTION]
|
|
337
|
+
|
|
338
|
+
Acceptance Criteria:
|
|
339
|
+
[ACCEPTANCE_CRITERIA — bullet list]
|
|
340
|
+
|
|
341
|
+
## Implementation Files
|
|
342
|
+
[FILE_CONTENTS — formatted as === path === / contents blocks]
|
|
343
|
+
|
|
344
|
+
## Coding Standards
|
|
345
|
+
[CODING_STANDARDS content]
|
|
346
|
+
|
|
347
|
+
## Your Task
|
|
348
|
+
|
|
349
|
+
Run all three review channels. Each runs independently — do NOT share one channel's
|
|
350
|
+
output with another.
|
|
351
|
+
|
|
352
|
+
Channel 1 — Codex CLI:
|
|
353
|
+
Auth: codex login status 2>/dev/null
|
|
354
|
+
Run: codex exec --skip-git-repo-check -s read-only --ephemeral "[PER-STORY PROMPT]" 2>/dev/null
|
|
355
|
+
|
|
356
|
+
Channel 2 — Gemini CLI (independent):
|
|
357
|
+
Auth: NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1 (exit 41 = auth failure)
|
|
358
|
+
Run: NO_BROWSER=true gemini -p "[PER-STORY PROMPT]" --output-format json --approval-mode yolo 2>/dev/null
|
|
359
|
+
|
|
360
|
+
Channel 3 — Superpowers code-reviewer:
|
|
361
|
+
Dispatch superpowers:code-reviewer with:
|
|
362
|
+
- WHAT_WAS_IMPLEMENTED: "[STORY_TITLE]"
|
|
363
|
+
- PLAN_OR_REQUIREMENTS: "Acceptance criteria: [ACCEPTANCE_CRITERIA]"
|
|
364
|
+
- DESCRIPTION: "Review these files against the story acceptance criteria. Check for
|
|
365
|
+
bugs, missing edge cases, incorrect behavior, and security concerns."
|
|
366
|
+
|
|
367
|
+
The per-story review prompt for Codex and Gemini:
|
|
368
|
+
|
|
369
|
+
"You are reviewing the implementation of a specific user story.
|
|
370
|
+
|
|
371
|
+
## User Story
|
|
372
|
+
[STORY_TITLE]: [STORY_DESCRIPTION]
|
|
373
|
+
|
|
374
|
+
Acceptance Criteria:
|
|
375
|
+
[ACCEPTANCE_CRITERIA]
|
|
376
|
+
|
|
377
|
+
## Implementation Files
|
|
378
|
+
[FILE_CONTENTS]
|
|
379
|
+
|
|
380
|
+
## Coding Standards
|
|
381
|
+
[CODING_STANDARDS]
|
|
382
|
+
|
|
383
|
+
## Review Task
|
|
384
|
+
Review these files against the acceptance criteria above. Check:
|
|
385
|
+
1. Does the implementation satisfy each acceptance criterion?
|
|
386
|
+
2. Are there bugs or missing edge cases?
|
|
387
|
+
3. Are edge cases from the story handled?
|
|
388
|
+
4. Any security or validation concerns specific to this story?
|
|
389
|
+
|
|
390
|
+
Return JSON:
|
|
391
|
+
{
|
|
392
|
+
\"story\": \"[STORY_TITLE]\",
|
|
393
|
+
\"findings\": [
|
|
394
|
+
{
|
|
395
|
+
\"severity\": \"P0|P1|P2|P3\",
|
|
396
|
+
\"acceptance_criterion\": \"Which criterion (or null if general)\",
|
|
397
|
+
\"file\": \"relative/path/to/file.ts\",
|
|
398
|
+
\"line\": 42,
|
|
399
|
+
\"description\": \"Specific description\",
|
|
400
|
+
\"suggestion\": \"How to fix it\"
|
|
401
|
+
}
|
|
402
|
+
],
|
|
403
|
+
\"criteria_status\": {
|
|
404
|
+
\"[criterion text]\": \"satisfied|partial|not-satisfied\"
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
Return ONLY valid JSON."
|
|
409
|
+
|
|
410
|
+
Normalize the Superpowers code-reviewer findings to the same JSON shape as
|
|
411
|
+
Codex/Gemini (severity, acceptance_criterion, file, line, description, suggestion)
|
|
412
|
+
before returning. Then return all three channels' findings:
|
|
413
|
+
{
|
|
414
|
+
"story": "[STORY_TITLE]",
|
|
415
|
+
"codex": { "findings": [...] },
|
|
416
|
+
"gemini": { "findings": [...] },
|
|
417
|
+
"superpowers": { "findings": [...] }
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Collect findings from all subagents. Store as `PHASE2_FINDINGS`.
|
|
422
|
+
|
|
423
|
+
### Step 6: Consolidate Findings
|
|
424
|
+
|
|
425
|
+
Merge all findings from Phase 1 (`CODEX_PHASE1_FINDINGS`, `GEMINI_PHASE1_FINDINGS`,
|
|
426
|
+
`SUPERPOWERS_PHASE1_FINDINGS`) and Phase 2 (`PHASE2_FINDINGS`) into one flat list.
|
|
427
|
+
|
|
428
|
+
**Deduplication:** If two findings reference the same `file` and have similar
|
|
429
|
+
`description` keywords (indicating the same underlying issue), merge them into one
|
|
430
|
+
entry. Record all source channels in a `sources` array on the merged finding.
|
|
431
|
+
|
|
432
|
+
**Confidence tagging:** If `sources` has 2 or more entries, set `high_confidence: true`.
|
|
433
|
+
|
|
434
|
+
**Sorting:** P0 first, then P1, then P2, then P3.
|
|
435
|
+
|
|
436
|
+
**Fix queue:** P0, P1, and P2 findings enter the fix queue. P3 findings are recorded
|
|
437
|
+
in the report but not actioned.
|
|
438
|
+
|
|
439
|
+
### Step 7: Write the Findings Report
|
|
440
|
+
|
|
441
|
+
Create `docs/reviews/` if it does not exist. Write the following to
|
|
442
|
+
`docs/reviews/post-implementation-review.md`:
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
# Post-Implementation Code Review
|
|
446
|
+
|
|
447
|
+
## Summary
|
|
448
|
+
|
|
449
|
+
- **Date:** [YYYY-MM-DD]
|
|
450
|
+
- **Mode:** [Review + Fix | Report Only | Update Mode | Re-review]
|
|
451
|
+
- **Channels:** Codex [completed | skipped — reason] | Gemini [completed | skipped — reason] | Superpowers [completed]
|
|
452
|
+
- **Findings:** P0: [N] | P1: [N] | P2: [N] | P3: [N]
|
|
453
|
+
- **Fixed:** [N findings fixed | N/A — report-only]
|
|
454
|
+
|
|
455
|
+
## Phase 1: Systemic Findings
|
|
456
|
+
|
|
457
|
+
### Architecture Alignment
|
|
458
|
+
[Findings in this category, one per bullet. Or: "No findings."]
|
|
459
|
+
|
|
460
|
+
### Security
|
|
461
|
+
[Findings or "No findings."]
|
|
462
|
+
|
|
463
|
+
### Error Handling
|
|
464
|
+
[Findings or "No findings."]
|
|
465
|
+
|
|
466
|
+
### Test Coverage
|
|
467
|
+
[Findings or "No findings."]
|
|
468
|
+
|
|
469
|
+
### Complexity
|
|
470
|
+
[Findings or "No findings."]
|
|
471
|
+
|
|
472
|
+
### Dependencies
|
|
473
|
+
[Findings or "No findings."]
|
|
474
|
+
|
|
475
|
+
## Phase 2: Functional Findings
|
|
476
|
+
|
|
477
|
+
### Story: [story title]
|
|
478
|
+
**Criteria Status:**
|
|
479
|
+
- [criterion]: satisfied | partial | not-satisfied
|
|
480
|
+
|
|
481
|
+
**Findings:**
|
|
482
|
+
[P0/P1/P2/P3 findings for this story, or "No findings."]
|
|
483
|
+
|
|
484
|
+
[Repeat for each story]
|
|
485
|
+
|
|
486
|
+
## Fix Log
|
|
487
|
+
_Populated during fix execution._
|
|
488
|
+
|
|
489
|
+
## Remaining Findings
|
|
490
|
+
_Populated if any findings exceed 3 fix rounds._
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**If Report Only mode:** After writing the report, stop. Tell the user:
|
|
494
|
+
|
|
495
|
+
> Report written to `docs/reviews/post-implementation-review.md`.
|
|
496
|
+
>
|
|
497
|
+
> To apply fixes, re-run without the `--report-only` flag.
|
|
498
|
+
> To refresh the report with a new review, re-run with `--report-only`.
|
|
499
|
+
|
|
500
|
+
### Step 8: Fix Execution
|
|
501
|
+
|
|
502
|
+
*Skip this step in Report Only mode.*
|
|
503
|
+
|
|
504
|
+
Before making any fixes, record the current HEAD SHA:
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
PRE_FIX_SHA=$(git rev-parse HEAD)
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
This is used in Step 9 to identify all files modified across all fix commits,
|
|
511
|
+
regardless of how many severity-tier commits are made.
|
|
512
|
+
|
|
513
|
+
Process the fix queue in priority order: all P0s first, then all P1s, then all P2s.
|
|
514
|
+
Within each severity tier, fix high-confidence findings (multi-source) first.
|
|
515
|
+
|
|
516
|
+
For each finding:
|
|
517
|
+
|
|
518
|
+
1. Read the file at `finding.file`.
|
|
519
|
+
2. Apply the fix suggested by `finding.suggestion`, guided by `finding.description`.
|
|
520
|
+
3. Verify the fix immediately:
|
|
521
|
+
- Identify the project's test command (check `package.json` scripts for `test`,
|
|
522
|
+
`Makefile` for `make test`, `pytest` for Python, `go test ./...` for Go, etc.)
|
|
523
|
+
- Run the tests most relevant to the modified file
|
|
524
|
+
- If no tests exist for this file, re-read the file to confirm the fix is correct
|
|
525
|
+
4. If verification passes: mark the finding as resolved.
|
|
526
|
+
5. If verification fails: attempt to fix the failure. This counts as the same round.
|
|
527
|
+
6. Track fix attempts per finding. After 3 failed attempts:
|
|
528
|
+
- Record the finding under "Remaining Findings" in the report
|
|
529
|
+
- Stop attempting to fix it
|
|
530
|
+
- Continue to the next finding in the queue
|
|
531
|
+
|
|
532
|
+
After all P0s are fixed, re-read each P0-modified file once to confirm correctness
|
|
533
|
+
before moving to P1s.
|
|
534
|
+
|
|
535
|
+
Commit after each severity tier:
|
|
536
|
+
|
|
537
|
+
```bash
|
|
538
|
+
git add [modified source files only — not the report]
|
|
539
|
+
git commit -m "fix: resolve P0 post-implementation review findings"
|
|
540
|
+
# Replace P0 with P1 or P2 for the respective tiers
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Step 9: Final Verification Pass
|
|
544
|
+
|
|
545
|
+
After all fixes are applied, run a targeted re-check on modified files only
|
|
546
|
+
using Superpowers code-reviewer (fastest channel).
|
|
547
|
+
|
|
548
|
+
Identify all files modified across all fix commits using the pre-fix SHA
|
|
549
|
+
recorded at the start of Step 8:
|
|
550
|
+
|
|
551
|
+
```bash
|
|
552
|
+
git diff --name-only $PRE_FIX_SHA..HEAD
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
This captures files from every severity-tier commit (P0, P1, P2), not just
|
|
556
|
+
the most recent one.
|
|
557
|
+
|
|
558
|
+
Dispatch `superpowers:code-reviewer` with:
|
|
559
|
+
- `WHAT_WAS_IMPLEMENTED`: "Post-implementation review fix pass"
|
|
560
|
+
- `PLAN_OR_REQUIREMENTS`: Content of `docs/coding-standards.md`
|
|
561
|
+
- `DESCRIPTION`: "Verify these files after code review fixes were applied:
|
|
562
|
+
[list of modified files]. Check: (1) did the fixes resolve the reported issues?
|
|
563
|
+
(2) did any fix introduce a new problem? Report any new P0 or P1 findings only."
|
|
564
|
+
|
|
565
|
+
If the subagent reports new P0 or P1 findings:
|
|
566
|
+
- Add them to the findings report
|
|
567
|
+
- Fix them using the same process as Step 8
|
|
568
|
+
- Re-run this verification step on the newly modified files
|
|
569
|
+
|
|
570
|
+
When verification passes with no new P0/P1 findings, update
|
|
571
|
+
`docs/reviews/post-implementation-review.md` with the Fix Log:
|
|
572
|
+
|
|
573
|
+
- **Review + Fix / Re-review mode:** Replace the `_Populated during fix execution._`
|
|
574
|
+
placeholder in the "Fix Log" section
|
|
575
|
+
- **Update Mode:** The prior report already has a populated Fix Log; append a new
|
|
576
|
+
`## Fix Log — Update Run [YYYY-MM-DD]` section at the end of the report instead
|
|
577
|
+
of overwriting the existing one
|
|
578
|
+
|
|
579
|
+
Use this table format:
|
|
580
|
+
|
|
581
|
+
```
|
|
582
|
+
## Fix Log
|
|
583
|
+
|
|
584
|
+
| Finding | Severity | File | Fix Applied | Status |
|
|
585
|
+
|---------|----------|------|-------------|--------|
|
|
586
|
+
| [description] | P0 | path/to/file.ts | [brief description of fix] | Resolved |
|
|
587
|
+
| [description] | P1 | path/to/file.ts | [brief description of fix] | Resolved |
|
|
588
|
+
| [description] | P2 | path/to/file.ts | [brief description of fix] | Unresolved (3 attempts) |
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
Commit the updated report:
|
|
592
|
+
|
|
593
|
+
```bash
|
|
594
|
+
git add docs/reviews/post-implementation-review.md
|
|
595
|
+
git commit -m "docs: update post-implementation review report with fix log"
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
### Step 10: Confirm Completion
|
|
599
|
+
|
|
600
|
+
Output the completion summary:
|
|
601
|
+
|
|
602
|
+
```
|
|
603
|
+
Post-implementation review complete.
|
|
604
|
+
|
|
605
|
+
Channels: Codex [status] | Gemini [status] | Superpowers [completed]
|
|
606
|
+
Findings: P0: [N] | P1: [N] | P2: [N] | P3: [N]
|
|
607
|
+
Fixed: [N] | Remaining: [N]
|
|
608
|
+
|
|
609
|
+
Report: docs/reviews/post-implementation-review.md
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
If any findings remain in "Remaining Findings", list them explicitly and tell
|
|
613
|
+
the user they require manual attention before the project is ready to release.
|
|
614
|
+
|
|
615
|
+
## Fallback Behavior
|
|
616
|
+
|
|
617
|
+
| Situation | Action |
|
|
618
|
+
|-----------|--------|
|
|
619
|
+
| Codex not installed | Skip Codex in all phases; document as "not installed" in report |
|
|
620
|
+
| Gemini not installed | Skip Gemini in all phases; document as "not installed" in report |
|
|
621
|
+
| Codex auth expired | Tell user: "Codex auth expired. Run: `! codex login`". Do NOT silently skip. Retry after re-auth. |
|
|
622
|
+
| Gemini auth expired (exit 41) | Tell user: "Gemini auth expired. Run: `! gemini -p \"hello\"`". Do NOT silently skip. |
|
|
623
|
+
| Neither CLI installed | Run Superpowers code-reviewer only; warn user that review coverage is reduced |
|
|
624
|
+
| `docs/user-stories.md` missing | Skip Phase 2; run Phase 1 only; warn user that functional review is incomplete |
|
|
625
|
+
| `docs/coding-standards.md` missing | Proceed without it; note its absence in the report summary |
|
|
626
|
+
|
|
627
|
+
## Process Rules
|
|
628
|
+
|
|
629
|
+
1. **All three channels are mandatory** — skip only when a tool is genuinely not installed, never by choice.
|
|
630
|
+
2. **Auth failures are not silent** — always surface to the user with the exact recovery command.
|
|
631
|
+
3. **Independence** — never share one channel's output with another. Each reviews independently.
|
|
632
|
+
4. **Verify every fix** — run tests (or re-read the file) immediately after each fix before moving on.
|
|
633
|
+
5. **3-round limit** — never attempt to fix the same finding more than 3 times. Surface unresolved findings to the user.
|
|
634
|
+
6. **Document everything** — the report must show which channels ran, which were skipped, and why.
|
|
635
|
+
7. **No auto-merge** — this tool modifies local files only. It never pushes, merges, or creates PRs.
|
|
636
|
+
|
|
637
|
+
## After This Step
|
|
638
|
+
|
|
639
|
+
When the review is complete, tell the user:
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
**Post-implementation review complete.**
|
|
643
|
+
|
|
644
|
+
Results:
|
|
645
|
+
- Channels run: [list which ran in Phase 1 and Phase 2]
|
|
646
|
+
- Phase 1 (systemic): [N] findings — [N] fixed, [N] remaining
|
|
647
|
+
- Phase 2 (functional): [N] findings across [N] stories — [N] fixed, [N] remaining
|
|
648
|
+
- Report: `docs/reviews/post-implementation-review.md`
|
|
649
|
+
|
|
650
|
+
Next: If all findings are resolved, the codebase is ready for final review or
|
|
651
|
+
release. If findings remain, address them manually before proceeding.
|
|
652
|
+
|
|
653
|
+
**Pipeline reference:** `/scaffold:prompt-pipeline`
|
|
654
|
+
|
|
655
|
+
---
|