wiggum-cli 0.16.0 → 0.17.1

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 (101) hide show
  1. package/bin/ralph.js +0 -0
  2. package/dist/agent/memory/ingest.d.ts +14 -0
  3. package/dist/agent/memory/ingest.js +77 -0
  4. package/dist/agent/memory/store.d.ts +15 -0
  5. package/dist/agent/memory/store.js +98 -0
  6. package/dist/agent/memory/types.d.ts +16 -0
  7. package/dist/agent/memory/types.js +14 -0
  8. package/dist/agent/orchestrator.d.ts +7 -0
  9. package/dist/agent/orchestrator.js +266 -0
  10. package/dist/agent/resolve-config.d.ts +26 -0
  11. package/dist/agent/resolve-config.js +43 -0
  12. package/dist/agent/tools/backlog.d.ts +27 -0
  13. package/dist/agent/tools/backlog.js +51 -0
  14. package/dist/agent/tools/dry-run.d.ts +106 -0
  15. package/dist/agent/tools/dry-run.js +119 -0
  16. package/dist/agent/tools/execution.d.ts +51 -0
  17. package/dist/agent/tools/execution.js +256 -0
  18. package/dist/agent/tools/feature-state.d.ts +43 -0
  19. package/dist/agent/tools/feature-state.js +184 -0
  20. package/dist/agent/tools/introspection.d.ts +23 -0
  21. package/dist/agent/tools/introspection.js +40 -0
  22. package/dist/agent/tools/memory.d.ts +44 -0
  23. package/dist/agent/tools/memory.js +99 -0
  24. package/dist/agent/tools/preflight.d.ts +7 -0
  25. package/dist/agent/tools/preflight.js +137 -0
  26. package/dist/agent/tools/reporting.d.ts +58 -0
  27. package/dist/agent/tools/reporting.js +119 -0
  28. package/dist/agent/tools/schemas.d.ts +2 -0
  29. package/dist/agent/tools/schemas.js +3 -0
  30. package/dist/agent/types.d.ts +45 -0
  31. package/dist/agent/types.js +1 -0
  32. package/dist/ai/conversation/conversation-manager.js +8 -0
  33. package/dist/ai/conversation/url-fetcher.js +27 -0
  34. package/dist/ai/providers.js +5 -5
  35. package/dist/commands/agent.d.ts +17 -0
  36. package/dist/commands/agent.js +114 -0
  37. package/dist/commands/monitor.js +50 -183
  38. package/dist/commands/new-auto.d.ts +15 -0
  39. package/dist/commands/new-auto.js +237 -0
  40. package/dist/commands/run.js +20 -10
  41. package/dist/commands/sync.d.ts +15 -0
  42. package/dist/commands/sync.js +68 -0
  43. package/dist/generator/config.d.ts +1 -41
  44. package/dist/generator/config.js +7 -0
  45. package/dist/generator/index.d.ts +2 -2
  46. package/dist/generator/templates.d.ts +2 -0
  47. package/dist/generator/templates.js +9 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +115 -4
  50. package/dist/repl/command-parser.d.ts +10 -0
  51. package/dist/repl/command-parser.js +10 -0
  52. package/dist/templates/prompts/PROMPT.md.tmpl +13 -10
  53. package/dist/templates/prompts/PROMPT_e2e.md.tmpl +13 -7
  54. package/dist/templates/prompts/PROMPT_feature.md.tmpl +16 -3
  55. package/dist/templates/prompts/PROMPT_review_auto.md.tmpl +32 -12
  56. package/dist/templates/prompts/PROMPT_review_manual.md.tmpl +4 -1
  57. package/dist/templates/prompts/PROMPT_review_merge.md.tmpl +39 -14
  58. package/dist/templates/prompts/PROMPT_verify.md.tmpl +5 -2
  59. package/dist/templates/scripts/feature-loop.sh.tmpl +441 -69
  60. package/dist/tui/app.d.ts +19 -2
  61. package/dist/tui/app.js +23 -4
  62. package/dist/tui/components/IssuePicker.d.ts +27 -0
  63. package/dist/tui/components/IssuePicker.js +73 -0
  64. package/dist/tui/components/RunCompletionSummary.js +6 -3
  65. package/dist/tui/components/StatusLine.d.ts +3 -1
  66. package/dist/tui/components/StatusLine.js +2 -2
  67. package/dist/tui/hooks/useAgentOrchestrator.d.ts +40 -0
  68. package/dist/tui/hooks/useAgentOrchestrator.js +491 -0
  69. package/dist/tui/orchestration/interview-orchestrator.d.ts +5 -1
  70. package/dist/tui/orchestration/interview-orchestrator.js +27 -6
  71. package/dist/tui/screens/AgentScreen.d.ts +24 -0
  72. package/dist/tui/screens/AgentScreen.js +209 -0
  73. package/dist/tui/screens/InitScreen.js +4 -0
  74. package/dist/tui/screens/InterviewScreen.d.ts +3 -1
  75. package/dist/tui/screens/InterviewScreen.js +146 -10
  76. package/dist/tui/screens/MainShell.d.ts +1 -1
  77. package/dist/tui/screens/MainShell.js +115 -4
  78. package/dist/tui/screens/RunScreen.js +72 -16
  79. package/dist/tui/utils/build-run-summary.d.ts +1 -1
  80. package/dist/tui/utils/build-run-summary.js +40 -84
  81. package/dist/tui/utils/clear-screen.d.ts +14 -0
  82. package/dist/tui/utils/clear-screen.js +16 -0
  83. package/dist/tui/utils/git-summary.d.ts +1 -0
  84. package/dist/tui/utils/git-summary.js +16 -0
  85. package/dist/tui/utils/loop-status.d.ts +41 -1
  86. package/dist/tui/utils/loop-status.js +243 -35
  87. package/dist/tui/utils/pr-summary.d.ts +3 -2
  88. package/dist/tui/utils/pr-summary.js +41 -6
  89. package/dist/utils/config.d.ts +8 -0
  90. package/dist/utils/config.js +8 -0
  91. package/dist/utils/github.d.ts +32 -0
  92. package/dist/utils/github.js +106 -0
  93. package/package.json +4 -1
  94. package/src/templates/prompts/PROMPT.md.tmpl +13 -10
  95. package/src/templates/prompts/PROMPT_e2e.md.tmpl +13 -7
  96. package/src/templates/prompts/PROMPT_feature.md.tmpl +16 -3
  97. package/src/templates/prompts/PROMPT_review_auto.md.tmpl +32 -12
  98. package/src/templates/prompts/PROMPT_review_manual.md.tmpl +4 -1
  99. package/src/templates/prompts/PROMPT_review_merge.md.tmpl +39 -14
  100. package/src/templates/prompts/PROMPT_verify.md.tmpl +5 -2
  101. package/src/templates/scripts/feature-loop.sh.tmpl +441 -69
@@ -0,0 +1,106 @@
1
+ import { execFile as execFileCb } from 'node:child_process';
2
+ /**
3
+ * Safe command execution using execFile (no shell, array-based args).
4
+ */
5
+ function safeExec(cmd, args, cwd) {
6
+ return new Promise((resolve, reject) => {
7
+ execFileCb(cmd, args, { cwd, timeout: 10000 }, (error, stdout) => {
8
+ if (error)
9
+ reject(error);
10
+ else
11
+ resolve(String(stdout));
12
+ });
13
+ });
14
+ }
15
+ let ghInstalledCache = null;
16
+ export async function isGhInstalled() {
17
+ if (ghInstalledCache !== null)
18
+ return ghInstalledCache;
19
+ try {
20
+ await safeExec('gh', ['--version']);
21
+ ghInstalledCache = true;
22
+ }
23
+ catch {
24
+ ghInstalledCache = false;
25
+ }
26
+ return ghInstalledCache;
27
+ }
28
+ export function _resetGhCache() {
29
+ ghInstalledCache = null;
30
+ }
31
+ export async function fetchGitHubIssue(owner, repo, number) {
32
+ try {
33
+ const stdout = await safeExec('gh', [
34
+ 'issue', 'view', String(number),
35
+ '--repo', `${owner}/${repo}`,
36
+ '--json', 'title,body,labels',
37
+ ]);
38
+ const data = JSON.parse(stdout);
39
+ return {
40
+ title: data.title ?? '',
41
+ body: data.body ?? '',
42
+ labels: (data.labels ?? []).map((l) => l.name),
43
+ };
44
+ }
45
+ catch {
46
+ return null;
47
+ }
48
+ }
49
+ export async function listRepoIssues(owner, repo, search, limit = 20) {
50
+ try {
51
+ const args = [
52
+ 'issue', 'list',
53
+ '--repo', `${owner}/${repo}`,
54
+ '--limit', String(limit),
55
+ '--json', 'number,title,state,labels,createdAt',
56
+ '--state', 'open',
57
+ ];
58
+ if (search) {
59
+ args.push('--search', search);
60
+ }
61
+ const stdout = await safeExec('gh', args);
62
+ const data = JSON.parse(stdout);
63
+ const issues = data.map((item) => ({
64
+ number: item.number,
65
+ title: item.title,
66
+ state: item.state.toLowerCase(),
67
+ labels: (item.labels ?? []).map((l) => l.name),
68
+ createdAt: item.createdAt ?? '',
69
+ }));
70
+ return { issues };
71
+ }
72
+ catch (err) {
73
+ const msg = err instanceof Error ? err.message : String(err);
74
+ if (msg.includes('auth') || msg.includes('login') || msg.includes('not logged')) {
75
+ return { issues: [], error: 'Run "gh auth login" to enable issue browsing' };
76
+ }
77
+ return { issues: [] };
78
+ }
79
+ }
80
+ export async function detectGitHubRemote(projectRoot) {
81
+ try {
82
+ const stdout = await safeExec('git', ['remote', 'get-url', 'origin'], projectRoot);
83
+ return parseGitHubRemote(stdout.trim());
84
+ }
85
+ catch {
86
+ return null;
87
+ }
88
+ }
89
+ const GITHUB_ISSUE_RE = /^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/(issues|pull)\/(\d+)\/?/;
90
+ export function isGitHubIssueUrl(input) {
91
+ const match = input.match(GITHUB_ISSUE_RE);
92
+ if (!match)
93
+ return null;
94
+ return { owner: match[1], repo: match[2], number: parseInt(match[4], 10) };
95
+ }
96
+ const SSH_REMOTE_RE = /^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/;
97
+ const HTTPS_REMOTE_RE = /^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/;
98
+ export function parseGitHubRemote(remoteUrl) {
99
+ const ssh = remoteUrl.match(SSH_REMOTE_RE);
100
+ if (ssh)
101
+ return { owner: ssh[1], repo: ssh[2] };
102
+ const https = remoteUrl.match(HTTPS_REMOTE_RE);
103
+ if (https)
104
+ return { owner: https[1], repo: https[2] };
105
+ return null;
106
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiggum-cli",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "AI-powered feature development loop CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -61,6 +61,9 @@
61
61
  "react": "^18.3.1",
62
62
  "zod": "^4.3.5"
63
63
  },
64
+ "overrides": {
65
+ "minimatch": ">=10.2.1"
66
+ },
64
67
  "devDependencies": {
65
68
  "@types/node": "^20.10.0",
66
69
  "@types/react": "^19.2.9",
@@ -1,5 +1,5 @@
1
1
  ## Context
2
- Study @.ralph/AGENTS.md for commands and patterns.
2
+ If @.ralph/guides/AGENTS.md exists, study it for commands and patterns.
3
3
  Study @.ralph/specs/$FEATURE.md for feature specification.
4
4
  Study @.ralph/specs/$FEATURE-implementation-plan.md for current tasks.
5
5
  {{#if frameworkVariant}}For detailed architecture, see @{{appDir}}/.claude/CLAUDE.md{{/if}}
@@ -18,10 +18,10 @@ Key patterns: parallel fetches, direct imports, React.cache(), lazy loading.
18
18
  - Search codebase before assuming something doesn't exist
19
19
 
20
20
  ## Task
21
- Pick the next incomplete task from the implementation plan.
21
+ Work through ALL incomplete tasks in the implementation plan in a single session.
22
22
  **Skip E2E tasks** (tasks starting with `E2E:`) - those are handled in a separate phase.
23
- Implement it following the patterns in AGENTS.md.
24
- Write tests for the implementation.
23
+ For each task: implement it, write tests, validate, commit, then move to the next task.
24
+ Do not stop after one task — keep going until all non-E2E tasks are complete.
25
25
 
26
26
  ## Validation
27
27
  After changes, ALL must pass:
@@ -36,7 +36,8 @@ If any validation fails, fix the issue before proceeding.
36
36
  Before committing, review your changes against @.ralph/guides/SECURITY.md:
37
37
  1. **Quick scan**: Input validation, injection prevention, auth checks, data exposure
38
38
  2. **Run**: `cd {{appDir}} && {{packageManager}} audit` (check for vulnerable dependencies)
39
- 3. **Check**: `mcp__supabase__get_advisors` with type "security" (RLS policies)
39
+ {{#if hasSupabase}}3. **Check**: `mcp__supabase__get_advisors` with type "security" (RLS policies)
40
+ {{/if}}
40
41
  4. **Red team**: Can auth be bypassed? Can other users' data be accessed?
41
42
 
42
43
  Flag any security issues in the implementation plan and fix before committing.
@@ -54,7 +55,7 @@ If any check fails, fix before committing.
54
55
 
55
56
  ## Completion
56
57
  When ALL validations pass:
57
- 1. Update @.ralph/specs/$FEATURE-implementation-plan.md - mark task done with commit hash
58
+ 1. Update @.ralph/specs/$FEATURE-implementation-plan.md change the task's `- [ ]` to `- [x]` and append the commit hash (e.g., `- [x] Task description - abc1234`). The harness tracks progress by counting checkboxes, so this step is mandatory.
58
59
  2. `git -C {{appDir}} add -A`
59
60
  3. `git -C {{appDir}} commit -m "type(scope): description"`
60
61
  4. `git -C {{appDir}} push origin feat/$FEATURE`
@@ -69,9 +70,11 @@ If this iteration revealed something useful, append to @.ralph/LEARNINGS.md:
69
70
  Format: `- [YYYY-MM-DD] [$FEATURE] Brief description`
70
71
 
71
72
  ## Rules
72
- - One task per iteration
73
+ - Complete ALL remaining non-E2E tasks before ending the session
74
+ - Commit after each task so progress is preserved if the session is interrupted
73
75
  - Tests are mandatory - no task is complete without tests
74
76
  - Search codebase before assuming something doesn't exist
75
- - If blocked, document in implementation plan and move to next task
76
- - Use Supabase MCP for database operations
77
- - Use PostHog MCP for analytics queries
77
+ - If blocked on a task, document in implementation plan and move to the next task
78
+ {{#if hasSupabase}}- Use Supabase MCP for database operations
79
+ {{/if}}{{#if hasPosthog}}- Use PostHog MCP for analytics queries
80
+ {{/if}}
@@ -1,5 +1,5 @@
1
1
  ## Context
2
- Study @.ralph/AGENTS.md for commands and patterns.
2
+ If @.ralph/guides/AGENTS.md exists, study it for commands and patterns.
3
3
  Study @.ralph/specs/$FEATURE.md for feature specification.
4
4
  Study @.ralph/specs/$FEATURE-implementation-plan.md for E2E test scenarios.
5
5
  {{#if frameworkVariant}}For detailed architecture, see @{{appDir}}/.claude/CLAUDE.md{{/if}}
@@ -21,6 +21,7 @@ If either fails, fix issues before proceeding with E2E tests.
21
21
  {{#if isTui}}
22
22
  ## Task
23
23
  Execute automated E2E tests for the completed TUI feature using the xterm.js bridge and agent-browser.
24
+ Run ALL scenarios in a single session — do not end between scenarios.
24
25
 
25
26
  ### Step 1: Start Bridge
26
27
  Check the bridge is running:
@@ -149,11 +150,11 @@ When all scenarios are executed:
149
150
  2. Update the Implementation Summary status to `[PASSED]` if all passed
150
151
  3. **Commit the updated implementation plan:**
151
152
  ```bash
152
- git add -A && git commit -m "test($FEATURE): E2E tests passed via agent-browser"
153
+ git -C {{appDir}} add -A && git -C {{appDir}} commit -m "test($FEATURE): E2E tests passed via agent-browser"
153
154
  ```
154
155
  4. **Push to remote:**
155
156
  ```bash
156
- git push origin feat/$FEATURE
157
+ git -C {{appDir}} push origin feat/$FEATURE
157
158
  ```
158
159
  5. If all passed: signal ready for PR phase
159
160
  6. If any failed: failures documented, loop will retry after fix iteration
@@ -168,6 +169,7 @@ Format: `- [YYYY-MM-DD] [$FEATURE] Brief description`
168
169
  {{else}}
169
170
  ## Task
170
171
  Execute automated E2E tests for the completed feature using Playwright MCP tools.
172
+ Run ALL scenarios in a single session — do not end between scenarios.
171
173
 
172
174
  ### Step 1: Check Dev Server
173
175
  Verify dev server is running at http://localhost:3000. If not accessible, start it:
@@ -176,7 +178,7 @@ cd {{appDir}} && {{devCommand}} &
176
178
  ```
177
179
  Wait ~10 seconds for server startup, then verify with a simple browser_navigate.
178
180
 
179
- ### Step 1.5: Seed Test Data (if needed)
181
+ {{#if hasSupabase}}### Step 1.5: Seed Test Data (if needed)
180
182
 
181
183
  Check if test scenarios require specific data volumes (e.g., pagination needs >10 rows).
182
184
 
@@ -199,6 +201,7 @@ query: "DELETE FROM table_name WHERE data->>'_test' = 'true';"
199
201
  ```
200
202
 
201
203
  **If seeding is impractical:** Document in implementation plan that E2E was skipped but unit tests provide coverage.
204
+ {{/if}}
202
205
 
203
206
  ### Step 2: Parse E2E Test Scenarios
204
207
  Read E2E test scenarios from @.ralph/specs/$FEATURE-implementation-plan.md.
@@ -246,7 +249,7 @@ For each E2E test scenario:
246
249
  - Check console: `browser_console_messages` for JS errors
247
250
  - Document failure details
248
251
 
249
- ### Step 4: Database Verification
252
+ {{#if hasSupabase}}### Step 4: Database Verification
250
253
  For scenarios with database checks, use Supabase MCP:
251
254
  ```
252
255
  mcp__plugin_supabase_supabase__execute_sql
@@ -255,6 +258,7 @@ query: "SELECT * FROM survey_responses WHERE ..."
255
258
  ```
256
259
 
257
260
  Verify returned data matches expected state.
261
+ {{/if}}
258
262
 
259
263
  ### Unique Test Data (for Parallel Execution)
260
264
  When creating test data, use unique identifiers to avoid conflicts with other loops:
@@ -315,11 +319,12 @@ Update @.ralph/specs/$FEATURE-implementation-plan.md for each scenario:
315
319
  2. Verify URL contains expected path/params
316
320
  ```
317
321
 
318
- ### Database State
322
+ {{#if hasSupabase}}### Database State
319
323
  ```
320
324
  1. mcp__plugin_supabase_supabase__execute_sql with SELECT query
321
325
  2. Verify row count, column values match expectations
322
326
  ```
327
+ {{/if}}
323
328
 
324
329
  ## Browser State Management
325
330
 
@@ -364,8 +369,9 @@ If code changes don't appear in the browser:
364
369
 
365
370
  ### Stale Data
366
371
  - Clear browser storage: Use `browser_close` between scenarios
367
- - Check Supabase for stale test data from previous runs
372
+ {{#if hasSupabase}}- Check Supabase for stale test data from previous runs
368
373
  - Delete test data: `DELETE FROM table WHERE data->>'_test' = 'true'`
374
+ {{/if}}
369
375
 
370
376
  ## Rules
371
377
  - Always get a fresh `browser_snapshot` after actions before making assertions
@@ -1,5 +1,5 @@
1
1
  ## Context
2
- Study @.ralph/AGENTS.md for commands and patterns.
2
+ If @.ralph/guides/AGENTS.md exists, study it for commands and patterns.
3
3
  Study @.ralph/specs/README.md for spec structure.
4
4
  Study @.ralph/specs/$FEATURE.md for feature specification.
5
5
  {{#if frameworkVariant}}For detailed architecture, see @{{appDir}}/.claude/CLAUDE.md{{/if}}
@@ -96,9 +96,22 @@ Example E2E scenario:
96
96
  - [x] E2E: Scenario name - PASSED
97
97
  ```
98
98
 
99
+ ## CRITICAL CONSTRAINT — PLANNING ONLY
100
+ **You are in the PLANNING phase. Your ONLY job is to produce an implementation plan.**
101
+ - Do NOT write any source code, test code, or configuration files
102
+ - Do NOT create, modify, or touch any files outside `.ralph/specs/`
103
+ - Do NOT run build, test, or lint commands
104
+ - Do NOT make git commits
105
+ - If you feel the urge to "just implement a small piece", STOP — that is a phase violation
106
+ - The implementation phase runs AFTER this session ends, in a separate session
107
+ - Violation of this constraint wastes tokens and breaks the harness automation
108
+
99
109
  ## Rules
100
- - Plan only in this phase, do NOT implement
101
- - One task = one commit-sized unit of work
110
+ - You MUST use `- [ ]` checkbox syntax for every task in the plan
111
+ - Do NOT use heading-based task formats (e.g., `#### Task 1:`) for individual tasks
112
+ - The harness parses `- [ ]` lines to track progress — other formats will break automation
113
+ - Use `### Phase N:` headings only for phase grouping, not for individual tasks
114
+ - One task = one commit-sized unit of work (but tasks can be grouped into phases for batch implementation)
102
115
  - Every implementation task needs a corresponding test task
103
116
  - Use Supabase MCP to check existing schema
104
117
  - Use PostHog MCP to check existing analytics setup
@@ -1,5 +1,5 @@
1
1
  ## Context
2
- Study @.ralph/AGENTS.md for commands and patterns.
2
+ If @.ralph/guides/AGENTS.md exists, study it for commands and patterns.
3
3
  Study @.ralph/specs/$FEATURE.md for feature specification.
4
4
  Study @.ralph/specs/$FEATURE-implementation-plan.md for completed tasks.
5
5
 
@@ -9,6 +9,7 @@ Capture any review feedback patterns for future iterations.
9
9
 
10
10
  ## Task
11
11
  All implementation and E2E tasks are complete. Create PR and request review.
12
+ Complete ALL steps in a single pass — do not end the session between steps.
12
13
 
13
14
  ### Step 1: Verify Ready State
14
15
  1. Check all tasks are complete in implementation plan (no `- [ ]` items)
@@ -52,12 +53,14 @@ cd {{appDir}} && gh pr create --base main --head feat/$FEATURE \
52
53
  [Read from implementation plan - list completed phases]
53
54
 
54
55
  ## Testing
55
- - [x] Unit/integration tests: 97 passing
56
- - [x] E2E tests: All scenarios passed via Playwright MCP
56
+ - [x] Unit/integration tests: passing
57
+ - [x] E2E tests: All scenarios passed
57
58
  - [x] Build succeeds
58
59
 
59
60
  ## E2E Test Results
60
- [Copy from implementation plan Phase 9]
61
+ [Copy from implementation plan E2E section]
62
+
63
+ Closes #[Read the source issue number from the spec file metadata or context section]
61
64
 
62
65
  Generated with Claude Code
63
66
  EOF
@@ -88,17 +91,27 @@ Review the git diff against main and check:
88
91
 
89
92
  Run: git diff main
90
93
 
91
- Respond with:
92
- - APPROVED if everything looks good
93
- - Or list specific issues with file:line references that need to be fixed
94
-
95
- IMPORTANT: After posting any PR review comment, you MUST print your final verdict as the LAST line of your output. Print exactly one of:
96
- VERDICT: APPROVED
97
- VERDICT: NOT APPROVED
98
- This line is parsed by the automation — do not omit it."
94
+ Then:
95
+ 1. Post your complete review as a comment on the PR using:
96
+ gh pr comment --body '<your review in markdown>'
97
+ Format the comment with: a summary, specific issues with file:line refs (if any), and the verdict.
98
+ 2. Print your final verdict as the LAST line of stdout. Print exactly one of:
99
+ VERDICT: APPROVED
100
+ VERDICT: NOT APPROVED
101
+ This line is parsed by the automation — do not omit it."
99
102
  fi
100
103
  ```
101
104
 
105
+ After the review completes, check its output:
106
+ - If it contains "VERDICT: APPROVED", echo that line so the automation detects it:
107
+ ```bash
108
+ echo "VERDICT: APPROVED"
109
+ ```
110
+ - If issues were found, echo:
111
+ ```bash
112
+ echo "VERDICT: NOT APPROVED"
113
+ ```
114
+
102
115
  **Handle review feedback:**
103
116
  - If Claude outputs "VERDICT: APPROVED" -> Done. The PR is ready for manual merge by the user.
104
117
  - If Claude lists issues:
@@ -113,8 +126,15 @@ After review is complete (approved or max iterations reached):
113
126
  1. Post a summary comment on the PR with the review outcome
114
127
  2. Do NOT merge — the user will review and merge manually
115
128
 
129
+ ## IMPORTANT: Review scope
130
+ If you discover that no implementation code exists (empty diff, no source files changed),
131
+ do NOT implement the feature yourself. Instead, report "VERDICT: NOT APPROVED —
132
+ no implementation found" so the harness can trigger a new implementation iteration.
133
+
116
134
  ## Rules
135
+ - **NEVER approve if any tests are failing.** Output "VERDICT: NOT APPROVED — test failures" if any tests fail.
117
136
  - Do NOT merge the PR — auto mode only reviews, the user merges
137
+ - Do NOT implement missing features — only review and fix minor issues
118
138
  - Address ALL review comments before marking as approved
119
139
  - If gh CLI fails, check authentication: `gh auth status`
120
140
  - Keep review conversation focused and professional
@@ -1,5 +1,5 @@
1
1
  ## Context
2
- Study @.ralph/AGENTS.md for commands and patterns.
2
+ If @.ralph/guides/AGENTS.md exists, study it for commands and patterns.
3
3
  Study @.ralph/specs/$FEATURE.md for feature specification.
4
4
  Study @.ralph/specs/$FEATURE-implementation-plan.md for completed tasks.
5
5
 
@@ -9,6 +9,7 @@ Capture any review feedback patterns for future iterations.
9
9
 
10
10
  ## Task
11
11
  All implementation and E2E tasks are complete. Create PR for manual review.
12
+ Complete ALL steps in a single pass — do not end the session between steps.
12
13
 
13
14
  ### Step 1: Verify Ready State
14
15
  1. Check all tasks are complete in implementation plan (no `- [ ]` items)
@@ -59,6 +60,8 @@ cd {{appDir}} && gh pr create --base main --head feat/$FEATURE \
59
60
  ## E2E Test Results
60
61
  [Copy from implementation plan if E2E phase exists]
61
62
 
63
+ Closes #[Read the source issue number from the spec file metadata or context section]
64
+
62
65
  Generated with Claude Code
63
66
  EOF
64
67
  )"
@@ -1,5 +1,5 @@
1
1
  ## Context
2
- Study @.ralph/AGENTS.md for commands and patterns.
2
+ If @.ralph/guides/AGENTS.md exists, study it for commands and patterns.
3
3
  Study @.ralph/specs/$FEATURE.md for feature specification.
4
4
  Study @.ralph/specs/$FEATURE-implementation-plan.md for completed tasks.
5
5
 
@@ -9,6 +9,7 @@ Capture any review feedback patterns for future iterations.
9
9
 
10
10
  ## Task
11
11
  All implementation and E2E tasks are complete. Create PR, review, and merge.
12
+ Complete ALL steps in a single pass — do not end the session between steps.
12
13
 
13
14
  ### Step 1: Verify Ready State
14
15
  1. Check all tasks are complete in implementation plan (no `- [ ]` items)
@@ -52,12 +53,14 @@ cd {{appDir}} && gh pr create --base main --head feat/$FEATURE \
52
53
  [Read from implementation plan - list completed phases]
53
54
 
54
55
  ## Testing
55
- - [x] Unit/integration tests: 97 passing
56
- - [x] E2E tests: All scenarios passed via Playwright MCP
56
+ - [x] Unit/integration tests: passing
57
+ - [x] E2E tests: All scenarios passed
57
58
  - [x] Build succeeds
58
59
 
59
60
  ## E2E Test Results
60
- [Copy from implementation plan Phase 9]
61
+ [Copy from implementation plan E2E section]
62
+
63
+ Closes #[Read the source issue number from the spec file metadata or context section]
61
64
 
62
65
  Generated with Claude Code
63
66
  EOF
@@ -88,17 +91,27 @@ Review the git diff against main and check:
88
91
 
89
92
  Run: git diff main
90
93
 
91
- Respond with:
92
- - APPROVED if everything looks good
93
- - Or list specific issues with file:line references that need to be fixed
94
-
95
- IMPORTANT: After posting any PR review comment, you MUST print your final verdict as the LAST line of your output. Print exactly one of:
96
- VERDICT: APPROVED
97
- VERDICT: NOT APPROVED
98
- This line is parsed by the automation — do not omit it."
94
+ Then:
95
+ 1. Post your complete review as a comment on the PR using:
96
+ gh pr comment --body '<your review in markdown>'
97
+ Format the comment with: a summary, specific issues with file:line refs (if any), and the verdict.
98
+ 2. Print your final verdict as the LAST line of stdout. Print exactly one of:
99
+ VERDICT: APPROVED
100
+ VERDICT: NOT APPROVED
101
+ This line is parsed by the automation — do not omit it."
99
102
  fi
100
103
  ```
101
104
 
105
+ After the review completes, check its output:
106
+ - If it contains "VERDICT: APPROVED", echo that line so the automation detects it:
107
+ ```bash
108
+ echo "VERDICT: APPROVED"
109
+ ```
110
+ - If issues were found, echo:
111
+ ```bash
112
+ echo "VERDICT: NOT APPROVED"
113
+ ```
114
+
102
115
  **Handle review feedback:**
103
116
  - If Claude outputs "VERDICT: APPROVED" -> Proceed to Step 5 (rebase and merge)
104
117
  - If Claude lists issues:
@@ -119,7 +132,10 @@ If rebase has conflicts:
119
132
  1. Resolve conflicts in affected files
120
133
  2. `git add .` the resolved files
121
134
  3. `git rebase --continue`
122
- 4. Re-run tests: `{{testCommand}} && {{buildCommand}}`
135
+
136
+ After rebase (whether or not there were conflicts), ALWAYS re-run tests and build:
137
+ cd {{appDir}} && {{testCommand}} && {{buildCommand}}
138
+ If any tests fail after rebase, fix them before proceeding. Do NOT merge with failing tests.
123
139
 
124
140
  Push rebased branch:
125
141
  ```bash
@@ -127,7 +143,9 @@ cd {{appDir}} && git push --force-with-lease origin feat/$FEATURE
127
143
  ```
128
144
 
129
145
  ### Step 6: Merge PR
130
- When Claude review is approved and branch is rebased:
146
+ **Pre-merge gate:** Confirm ALL tests pass. Run `cd {{appDir}} && {{testCommand}}` one final time. If ANY test fails, STOP — do not merge. Fix the failures first, then re-run.
147
+
148
+ When Claude review is approved, all tests pass, and branch is rebased:
131
149
  ```bash
132
150
  cd {{appDir}} && gh pr merge --squash --delete-branch
133
151
  ```
@@ -145,8 +163,15 @@ cd {{appDir}} && gh pr merge --squash --delete-branch
145
163
 
146
164
  Note: Spec status updates are handled in the Spec Verification phase before PR creation.
147
165
 
166
+ ## IMPORTANT: Review scope
167
+ If you discover that no implementation code exists (empty diff, no source files changed),
168
+ do NOT implement the feature yourself. Instead, report "VERDICT: NOT APPROVED —
169
+ no implementation found" so the harness can trigger a new implementation iteration.
170
+
148
171
  ## Rules
172
+ - **NEVER merge if any tests are failing.** If tests fail after rebase, fix them first. If unfixable, output "VERDICT: NOT APPROVED — test failures" and stop.
149
173
  - Do NOT merge without Claude Code approval
174
+ - Do NOT implement missing features — only review and fix minor issues
150
175
  - Address ALL review comments before merging
151
176
  - Use squash merge to keep history clean
152
177
  - If gh CLI fails, check authentication: `gh auth status`
@@ -7,6 +7,7 @@ Read @.ralph/LEARNINGS.md for verification patterns from previous features.
7
7
 
8
8
  ## Task
9
9
  Verify that the implementation meets the spec requirements. Update spec files accordingly.
10
+ Complete ALL steps in a single pass — do not end the session between steps.
10
11
 
11
12
  ### Step 1: Review Requirements
12
13
  Read @.ralph/specs/$FEATURE.md and for each requirement under "## Requirements":
@@ -29,8 +30,10 @@ Update `**Last Updated:**` to today's date.
29
30
 
30
31
  ### Step 4: Update README.md
31
32
  Update @.ralph/specs/README.md Active Specs table:
32
- - Change status from "Planned" to "Completed" (or "Partial")
33
- - Update Last Updated date
33
+ - Add or update ONLY the row for $FEATURE — do NOT remove or modify other rows
34
+ - Change this feature's status from "Planned" to "Completed" (or "Partial")
35
+ - Update this feature's Last Updated date
36
+ - IMPORTANT: Preserve ALL existing rows in the table — previous features must remain intact
34
37
 
35
38
  ### Step 5: Document Gaps (if any)
36
39
  If any requirements were not fully met, add a section to the spec: