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,221 @@
1
+ ---
2
+ description: Post-merge health check — confirm merge landed, CI is clean, deployments are up
3
+ ---
4
+
5
+ Verify that the merge landed correctly and everything is running properly after merge.
6
+
7
+ # Verify
8
+
9
+ This command runs AFTER the user has merged the PR. It checks system health — not documentation (that was handled in `/premerge`).
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ /verify
15
+ ```
16
+
17
+ ## What This Command Does
18
+
19
+ ### Step 1: Switch to Main and Pull
20
+
21
+ ```bash
22
+ git checkout master
23
+ git pull
24
+ ```
25
+
26
+ Confirm the merge actually landed on main. If the PR isn't merged yet, stop and tell the user to merge first.
27
+
28
+ ### Step 2: Confirm PR Is Merged
29
+
30
+ Detect the most recently merged PR from the current HEAD commit:
31
+
32
+ ```bash
33
+ gh pr list --state merged --base master --limit 1 --json number,state,mergedAt,mergedBy
34
+ ```
35
+
36
+ - `state` should be `MERGED`
37
+ - If no PR found: the merge may not have landed yet — stop and tell the user to merge first
38
+ - If the wrong PR appears: user can specify the number directly with `gh pr view <number> --json state,mergedAt,mergedBy`
39
+
40
+ ### Step 3: Check CI on Main After Merge
41
+
42
+ ```bash
43
+ gh run list --branch master --limit 5
44
+ ```
45
+
46
+ Check the most recent workflow runs on `master`:
47
+ - All should be passing or in progress
48
+ - If any failed: identify which workflow and what failed
49
+ - Failed CI on main after merge may need a hotfix PR
50
+
51
+ ### Step 4: Check Deployments (if applicable)
52
+
53
+ Check if the project has a deployment target:
54
+
55
+ ```bash
56
+ # Check deployment status from latest run
57
+ gh run list --branch master --limit 1
58
+
59
+ # Check Vercel deployments for the merged PR (use number from Step 2)
60
+ gh pr view <number> --json deployments
61
+ ```
62
+
63
+ If deployments exist:
64
+ - Are they showing as successful?
65
+ - Is the production/preview URL responding?
66
+
67
+ ### Step 5: Report Status
68
+
69
+ **If everything is clean**:
70
+ ```
71
+ ✅ Merge verified — everything is healthy
72
+
73
+ PR: #<number> merged by <user> at <time>
74
+ CI on master: ✓ All passing
75
+ Deployments: ✓ Up (if applicable)
76
+
77
+ Ready for next feature → run /status
78
+ ```
79
+
80
+ **If issues found**:
81
+ ```
82
+ ⚠️ Post-merge issues detected
83
+
84
+ PR: #<number> merged ✓
85
+ CI on master: ✗ <workflow-name> failing
86
+ - Error: <description>
87
+ - Action needed: <hotfix or investigation>
88
+
89
+ Deployments: ✗ <deployment> not responding
90
+
91
+ Next: Create hotfix branch or investigate root cause
92
+ ```
93
+
94
+ ### Step 6: Clean Up Worktree and Branch
95
+
96
+ Only run this step after CI is confirmed healthy (Step 3 passed).
97
+
98
+ Get the merged branch name:
99
+
100
+ ```bash
101
+ gh pr view <number> --json headRefName --jq '.headRefName'
102
+ ```
103
+
104
+ If the branch name cannot be determined (empty output or error), skip cleanup and tell the user to run `git worktree list` and clean up manually.
105
+
106
+ Find and remove the matching worktree (if it exists):
107
+
108
+ ```bash
109
+ # Get the worktree path for this exact branch
110
+ WORKTREE_PATH=$(git worktree list --porcelain \
111
+ | awk -v branch="refs/heads/<branch>" '
112
+ /^worktree / { path=substr($0, 10) }
113
+ $0 == "branch " branch { print path }
114
+ ')
115
+
116
+ if [ -n "$WORKTREE_PATH" ]; then
117
+ git worktree remove "$WORKTREE_PATH" --force
118
+ echo "Worktree: removed ✓ ($WORKTREE_PATH)"
119
+ else
120
+ echo "Worktree: not found (already removed or never created) — skipping"
121
+ fi
122
+ ```
123
+
124
+ If no worktree is found for that branch, skip gracefully with a note: "Worktree: not found (already removed or never created)".
125
+
126
+ Delete the local branch (safe delete only):
127
+
128
+ ```bash
129
+ git branch -d <branch> 2>/dev/null || echo "Branch: already deleted — skipping"
130
+ ```
131
+
132
+ The `|| echo` fallback handles the case where the branch is already gone (e.g., deleted by a previous run or the remote), so the command never fails the verify step.
133
+
134
+ Report cleanup in output:
135
+ ```
136
+ Worktree: removed ✓
137
+ Branch: <branch-name> deleted ✓
138
+ ```
139
+
140
+ ### Step 7: If Issues Found — Create Beads Issue
141
+
142
+ **Never commit inline.** If something is wrong, create a tracking issue:
143
+
144
+ ```bash
145
+ bd create --title="Post-merge: <description of issue>" --type=bug --priority=1
146
+ ```
147
+
148
+ ### Step 8: Close Beads Issue (if healthy)
149
+
150
+ If everything is clean, close the Beads issue:
151
+
152
+ ```bash
153
+ bd close <id> --reason="Merged and verified on master"
154
+ ```
155
+
156
+ ```
157
+ <HARD-GATE: /verify exit>
158
+ Do NOT declare /verify complete until:
159
+ 1. gh run list --branch master --limit 3 shows actual CI output (not "should be fine")
160
+ 2. If healthy: Beads issue is closed (bd close <id> run and confirmed)
161
+ 3. If issues found: Beads tracking issue created for every problem
162
+ 4. Worktree removed (or confirmed already gone) — OR Step 6 was intentionally skipped because CI was unhealthy; if skipped, state explicitly: "cleanup deferred, CI was not healthy"
163
+ "It should be fine" is not evidence. Run the command. Show the output.
164
+ </HARD-GATE>
165
+ ```
166
+
167
+ ## Rules
168
+
169
+ - **Never commits** — this command is read-only
170
+ - **Never creates PRs** — if fixes are needed, that's a new /dev cycle
171
+ - **Runs after user confirms merge** — not before
172
+ - **Reports honestly** — if CI is broken on main, say so clearly
173
+
174
+ ## Example Output (Healthy)
175
+
176
+ ```
177
+ ✅ Merge verified — everything is healthy
178
+
179
+ PR: #89 merged by harshanandak at 2026-02-24T14:30:00Z
180
+ Branch: feat/auth-refresh deleted ✓
181
+ CI on master:
182
+ ✓ Test Suite (ubuntu, node 20): passing
183
+ ✓ Test Suite (windows, node 22): passing
184
+ ✓ ESLint: passing
185
+ ✓ SonarCloud: passing
186
+ ✓ CodeQL: passing
187
+ Deployments: N/A (no deployment configured)
188
+
189
+ Ready for next feature → run /status
190
+ ```
191
+
192
+ ## Example Output (Issues Found)
193
+
194
+ ```
195
+ ⚠️ Post-merge issues detected
196
+
197
+ PR: #89 merged ✓
198
+ CI on master:
199
+ ✓ Test Suite: passing
200
+ ✗ SonarCloud: quality gate failing
201
+ - 2 new code smells introduced
202
+ - Action: investigate or create hotfix
203
+
204
+ Created Beads issue: forge-xyz
205
+ "Post-merge: SonarCloud quality gate failing on master after PR #89"
206
+
207
+ Run /status to assess next steps
208
+ ```
209
+
210
+ ## Integration with Workflow
211
+
212
+ ```
213
+ Utility: /status → Understand current context before starting
214
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
215
+ Stage 2: /dev → Implement each task with subagent-driven TDD
216
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
217
+ Stage 4: /ship → Push + create PR
218
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
219
+ Stage 6: /premerge → Update docs, hand off PR to user
220
+ Stage 7: /verify → Post-merge CI check on main (you are here) ✓
221
+ ```
@@ -0,0 +1,285 @@
1
+ # Greptile Review Handling Process
2
+
3
+ **Purpose**: Standardized process for AI agents to systematically handle Greptile review comments.
4
+
5
+ **Critical**: This process has been problematic for days. AI agents MUST follow these exact steps for EVERY Greptile comment.
6
+
7
+ ---
8
+
9
+ ## Problem Background
10
+
11
+ **Previous Issues:**
12
+ - ❌ AI agents replied to PR with general comments instead of replying directly to each Greptile review thread
13
+ - ❌ AI agents didn't mark conversation threads as "resolved" after fixing issues
14
+ - ❌ No systematic process for tracking which Greptile comments are addressed vs pending
15
+ - ❌ Caused confusion and manual tracking overhead for maintainers
16
+
17
+ **Why This Matters:**
18
+ - Branch protection blocks merge when threads are unresolved
19
+ - Maintainers must manually verify all issues are addressed
20
+ - Inconsistent handling across different AI sessions
21
+
22
+ ---
23
+
24
+ ## Critical Distinction
25
+
26
+ **Replying vs Resolving:**
27
+
28
+ 1. **Replying** = Adding a comment to the review thread
29
+ - Uses REST API: `/repos/{owner}/{repo}/pulls/{pr}/comments/{comment_id}/replies`
30
+ - Creates a threaded response within the review comment
31
+ - Does NOT change the thread's resolved status
32
+
33
+ 2. **Resolving** = Marking the thread as complete
34
+ - Uses GraphQL API: `resolveReviewThread` mutation
35
+ - Changes thread status to "Resolved"
36
+ - Shows who resolved it and when
37
+
38
+ **Both are required** by this project's workflow:
39
+ - Reply explains what was fixed and why
40
+ - Resolve marks the thread as addressed
41
+
42
+ ---
43
+
44
+ ## For AI Agents: Mandatory Steps
45
+
46
+ When Greptile Quality Gate fails (score < 4/5) or when review comments exist:
47
+
48
+ ### Step 1: List ALL Greptile Feedback (Inline + Direct Comments)
49
+
50
+ Greptile posts feedback in **two places**:
51
+ 1. **Inline review threads** — attached to specific code lines (resolvable via GraphQL)
52
+ 2. **Direct PR issue comments** — "Additional Comments (N)" posted as regular PR comments (reply with `gh pr comment`)
53
+
54
+ Always run `list-all` to see both:
55
+
56
+ ```bash
57
+ bash .claude/scripts/greptile-resolve.sh list-all <pr-number>
58
+ ```
59
+
60
+ Or just inline threads (unresolved only):
61
+
62
+ ```bash
63
+ bash .claude/scripts/greptile-resolve.sh list <pr-number> --unresolved
64
+ ```
65
+
66
+ **Output shows:**
67
+ - Thread ID (for resolving inline threads)
68
+ - Comment ID (for replying to inline threads)
69
+ - File path and line number
70
+ - Issue description
71
+ - Direct PR comment IDs and previews (reply with `gh pr comment`)
72
+
73
+ **Example:**
74
+ ```
75
+ ✗ UNRESOLVED | docs/ROADMAP.md:282
76
+ Thread ID: PRRT_kwDORErEU85tuh6I
77
+ Comment ID: 2787717459
78
+ Author: greptile-apps
79
+ Issue: Leaking local Windows paths
80
+ ```
81
+
82
+ ### Step 2: For EACH Unresolved Thread (Systematic)
83
+
84
+ **Process each thread one at a time:**
85
+
86
+ 1. **Read the comment** and understand the issue
87
+ - Use the file path and line number to locate the code
88
+ - Understand what Greptile is flagging
89
+
90
+ 2. **Fix the issue** if the comment is valid
91
+ - Make the necessary code changes
92
+ - Commit the fix with a clear message
93
+
94
+ 3. **Reply to the thread** with explanation
95
+ ```bash
96
+ bash .claude/scripts/greptile-resolve.sh reply <pr-number> <comment-id> "✅ Fixed: [description]
97
+
98
+ Changed: [what was changed]
99
+ Reason: [why this fixes the issue]
100
+ Commit: [commit-sha]"
101
+ ```
102
+
103
+ 4. **Resolve the thread**
104
+ ```bash
105
+ bash .claude/scripts/greptile-resolve.sh resolve <pr-number> <thread-id>
106
+ ```
107
+
108
+ 5. **Track progress**: Mark comment as addressed in your notes
109
+
110
+ **Alternative (all-in-one):**
111
+ ```bash
112
+ bash .claude/scripts/greptile-resolve.sh reply-and-resolve <pr-number> <comment-id> <thread-id> "✅ Fixed: [description]
113
+
114
+ Changed: [what was changed]
115
+ Reason: [why this fixes the issue]
116
+ Commit: [commit-sha]"
117
+ ```
118
+
119
+ ### Step 3: Verify All Threads Resolved
120
+
121
+ ```bash
122
+ bash .claude/scripts/greptile-resolve.sh list <pr-number> --unresolved
123
+ ```
124
+
125
+ **Should show**: "No unresolved comments" or empty list
126
+
127
+ **Confirm with stats:**
128
+ ```bash
129
+ bash .claude/scripts/greptile-resolve.sh stats <pr-number>
130
+ ```
131
+
132
+ **Should show**: "✓ All Greptile threads resolved!"
133
+
134
+ ### Step 4: Push Changes & Wait for Re-review
135
+
136
+ ```bash
137
+ git push
138
+ ```
139
+
140
+ **Greptile will automatically:**
141
+ - Re-analyze the PR
142
+ - Update the confidence score
143
+ - Re-run the Quality Gate check
144
+
145
+ ---
146
+
147
+ ## Example Workflow
148
+
149
+ ```bash
150
+ # 1. List unresolved threads
151
+ $ bash .claude/scripts/greptile-resolve.sh list 24 --unresolved
152
+
153
+ ✗ UNRESOLVED | docs/ROADMAP.md:280
154
+ Thread ID: PRRT_kwDORErEU85tuh6I
155
+ Comment ID: 2787717459
156
+ Issue: Leaking local Windows paths
157
+
158
+ # 2. Fix the issue (edit files, commit changes)
159
+ $ git add docs/ROADMAP.md
160
+ $ git commit -m "fix: replace Windows absolute paths with relative paths"
161
+
162
+ # 3. Reply and resolve in one step
163
+ $ bash .claude/scripts/greptile-resolve.sh reply-and-resolve 24 2787717459 PRRT_kwDORErEU85tuh6I \
164
+ "✅ Fixed: Replaced Windows absolute paths with repo-relative paths
165
+
166
+ Changed: C:\\Users\\...\\plans\\... → .claude/plans/*.md
167
+ Reason: Absolute paths don't exist for other contributors
168
+ Commit: abc123"
169
+
170
+ ✅ Reply posted successfully
171
+ ✅ Thread resolved successfully
172
+
173
+ # 4. Verify all resolved
174
+ $ bash .claude/scripts/greptile-resolve.sh stats 24
175
+
176
+ Greptile unresolved: 0
177
+ ✓ All Greptile threads resolved!
178
+
179
+ # 5. Push changes
180
+ $ git push
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Critical Rules
186
+
187
+ ### ✅ DO:
188
+ - **Reply to EACH comment thread** using the script (not as separate PR comment)
189
+ - **Mark EACH thread as resolved** after fixing using the script
190
+ - **Track progress** (X of Y fixed) in your notes
191
+ - **Wait for Greptile re-review** after pushing fixes
192
+ - **Use comment ID for replies**, thread ID for resolving
193
+ - **Commit fixes BEFORE replying** so you can reference commit SHA
194
+
195
+ ### ❌ DON'T:
196
+ - Post general PR comments about fixes (use threaded replies)
197
+ - Assume threads are auto-resolved (they're not)
198
+ - Skip replying to threads (explain what you fixed)
199
+ - Make multiple commits without resolving threads between them
200
+ - Reply without actually fixing the issue
201
+ - Resolve threads that haven't been fixed yet
202
+
203
+ ---
204
+
205
+ ## Script Commands Reference
206
+
207
+ ### List Threads
208
+ ```bash
209
+ # All threads
210
+ bash .claude/scripts/greptile-resolve.sh list <pr-number>
211
+
212
+ # Only unresolved
213
+ bash .claude/scripts/greptile-resolve.sh list <pr-number> --unresolved
214
+ ```
215
+
216
+ ### Reply to Thread
217
+ ```bash
218
+ bash .claude/scripts/greptile-resolve.sh reply <pr-number> <comment-id> "<message>"
219
+ ```
220
+
221
+ ### Resolve Thread
222
+ ```bash
223
+ bash .claude/scripts/greptile-resolve.sh resolve <pr-number> <thread-id>
224
+ ```
225
+
226
+ ### Reply and Resolve (Recommended)
227
+ ```bash
228
+ bash .claude/scripts/greptile-resolve.sh reply-and-resolve <pr-number> <comment-id> <thread-id> "<message>"
229
+ ```
230
+
231
+ ### Batch Resolve (After all issues fixed)
232
+ ```bash
233
+ bash .claude/scripts/greptile-resolve.sh resolve-all <pr-number>
234
+ ```
235
+ **⚠️ Warning**: Only use after ALL issues are fixed and replied to
236
+
237
+ ### Statistics
238
+ ```bash
239
+ bash .claude/scripts/greptile-resolve.sh stats <pr-number>
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Integration with `/review` Command
245
+
246
+ The `/review` command should now include these steps:
247
+
248
+ 1. Run `/review` as usual to analyze PR feedback
249
+ 2. For Greptile comments, use the script to:
250
+ - List unresolved threads
251
+ - Fix each issue
252
+ - Reply and resolve systematically
253
+ 3. Verify all threads resolved before declaring review complete
254
+ 4. Push changes and wait for Greptile re-review
255
+
256
+ ---
257
+
258
+ ## Troubleshooting
259
+
260
+ ### Script fails with "404 Not Found"
261
+ **Cause**: Comment ID or thread ID is incorrect
262
+ **Solution**: Re-run `list` command to get correct IDs
263
+
264
+ ### Reply appears as separate PR comment
265
+ **Cause**: Using wrong API endpoint
266
+ **Solution**: Script handles this automatically, don't manually comment
267
+
268
+ ### Thread not showing as resolved after script
269
+ **Cause**: GitHub UI caching
270
+ **Solution**: Refresh page, or check with GraphQL query
271
+
272
+ ### Greptile score not updating after fixes
273
+ **Cause**: Must push commits to trigger re-analysis
274
+ **Solution**: `git push` and wait 2-3 minutes for Greptile re-scan
275
+
276
+ ---
277
+
278
+ ## Success Criteria
279
+
280
+ **A review is complete when:**
281
+ - ✅ All Greptile threads are resolved (verified with `stats` command)
282
+ - ✅ All threads have replies explaining fixes
283
+ - ✅ Greptile Quality Gate passes (≥4/5 score)
284
+ - ✅ Branch protection allows merge
285
+ - ✅ No manual tracking needed by maintainers
@@ -0,0 +1,105 @@
1
+ # Forge Workflow Rules
2
+
3
+ 7-stage TDD-first development workflow for any project.
4
+
5
+ ## Workflow Commands
6
+
7
+ | Stage | Command | Purpose |
8
+ |-------|---------|---------|
9
+ | utility | `/status` | Check current stage, active work, recent completions |
10
+ | 1 | `/plan` | Design intent (brainstorm) → research → branch + worktree + task list |
11
+ | 2 | `/dev` | Subagent-driven TDD per task: implementer → spec review → quality review |
12
+ | 3 | `/validate` | Type check, lint, code review, security, tests — all fresh output |
13
+ | 4 | `/ship` | Push and create PR with design doc reference |
14
+ | 5 | `/review` | Handle ALL PR issues (GitHub Actions, Greptile, SonarCloud) |
15
+ | 6 | `/premerge` | Complete docs on feature branch, hand off PR to user |
16
+ | 7 | `/verify` | Post-merge health check (CI on main, close Beads) |
17
+
18
+ ## Core Principles
19
+
20
+ ### Design-First Planning
21
+ - All features start with Phase 1: one-question-at-a-time Q&A to capture design intent
22
+ - Design doc saved to `docs/plans/YYYY-MM-DD-<slug>-design.md`
23
+ - Research (Phase 2) and task list (Phase 3) follow design approval
24
+ - Phase 1 quality directly determines /dev autonomy — resolve ambiguity upfront
25
+
26
+ ### TDD-First Development
27
+ - Task list pre-made in /plan Phase 3; /dev reads and executes it
28
+ - Each task: implementer subagent → spec compliance reviewer → code quality reviewer
29
+ - RED-GREEN-REFACTOR enforced inside implementer via HARD-GATE
30
+ - Decision gate (7-dimension scoring) fires when spec gap found mid-task
31
+
32
+ ### HARD-GATES at Stage Exits
33
+ - Structural enforcement — not soft instructions
34
+ - Every stage exit has explicit conditions that must be met
35
+ - "Should be fine" and "was passing earlier" are never evidence
36
+ - Run the command, show the output, THEN declare done
37
+
38
+ ### Security Built-In
39
+ - OWASP Top 10 analysis documented in design doc (Phase 2)
40
+ - Security test scenarios identified before /dev
41
+ - Automated scans + manual review at /validate
42
+
43
+ ## Issue Tracking
44
+
45
+ Use Beads for persistent tracking across sessions:
46
+ ```bash
47
+ bd create --title="Feature name" --type=feature # Create issue
48
+ bd update <id> --status=in_progress # Claim work
49
+ bd update <id> --comment "Progress" # Add notes
50
+ bd close <id> # Complete
51
+ bd sync # Sync with git
52
+ ```
53
+
54
+ ## Git Workflow
55
+
56
+ ```bash
57
+ # Branch naming
58
+ feat/<feature-slug>
59
+ fix/<bug-slug>
60
+ docs/<doc-slug>
61
+
62
+ # Commit pattern
63
+ git commit -m "test: add validation tests" # RED
64
+ git commit -m "feat: implement validation" # GREEN
65
+ git commit -m "refactor: extract helpers" # REFACTOR
66
+
67
+ # Worktrees (required for /dev)
68
+ git worktree add .worktrees/<slug> feat/<slug>
69
+ # .worktrees/ is gitignored
70
+ ```
71
+
72
+ ## Configuration
73
+
74
+ Customize these commands for your stack:
75
+
76
+ ```bash
77
+ # In your project's CLAUDE.md or .claude/rules/
78
+ TYPE_CHECK_COMMAND="bun run typecheck" # or: npm run typecheck, tsc, etc.
79
+ LINT_COMMAND="bun run lint" # or: npm run lint, eslint, etc.
80
+ TEST_COMMAND="bun test" # or: npm run test, jest, etc.
81
+ SECURITY_SCAN="bunx npm audit" # or: npm audit, snyk test, etc.
82
+ ```
83
+
84
+ ## Skills Integration
85
+
86
+ ### Parallel AI (MANDATORY for Phase 2 web research)
87
+ Use focused skills from `skills/` directory:
88
+ ```bash
89
+ Skill("parallel-deep-research") # Deep analysis, market reports, web research
90
+ ```
91
+
92
+ ### sonarcloud (Code quality)
93
+ ```bash
94
+ /sonarcloud # Query PR-specific issues
95
+ ```
96
+
97
+ ## Flow Visualization
98
+
99
+ ```
100
+ /plan → /dev → /validate → /ship → /review → /premerge → /verify
101
+ ↓ ↓ ↓ ↓ ↓ ↓ ↓
102
+ Design Task-by Validate PR Address Merge Verify
103
+ +Research task +GATE create feedback +docs CI on
104
+ +Tasks TDD GATE master
105
+ ```