forge-workflow 0.0.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 (105) hide show
  1. package/.claude/commands/dev.md +314 -0
  2. package/.claude/commands/plan.md +389 -0
  3. package/.claude/commands/premerge.md +179 -0
  4. package/.claude/commands/research.md +42 -0
  5. package/.claude/commands/review.md +442 -0
  6. package/.claude/commands/rollback.md +721 -0
  7. package/.claude/commands/ship.md +134 -0
  8. package/.claude/commands/sonarcloud.md +152 -0
  9. package/.claude/commands/status.md +77 -0
  10. package/.claude/commands/validate.md +237 -0
  11. package/.claude/commands/verify.md +221 -0
  12. package/.claude/rules/greptile-review-process.md +285 -0
  13. package/.claude/rules/workflow.md +105 -0
  14. package/.claude/scripts/greptile-resolve.sh +526 -0
  15. package/.claude/scripts/load-env.sh +32 -0
  16. package/.forge/hooks/check-tdd.js +240 -0
  17. package/.github/PLUGIN_TEMPLATE.json +32 -0
  18. package/.mcp.json.example +12 -0
  19. package/AGENTS.md +169 -0
  20. package/CLAUDE.md +99 -0
  21. package/LICENSE +21 -0
  22. package/README.md +414 -0
  23. package/bin/forge-cmd.js +313 -0
  24. package/bin/forge-validate.js +303 -0
  25. package/bin/forge.js +4228 -0
  26. package/docs/AGENT_INSTALL_PROMPT.md +342 -0
  27. package/docs/ENHANCED_ONBOARDING.md +602 -0
  28. package/docs/EXAMPLES.md +482 -0
  29. package/docs/GREPTILE_SETUP.md +400 -0
  30. package/docs/MANUAL_REVIEW_GUIDE.md +106 -0
  31. package/docs/ROADMAP.md +359 -0
  32. package/docs/SETUP.md +632 -0
  33. package/docs/TOOLCHAIN.md +849 -0
  34. package/docs/VALIDATION.md +363 -0
  35. package/docs/WORKFLOW.md +400 -0
  36. package/docs/planning/PROGRESS.md +396 -0
  37. package/docs/plans/.gitkeep +0 -0
  38. package/docs/plans/2026-02-27-forge-test-suite-v2-decisions.md +21 -0
  39. package/docs/plans/2026-02-27-forge-test-suite-v2-design.md +362 -0
  40. package/docs/plans/2026-02-27-forge-test-suite-v2-tasks.md +343 -0
  41. package/docs/plans/2026-03-02-superpowers-gaps-decisions.md +26 -0
  42. package/docs/plans/2026-03-02-superpowers-gaps-design.md +239 -0
  43. package/docs/plans/2026-03-02-superpowers-gaps-tasks.md +260 -0
  44. package/docs/plans/2026-03-04-agent-command-parity-design.md +163 -0
  45. package/docs/plans/2026-03-04-verify-worktree-cleanup-decisions.md +7 -0
  46. package/docs/plans/2026-03-04-verify-worktree-cleanup-design.md +165 -0
  47. package/docs/plans/2026-03-05-forge-uto-decisions.md +6 -0
  48. package/docs/plans/2026-03-05-forge-uto-design.md +116 -0
  49. package/docs/plans/2026-03-05-forge-uto-tasks.md +244 -0
  50. package/docs/plans/2026-03-10-command-creator-and-eval-decisions.md +52 -0
  51. package/docs/plans/2026-03-10-command-creator-and-eval-design.md +350 -0
  52. package/docs/plans/2026-03-10-command-creator-and-eval-tasks.md +426 -0
  53. package/docs/plans/2026-03-10-stale-workflow-refs-decisions.md +8 -0
  54. package/docs/plans/2026-03-10-stale-workflow-refs-design.md +80 -0
  55. package/docs/plans/2026-03-10-stale-workflow-refs-tasks.md +90 -0
  56. package/docs/plans/2026-03-14-beads-plan-context-decisions.md +9 -0
  57. package/docs/plans/2026-03-14-beads-plan-context-design.md +171 -0
  58. package/docs/plans/2026-03-14-beads-plan-context-tasks.md +160 -0
  59. package/docs/plans/2026-03-14-skill-eval-loop-decisions.md +33 -0
  60. package/docs/plans/2026-03-14-skill-eval-loop-design.md +118 -0
  61. package/docs/plans/2026-03-14-skill-eval-loop-results.md +78 -0
  62. package/docs/plans/2026-03-14-skill-eval-loop-tasks.md +160 -0
  63. package/docs/plans/2026-03-15-agent-command-parity-v2-decisions.md +11 -0
  64. package/docs/plans/2026-03-15-agent-command-parity-v2-design.md +145 -0
  65. package/docs/plans/2026-03-15-agent-command-parity-v2-tasks.md +211 -0
  66. package/docs/research/TEMPLATE.md +292 -0
  67. package/docs/research/advanced-testing.md +297 -0
  68. package/docs/research/agent-permissions.md +167 -0
  69. package/docs/research/dependency-chain.md +328 -0
  70. package/docs/research/forge-workflow-v2.md +550 -0
  71. package/docs/research/plugin-architecture.md +772 -0
  72. package/docs/research/pr4-cli-automation.md +326 -0
  73. package/docs/research/premerge-verify-restructure.md +205 -0
  74. package/docs/research/skills-restructure.md +508 -0
  75. package/docs/research/sonarcloud-perfection-plan.md +166 -0
  76. package/docs/research/sonarcloud-quality-gate.md +184 -0
  77. package/docs/research/superpowers-integration.md +403 -0
  78. package/docs/research/superpowers.md +319 -0
  79. package/docs/research/test-environment.md +519 -0
  80. package/install.sh +1062 -0
  81. package/lefthook.yml +39 -0
  82. package/lib/agents/README.md +198 -0
  83. package/lib/agents/claude.plugin.json +28 -0
  84. package/lib/agents/cline.plugin.json +22 -0
  85. package/lib/agents/codex.plugin.json +19 -0
  86. package/lib/agents/copilot.plugin.json +24 -0
  87. package/lib/agents/cursor.plugin.json +25 -0
  88. package/lib/agents/kilocode.plugin.json +22 -0
  89. package/lib/agents/opencode.plugin.json +20 -0
  90. package/lib/agents/roo.plugin.json +23 -0
  91. package/lib/agents-config.js +2112 -0
  92. package/lib/commands/dev.js +513 -0
  93. package/lib/commands/plan.js +696 -0
  94. package/lib/commands/recommend.js +119 -0
  95. package/lib/commands/ship.js +377 -0
  96. package/lib/commands/status.js +378 -0
  97. package/lib/commands/validate.js +602 -0
  98. package/lib/context-merge.js +359 -0
  99. package/lib/plugin-catalog.js +360 -0
  100. package/lib/plugin-manager.js +166 -0
  101. package/lib/plugin-recommender.js +141 -0
  102. package/lib/project-discovery.js +491 -0
  103. package/lib/setup.js +118 -0
  104. package/lib/workflow-profiles.js +203 -0
  105. package/package.json +115 -0
@@ -0,0 +1,179 @@
1
+ ---
2
+ description: Complete all doc updates on feature branch, then hand off PR to user for merge
3
+ ---
4
+
5
+ Prepare the pull request for merge by completing ALL documentation updates on the feature branch, then hand off to the user.
6
+
7
+ # Premerge
8
+
9
+ **The actual merge is always done by the user in the GitHub UI — never by this command.**
10
+
11
+ This command makes the PR 100% complete: code + tests + docs in one unit. After this, the user merges once and there are no follow-up doc PRs needed.
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ /premerge <pr-number>
17
+ ```
18
+
19
+ ## What This Command Does
20
+
21
+ ### Step 1: Verify All CI Checks Pass
22
+
23
+ ```bash
24
+ gh pr checks <pr-number>
25
+ ```
26
+
27
+ All checks must be green before proceeding. If any fail, run `/review <pr-number>` first.
28
+
29
+ ### Step 2: Warn If Branch Is Behind Master
30
+
31
+ ```bash
32
+ gh pr view <pr-number> --json baseRefName,headRefName
33
+ git fetch origin master
34
+ git status
35
+ ```
36
+
37
+ If the feature branch is behind `master`, tell the user to rebase first:
38
+
39
+ ```
40
+ ⚠️ Branch is behind master — rebase before updating docs to avoid conflicts:
41
+ git rebase origin/master
42
+ git push --force-with-lease
43
+ ```
44
+
45
+ ### Step 3: Update ALL Relevant Documentation (on feature branch)
46
+
47
+ Check each of the following and update if the feature affects it. Be selective — only update what genuinely changed.
48
+
49
+ **A. `CHANGELOG.md`** (always):
50
+ - Add entry under `## [Unreleased]` heading (create heading if not present)
51
+ - Use [Keep a Changelog](https://keepachangelog.com/) categories:
52
+ - **Added**: New features
53
+ - **Changed**: Changes to existing functionality
54
+ - **Fixed**: Bug fixes
55
+ - **Removed**: Removed features
56
+ - Include: feature name, PR number, Beads ID
57
+ - Example:
58
+ ```markdown
59
+ ## [Unreleased]
60
+
61
+ ### Added
62
+ - Authentication refresh tokens (PR #89, forge-a3f8)
63
+ ```
64
+
65
+ **B. `README.md`** (if user-facing changes):
66
+ - Features list, configuration options, usage examples
67
+
68
+ **C. `docs/reference/API_REFERENCE.md`** (if API changes):
69
+ - New endpoints, request/response schemas, authentication
70
+
71
+ **D. Architecture docs** (if structural changes):
72
+ - `docs/architecture/` diagrams, decision records (ADRs)
73
+
74
+ **E. `CLAUDE.md` — USER section only** (if project conventions changed):
75
+ ```
76
+ <!-- USER:START - Add project-specific learnings here as you work -->
77
+ ...update only between these markers...
78
+ <!-- USER:END -->
79
+ ```
80
+ ⚠️ NEVER touch other managed blocks (e.g., `<!-- AGENT:START/END -->`).
81
+
82
+ **F. `AGENTS.md`** (if agent config, skills, or cross-agent workflow changed):
83
+ - Update relevant sections describing agent capabilities or workflow
84
+
85
+ **G. `docs/WORKFLOW.md`** (if the workflow itself changed):
86
+ - Update stage descriptions or workflow tables
87
+
88
+ **Commit doc updates to feature branch**:
89
+
90
+ ```bash
91
+ git add CHANGELOG.md README.md docs/ AGENTS.md CLAUDE.md
92
+ git commit -m "docs: update documentation for <feature-name>
93
+
94
+ - Updated: [list files changed]
95
+ - Reason: [brief explanation]"
96
+
97
+ git push
98
+ ```
99
+
100
+ ⚠️ **After pushing**: CI will re-trigger (Greptile, SonarCloud, etc.). Wait for checks to pass. If new Greptile comments appear on the doc changes, run `/review <pr-number>` again.
101
+
102
+ ### Step 4: Sync Beads
103
+
104
+ ```bash
105
+ bd sync
106
+ ```
107
+
108
+ ### Step 5: Hand Off — STOP HERE
109
+
110
+ **DO NOT run `gh pr merge`.** Present the PR and wait for the user to merge.
111
+
112
+ Output:
113
+
114
+ ```
115
+ ✅ PR #<number> is ready to merge
116
+
117
+ All checks: ✓ passing
118
+ Documentation: ✓ updated on feature branch
119
+ Beads: ✓ synced
120
+
121
+ 👉 Please merge in the GitHub UI:
122
+ https://github.com/<owner>/<repo>/pull/<number>
123
+
124
+ Recommended: Squash and merge (keeps main history clean)
125
+
126
+ After you merge, run /verify to confirm everything landed correctly.
127
+ ```
128
+
129
+ ```
130
+ <HARD-GATE: /premerge exit>
131
+ Do NOT run gh pr merge.
132
+ Do NOT suggest merging.
133
+ /premerge ends here. Output the PR URL and status. Wait for user.
134
+
135
+ "After you merge, run /verify to confirm everything landed correctly."
136
+ </HARD-GATE>
137
+ ```
138
+
139
+ ## Example Output
140
+
141
+ ```
142
+ ✓ CI checks: All passing
143
+ ✓ Branch: Up to date with master
144
+ ✓ Documentation updated:
145
+ - CHANGELOG.md: Entry added under [Unreleased]
146
+ - README.md: Features list updated
147
+ - CLAUDE.md: USER section updated with new pattern
148
+ - Committed: docs: update documentation for auth-refresh
149
+ ✓ CI re-triggered after doc push — all checks still passing
150
+ ✓ Beads synced
151
+
152
+ ✅ PR #89 is ready to merge
153
+
154
+ 👉 Please merge in the GitHub UI:
155
+ https://github.com/harshanandak/forge/pull/89
156
+
157
+ After you merge, run /verify
158
+ ```
159
+
160
+ ## Rules
161
+
162
+ - **NEVER run `gh pr merge`** — blocked by PreToolUse hook in `.claude/settings.json`
163
+ - **CLAUDE.md USER section only** — never touch other managed blocks
164
+ - **Warn if branch is behind** — tell user to rebase before doc updates
165
+ - **Re-check CI after doc push** — doc commits re-trigger full CI pipeline
166
+ - **One PR, complete** — code + tests + docs merged together, no follow-up doc PRs
167
+
168
+ ## Integration with Workflow
169
+
170
+ ```
171
+ Utility: /status → Understand current context before starting
172
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
173
+ Stage 2: /dev → Implement each task with subagent-driven TDD
174
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
175
+ Stage 4: /ship → Push + create PR
176
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
177
+ Stage 6: /premerge → Update docs, hand off PR to user (you are here)
178
+ Stage 7: /verify → Post-merge CI check on main
179
+ ```
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Deep research with parallel-deep-research, document findings
3
+ ---
4
+
5
+ > **Note**: `/research` is now Phase 2 of `/plan`.
6
+ >
7
+ > The research phase has been absorbed into the `/plan` command, which runs a full 3-phase workflow:
8
+ > - **Phase 1**: Brainstorming — design intent, constraints, success criteria
9
+ > - **Phase 2**: Technical research — web search, OWASP, codebase exploration, TDD scenarios
10
+ > - **Phase 3**: Setup — branch, worktree, Beads issue, task list
11
+ >
12
+ > Run `/plan <feature-slug>` to start the complete planning workflow.
13
+
14
+ # Research (Legacy Alias)
15
+
16
+ This command previously ran a standalone research phase. It is now embedded in `/plan` as Phase 2.
17
+
18
+ ## If you want to run just the research phase
19
+
20
+ Jump to Phase 2 of `/plan` manually:
21
+
22
+ 1. Read or create the design doc at `docs/plans/YYYY-MM-DD-<slug>-design.md`
23
+ 2. Run parallel web search using the `parallel-deep-research` skill
24
+ 3. Run OWASP Top 10 analysis for the feature
25
+ 4. Use the Explore agent for codebase exploration
26
+ 5. Identify at least 3 TDD test scenarios
27
+ 6. Append findings under `## Technical Research` in the design doc
28
+
29
+ Then continue with `/plan <slug> --continue` to run Phase 3 (setup + task list).
30
+
31
+ ## Integration with Workflow
32
+
33
+ ```
34
+ Utility: /status → Understand current context before starting
35
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
36
+ Stage 2: /dev → Implement each task with subagent-driven TDD
37
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
38
+ Stage 4: /ship → Push + create PR
39
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
40
+ Stage 6: /premerge → Update docs, hand off PR to user
41
+ Stage 7: /verify → Post-merge CI check on main
42
+ ```
@@ -0,0 +1,442 @@
1
+ ---
2
+ description: Address ALL PR issues (GitHub Actions, Greptile, SonarCloud, CI/CD)
3
+ ---
4
+
5
+ Process ALL pull request issues including GitHub Actions failures, Greptile inline comments, SonarCloud analysis, and other CI/CD checks.
6
+
7
+ # Review
8
+
9
+ This command handles ALL issues that arise after creating a pull request.
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ /review <pr-number>
15
+ ```
16
+
17
+ ## What This Command Does
18
+
19
+ ### Step 1: Fetch Complete PR Status
20
+ ```bash
21
+ # Get full PR details including all checks
22
+ gh pr view <pr-number> --json number,url,isDraft,reviews,statusCheckRollup,comments
23
+
24
+ # Check individual status checks
25
+ gh pr checks <pr-number>
26
+ ```
27
+
28
+ Review ALL status checks:
29
+ - GitHub Actions workflows
30
+ - Greptile code review (inline comments + summary)
31
+ - SonarCloud quality gate
32
+ - Any other CI/CD integrations
33
+ - Vercel deployments
34
+ - Security scanners
35
+
36
+ ### Step 2: Address GitHub Actions Failures
37
+
38
+ If any GitHub Actions workflows fail:
39
+
40
+ ```bash
41
+ # View failed workflow logs
42
+ gh run view <run-id> --log-failed
43
+
44
+ # Identify failure cause:
45
+ # - Build failures
46
+ # - Test failures
47
+ # - Lint/type check failures
48
+ # - Deployment failures
49
+ # - Security scan failures
50
+ ```
51
+
52
+ **For each failure**:
53
+ 1. **Analyze the error**: Read logs to understand root cause
54
+ 2. **Fix the issue**: Make necessary code changes
55
+ 3. **Re-run checks**: GitHub Actions will auto-rerun on push
56
+ 4. **Document fix**: Note what was fixed in commit message
57
+
58
+ **Common GitHub Actions Issues**:
59
+ - Build failures: Missing dependencies, compilation errors
60
+ - Test failures: Failing test cases (should not happen if /validate passed)
61
+ - Lint failures: Code style violations
62
+ - Type failures: TypeScript type errors
63
+ - Deployment failures: Env vars, configuration issues
64
+
65
+ ### Step 3: Process Greptile Review
66
+
67
+ Greptile provides TWO types of feedback:
68
+ 1. **Inline comments** on specific code lines
69
+ 2. **Summary** with overall recommendations
70
+
71
+ **IMPORTANT**: Use the **systematic Greptile resolution process** documented in `.claude/rules/greptile-review-process.md`. This process has been standardized to ensure:
72
+ - All threads are replied to directly (not as separate PR comments)
73
+ - All threads are marked as resolved after fixing
74
+ - No manual tracking overhead for maintainers
75
+
76
+ #### 3A. Check Greptile Inline Comments (Use Systematic Process)
77
+
78
+ **Step 1: List all unresolved threads**
79
+ ```bash
80
+ bash .claude/scripts/greptile-resolve.sh list <pr-number> --unresolved
81
+ ```
82
+
83
+ This shows:
84
+ - Thread ID (for resolving)
85
+ - Comment ID (for replying)
86
+ - File path and line number
87
+ - Issue description
88
+
89
+ **Step 2: For EACH unresolved thread:**
90
+
91
+ 1. **Understand the issue**
92
+ - Read the comment carefully
93
+ - Check the file and line number
94
+
95
+ 2. **Categorize the comment**:
96
+ - **Valid**: Should be implemented (security issue, bug, clear improvement)
97
+ - **Invalid**: Greptile misunderstood context
98
+ - **Conflicting**: Contradicts research decisions with good reason
99
+ - **Out of scope**: Valid but not for this PR
100
+
101
+ 3. **Fix the issue** (if valid)
102
+ - Make code changes
103
+ - Commit with clear message
104
+
105
+ 4. **Reply and resolve** (for ALL comments, even invalid ones)
106
+ ```bash
107
+ # For valid issues (fixed):
108
+ bash .claude/scripts/greptile-resolve.sh reply-and-resolve <pr-number> <comment-id> <thread-id> \
109
+ "✅ Fixed: [description]
110
+
111
+ Changed: [what was changed]
112
+ Reason: [why this fixes the issue]
113
+ Commit: [commit-sha]"
114
+
115
+ # For invalid/conflicting issues:
116
+ bash .claude/scripts/greptile-resolve.sh reply-and-resolve <pr-number> <comment-id> <thread-id> \
117
+ "This approach is correct because:
118
+ - Reasoning: [from design doc]
119
+ - Evidence: [link to source]
120
+ - Alternative considered: [what Greptile suggested]
121
+ - Why rejected: [specific reason]
122
+
123
+ See: docs/plans/YYYY-MM-DD-<slug>-design.md (Decision #X)"
124
+ ```
125
+
126
+ **Step 3: Verify all resolved**
127
+ ```bash
128
+ bash .claude/scripts/greptile-resolve.sh stats <pr-number>
129
+ ```
130
+ Should show: "✓ All Greptile threads resolved!"
131
+
132
+ **See complete process**: `.claude/rules/greptile-review-process.md`
133
+
134
+ #### 3B. Check Greptile Summary
135
+ ```bash
136
+ # Greptile usually posts a summary comment on the PR
137
+ # Review the overall assessment and recommendations
138
+ ```
139
+
140
+ The summary typically includes:
141
+ - Overall code quality assessment
142
+ - Key issues to address
143
+ - Security concerns
144
+ - Performance considerations
145
+ - Best practice violations
146
+
147
+ ### Step 4: Analyze SonarCloud (via sonarcloud skill)
148
+
149
+ ```bash
150
+ # Use sonarcloud skill to query PR-specific issues
151
+ /sonarcloud
152
+ ```
153
+
154
+ **What SonarCloud does**: Static code analysis for quality, security, and maintainability
155
+
156
+ **How it helps**:
157
+ - Identifies code smells and technical debt
158
+ - Finds security vulnerabilities (complementing OWASP Top 10)
159
+ - Calculates code coverage
160
+ - Tracks code duplication
161
+ - Assesses maintainability
162
+
163
+ **Query PR-specific data**:
164
+ - Quality gate status (pass/fail)
165
+ - New issues introduced in this PR
166
+ - Security hotspots
167
+ - Code coverage changes
168
+ - Technical debt added
169
+
170
+ **Prioritize issues**:
171
+ 1. **Blocker/Critical**: Must fix before merge
172
+ 2. **Major**: Should fix if valid
173
+ 3. **Minor/Info**: Optional improvements
174
+
175
+ ### Step 5: Check Other CI/CD Tools
176
+
177
+ Review any other automated checks:
178
+ - **Vercel**: Preview deployment successful?
179
+ - **Security scanners**: Any vulnerabilities detected?
180
+ - **Custom scripts**: Any failures?
181
+ - **Dependency checks**: Outdated or vulnerable packages?
182
+
183
+ ### Step 6: Categorize and Prioritize ALL Issues
184
+
185
+ Create a master list of all issues from:
186
+ - GitHub Actions failures
187
+ - Greptile inline comments
188
+ - Greptile summary recommendations
189
+ - SonarCloud issues
190
+ - Other CI/CD tool failures
191
+
192
+ Prioritize by:
193
+ 1. **Critical**: Blocks merge (failing tests, security vulnerabilities, build failures)
194
+ 2. **High**: Should address (valid bugs, important improvements)
195
+ 3. **Medium**: Optional but valuable (code quality, best practices)
196
+ 4. **Low**: Nice to have (minor refactorings, style suggestions)
197
+
198
+ ### Step 7: Address Issues Systematically
199
+
200
+ For **GitHub Actions failures** (Critical):
201
+ ```bash
202
+ # Fix the issue
203
+ # Commit with clear description
204
+ git add .
205
+ git commit -m "fix: resolve GitHub Actions failure in <workflow-name>
206
+
207
+ - Fixed: [specific issue]
208
+ - Root cause: [explanation]
209
+ - Solution: [what was changed]"
210
+
211
+ git push
212
+ # Actions will auto-rerun
213
+ ```
214
+
215
+ For **Greptile inline comments** (Use Systematic Script):
216
+ ```bash
217
+ # Use the standardized Greptile resolution script
218
+ # See .claude/rules/greptile-review-process.md for complete process
219
+
220
+ # For valid comments (fixed):
221
+ bash .claude/scripts/greptile-resolve.sh reply-and-resolve <pr-number> <comment-id> <thread-id> \
222
+ "✅ Fixed: [description]
223
+
224
+ Changed: [what was changed]
225
+ Reason: [why this fixes the issue]
226
+ Commit: [commit-sha]"
227
+
228
+ # For invalid/conflicting comments:
229
+ bash .claude/scripts/greptile-resolve.sh reply-and-resolve <pr-number> <comment-id> <thread-id> \
230
+ "This approach is correct because:
231
+ - Reasoning: [from design doc]
232
+ - Evidence: [link to source]
233
+ - Alternative considered: [what Greptile suggested]
234
+ - Why rejected: [specific reason]
235
+
236
+ See: docs/plans/YYYY-MM-DD-<slug>-design.md (Decision #X)"
237
+
238
+ # Verify all threads resolved:
239
+ bash .claude/scripts/greptile-resolve.sh stats <pr-number>
240
+ ```
241
+
242
+ For **Greptile summary recommendations**:
243
+ ```bash
244
+ # Add a PR comment addressing the summary
245
+ gh pr comment <pr-number> --body "## Greptile Summary Response
246
+
247
+ Addressed all key recommendations:
248
+ - [Recommendation 1]: ✓ Fixed in commit <sha>
249
+ - [Recommendation 2]: ✓ Explained (see inline response)
250
+ - [Recommendation 3]: ⏭️ Out of scope for this PR (created issue bd-xxx)
251
+
252
+ All critical and high-priority items resolved."
253
+ ```
254
+
255
+ For **SonarCloud issues** (via sonarcloud skill):
256
+ ```bash
257
+ # For critical/blocker issues: Fix immediately
258
+ # For security vulnerabilities: Fix immediately
259
+ # For code smells: Fix if valid, justify if not
260
+
261
+ # After fixes, SonarCloud will re-analyze on next push
262
+ ```
263
+
264
+ For **other CI/CD failures**:
265
+ ```bash
266
+ # Debug the specific tool's logs
267
+ # Fix the underlying issue
268
+ # Commit and push
269
+ # Verify the check passes
270
+ ```
271
+
272
+ ### Step 8: Commit ALL Fixes
273
+
274
+ ```bash
275
+ git add .
276
+ git commit -m "fix: address ALL PR review feedback
277
+
278
+ GitHub Actions:
279
+ - Fixed: [list of workflow failures resolved]
280
+
281
+ Greptile:
282
+ - Fixed: [list of valid inline comments addressed]
283
+ - Explained: [list of invalid comments with reasoning]
284
+ - Summary: [key recommendations addressed]
285
+
286
+ SonarCloud:
287
+ - Fixed: [security vulnerabilities and critical issues]
288
+ - Justified: [code smells that are intentional]
289
+
290
+ Other CI/CD:
291
+ - Fixed: [any other tool failures]
292
+
293
+ All review feedback resolved, all checks passing."
294
+
295
+ git push
296
+ ```
297
+
298
+ ### Step 9: Verify ALL Checks Pass
299
+
300
+ ```bash
301
+ # Wait for checks to complete
302
+ gh pr checks <pr-number>
303
+
304
+ # Ensure all status checks are green:
305
+ # ✓ GitHub Actions workflows
306
+ # ✓ Greptile review (no unresolved critical comments)
307
+ # ✓ SonarCloud quality gate
308
+ # ✓ Other CI/CD checks
309
+ ```
310
+
311
+ ### Step 10: Update Beads
312
+
313
+ ```bash
314
+ bd update <id> --comment "PR review complete: all issues addressed, all checks passing"
315
+ bd sync
316
+ ```
317
+
318
+ ## Example Output
319
+
320
+ ```
321
+ ✓ GitHub Actions: 3 workflows
322
+ - Build: ✓ Passing (was failing, fixed missing dependency)
323
+ - Tests: ✓ Passing
324
+ - Deploy Preview: ✓ Passing
325
+
326
+ ✓ Greptile Review:
327
+ Inline Comments: 8 total
328
+ - Valid: 5 → Fixed & replied inline
329
+ - Invalid: 2 → Explained with research evidence & replied inline
330
+ - Out of scope: 1 → Noted for future work & replied inline
331
+ - All marked resolved ✓
332
+
333
+ Summary:
334
+ - Key recommendations: 3/3 addressed
335
+ - Overall assessment: Ready for merge
336
+ - Posted summary response comment ✓
337
+
338
+ ✓ SonarCloud (via sonarcloud skill):
339
+ Quality Gate: ✓ Passing
340
+ Issues: 3 total
341
+ - Security: 1 → Fixed (SQL injection risk)
342
+ - Code smells: 2 → 1 fixed, 1 justified
343
+ - Coverage: Maintained at 85%
344
+
345
+ ✓ Vercel Preview: ✓ Deployed successfully
346
+ ✓ Security Scan: ✓ No vulnerabilities
347
+
348
+ ✓ All Issues Addressed:
349
+ - Critical: 2/2 fixed (GitHub Actions build, SonarCloud security)
350
+ - High: 5/5 fixed (Greptile valid comments)
351
+ - Medium: 3/3 addressed (1 fixed, 2 explained)
352
+ - Low: 0 (none found)
353
+
354
+ ✓ Fixes committed: 3c4d5e6
355
+ ✓ All checks passing: ✓
356
+ ✓ Beads updated: Ready for merge
357
+
358
+ Next: /premerge <pr-number>
359
+ ```
360
+
361
+ ```
362
+ <HARD-GATE: /review exit>
363
+ Do NOT declare /review complete until:
364
+ 1. bash .claude/scripts/greptile-resolve.sh stats <pr-number> shows "All Greptile threads resolved"
365
+ 2. ALL human reviewer comments are either resolved or have a reply with explanation
366
+ 3. gh pr checks <pr-number> shows all checks passing
367
+ 4. Stage transition: Run `bash scripts/beads-context.sh stage-transition <id> review premerge` → exit 0 confirmed
368
+ </HARD-GATE>
369
+ ```
370
+
371
+ ## Integration with Workflow
372
+
373
+ ```
374
+ Utility: /status → Understand current context before starting
375
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
376
+ Stage 2: /dev → Implement each task with subagent-driven TDD
377
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
378
+ Stage 4: /ship → Push + create PR
379
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud (you are here)
380
+ Stage 6: /premerge → Update docs, hand off PR to user
381
+ Stage 7: /verify → Post-merge CI check on main
382
+ ```
383
+
384
+ ## Understanding the Tools
385
+
386
+ ### Greptile
387
+ - **What it is**: AI-powered code review bot
388
+ - **How it helps**:
389
+ - Context-aware code analysis
390
+ - Catches bugs and security issues
391
+ - Suggests improvements and best practices
392
+ - Provides inline comments and summary
393
+ - **How to use feedback**:
394
+ - Inline comments: Address specific code issues
395
+ - Summary: Get overall assessment and key recommendations
396
+ - Reply directly to each comment (not separate)
397
+ - Mark resolved after addressing
398
+
399
+ ### SonarCloud (via sonarcloud skill)
400
+ - **What it is**: Static code analysis platform
401
+ - **How it helps**:
402
+ - Quality gate enforcement
403
+ - Security vulnerability detection
404
+ - Code smell identification
405
+ - Technical debt tracking
406
+ - Test coverage analysis
407
+ - **How to use the skill**:
408
+ - Query PR-specific issues
409
+ - Get quality metrics
410
+ - Identify security hotspots
411
+ - Track code coverage changes
412
+ - **Prioritization**:
413
+ - Blocker/Critical: Must fix
414
+ - Major: Should fix if valid
415
+ - Minor/Info: Optional
416
+
417
+ ### GitHub Actions
418
+ - **What it is**: CI/CD automation platform
419
+ - **How it helps**:
420
+ - Automated testing
421
+ - Build verification
422
+ - Deployment automation
423
+ - Security scanning
424
+ - Quality checks
425
+ - **Common failures**:
426
+ - Build: Dependencies, compilation
427
+ - Tests: Failing test cases
428
+ - Lint: Code style violations
429
+ - Deploy: Configuration issues
430
+
431
+ ## Tips
432
+
433
+ - **Address ALL issues**: Not just Greptile and SonarCloud
434
+ - **Prioritize critical**: Fix blockers first (GitHub Actions failures, security issues)
435
+ - **Reply inline to Greptile**: Respond to each comment directly
436
+ - **Post summary response**: Address Greptile's overall assessment
437
+ - **Use sonarcloud skill**: Don't just check the web UI
438
+ - **Verify all checks**: Ensure everything is green before /premerge
439
+ - **Update Beads**: Keep issue status current
440
+ - **Research if needed**: Use WebSearch for unclear suggestions
441
+ - **Document fixes**: Clear commit messages for all fixes
442
+ - **Don't leave unresolved**: Address every comment and check