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,400 @@
1
+ # Forge Development Workflow
2
+
3
+ Complete 7-stage TDD-first workflow for feature development. Works with any tech stack.
4
+
5
+ ## Overview
6
+
7
+ This workflow integrates:
8
+ - **Test-Driven Development (TDD)**: Tests written UPFRONT
9
+ - **Design-First**: One-question-at-a-time Q&A captures intent before research
10
+ - **Issue Tracking**: Beads for persistent tracking across agents
11
+ - **Security**: OWASP Top 10 analysis for every feature (in /plan Phase 2)
12
+ - **Documentation**: Progressive updates, final verification
13
+
14
+ ## Workflow Stages
15
+
16
+ ```
17
+ ┌─────────┐
18
+ │ /status │ → Check current stage & context (utility, not a numbered stage)
19
+ └─────────┘
20
+
21
+ ┌────▼────┐
22
+ │ /plan │ → Phase 1: Design Q&A → Phase 2: Research → Phase 3: Branch + task list
23
+ └────┬────┘
24
+
25
+ ┌────▼───┐
26
+ │ /dev │ → Subagent TDD per task: implementer → spec review → quality review
27
+ └────┬───┘
28
+
29
+ ┌────▼────┐
30
+ │ /validate │ → Validation (type/lint/tests/security) — HARD-GATE exit
31
+ └────┬────┘
32
+
33
+ ┌────▼────┐
34
+ │ /ship │ → Create PR with full documentation
35
+ └────┬────┘
36
+
37
+ ┌────▼─────┐
38
+ │ /review │ → Address ALL PR issues (GitHub Actions, Greptile, SonarCloud)
39
+ └────┬─────┘
40
+
41
+ ┌────▼─────┐
42
+ │ /premerge│ → Complete docs on feature branch, hand off PR to user
43
+ └────┬─────┘
44
+
45
+ ┌────▼──────┐
46
+ │ /verify │ → Post-merge health check (CI on main, close Beads, clean up worktree + branch)
47
+ └───────────┘
48
+
49
+ ✓ Complete
50
+ ```
51
+
52
+ ## Quick Reference
53
+
54
+ | Stage | Command | Key Actions |
55
+ |-------|---------|-------------|
56
+ | utility | `/status` | Check current context, active Beads issues |
57
+ | 1 | `/plan <slug>` | Design Q&A + research (OWASP) + branch + task list |
58
+ | 2 | `/dev` | Subagent TDD cycles (implementer → spec review → quality review) |
59
+ | 3 | `/validate` | Type/lint/security/tests — HARD-GATE exit |
60
+ | 4 | `/ship` | Create PR with full docs |
61
+ | 5 | `/review <pr>` | Fix ALL PR issues (GitHub Actions, Greptile, SonarCloud) |
62
+ | 6 | `/premerge <pr>` | Complete docs on feature branch, hand off PR |
63
+ | 7 | `/verify` | Post-merge health check (CI on main, close Beads, clean up worktree + branch) |
64
+
65
+ For detailed information on each stage, see the individual command files in `.claude/commands/`.
66
+
67
+ ## TDD Principles
68
+
69
+ ### What is TDD?
70
+
71
+ **Test-Driven Development**: Write tests BEFORE writing implementation code.
72
+
73
+ **Benefits**:
74
+ - Catches bugs early
75
+ - Ensures code is testable
76
+ - Documents expected behavior
77
+ - Improves code design
78
+ - Provides confidence in refactoring
79
+
80
+ ### TDD Cycle
81
+
82
+ ```
83
+ ┌─────────────┐
84
+ │ RED (Test) │ → Write failing test
85
+ └──────┬──────┘
86
+
87
+ ┌──────▼───────┐
88
+ │ GREEN (Code) │ → Write minimal code to pass
89
+ └──────┬───────┘
90
+
91
+ ┌──────▼────────┐
92
+ │ REFACTOR │ → Clean up and optimize
93
+ └───────────────┘
94
+
95
+ └─→ Repeat for next feature
96
+ ```
97
+
98
+ ### Example TDD Flow
99
+
100
+ **Feature**: Add email validation
101
+
102
+ **RED** (Write test first):
103
+ ```typescript
104
+ // test/validation.test.ts
105
+ test('should validate email format', () => {
106
+ expect(validateEmail('test@example.com')).toBe(true)
107
+ expect(validateEmail('invalid')).toBe(false)
108
+ })
109
+ ```
110
+ **Run test**: ❌ Fails (function doesn't exist)
111
+
112
+ **GREEN** (Make it pass):
113
+ ```typescript
114
+ // src/validation.ts
115
+ export function validateEmail(email: string): boolean {
116
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
117
+ }
118
+ ```
119
+ **Run test**: ✅ Passes
120
+
121
+ **REFACTOR** (Optimize):
122
+ ```typescript
123
+ // Extract regex to constant
124
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
125
+
126
+ export function validateEmail(email: string): boolean {
127
+ return EMAIL_REGEX.test(email)
128
+ }
129
+ ```
130
+ **Run test**: ✅ Still passes
131
+
132
+ ---
133
+
134
+ ## Design-First Planning (/plan Phase 2)
135
+
136
+ ### Why Research in /plan?
137
+
138
+ **Evidence-based decisions before writing code**:
139
+ - Understand existing patterns before reinventing
140
+ - Learn from others' mistakes (known issues)
141
+ - Apply industry best practices
142
+ - Make informed security decisions (OWASP Top 10)
143
+ - Document reasoning for future reference in design doc
144
+
145
+ ### Parallel AI Integration
146
+
147
+ **MANDATORY for /plan Phase 2 web research**: Use parallel-deep-research skill
148
+
149
+ **Research Queries**:
150
+ ```
151
+ "[your-framework] [feature] best practices 2026"
152
+ "[feature] implementation patterns"
153
+ "OWASP Top 10 risks for [feature] 2026"
154
+ "[Feature] security vulnerabilities common attacks"
155
+ "Secure [feature] implementation checklist"
156
+ ```
157
+
158
+ **Document in design doc** (`docs/plans/YYYY-MM-DD-<slug>-design.md`):
159
+ - Source URLs
160
+ - Key insights
161
+ - Applicability to project
162
+ - Decision impact
163
+ - Evidence for choices
164
+
165
+ ---
166
+
167
+ ## Security-First Development
168
+
169
+ ### OWASP Top 10 Analysis
170
+
171
+ **MANDATORY for every feature**: Analyze against OWASP Top 10 2021
172
+
173
+ **The List**:
174
+ 1. A01: Broken Access Control
175
+ 2. A02: Cryptographic Failures
176
+ 3. A03: Injection
177
+ 4. A04: Insecure Design
178
+ 5. A05: Security Misconfiguration
179
+ 6. A06: Vulnerable Components
180
+ 7. A07: Identification and Authentication Failures
181
+ 8. A08: Software and Data Integrity Failures
182
+ 9. A09: Security Logging and Monitoring Failures
183
+ 10. A10: Server-Side Request Forgery (SSRF)
184
+
185
+ **For Each Risk**:
186
+ - Risk level: High/Medium/Low
187
+ - Applicability: Yes/No
188
+ - Mitigation strategy
189
+ - Test scenarios
190
+ - Evidence from research
191
+
192
+ **Security Tests** (TDD):
193
+ ```typescript
194
+ // test/security/access-control.test.ts
195
+ test('should prevent unauthorized access to other team data', async () => {
196
+ const user = await createTestUser({ teamId: 'team-1' })
197
+ const response = await api.get('/data?team_id=team-2')
198
+ .set('Authorization', `Bearer ${user.token}`)
199
+
200
+ expect(response.status).toBe(403)
201
+ expect(response.body.data).toBeUndefined()
202
+ })
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Cross-Agent Collaboration
208
+
209
+ ### Beads for Persistence
210
+
211
+ **Why Beads**:
212
+ - Git-backed (survives agent switches)
213
+ - Cross-agent visibility
214
+ - Status tracking
215
+ - Dependency management
216
+
217
+ **Workflow**:
218
+ ```bash
219
+ # Agent 1 (Claude Code)
220
+ bd create "Add notifications"
221
+ bd update bd-x7y2 --status in_progress --comment "API done, UI pending"
222
+ bd sync && git push
223
+
224
+ # Agent 2 (Cursor)
225
+ git pull && bd sync
226
+ bd show bd-x7y2 # See status: "API done, UI pending"
227
+ # Continue UI work
228
+ bd update bd-x7y2 --status done
229
+ bd sync && git push
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Recovery: Rollback
235
+
236
+ If something goes wrong, use rollback to safely revert changes:
237
+
238
+ ```bash
239
+ bunx forge rollback
240
+ ```
241
+
242
+ **Rollback methods**:
243
+
244
+ - **Last commit**: Quick undo of most recent change
245
+ - **Specific commit**: Target any commit by hash
246
+ - **Merged PR**: Revert an entire PR merge
247
+ - **Specific files**: Restore only certain files
248
+ - **Branch range**: Revert multiple commits
249
+ - **Dry run**: Preview changes without executing
250
+
251
+ All USER sections and custom commands are preserved during rollback.
252
+
253
+ See [.claude/commands/rollback.md](../.claude/commands/rollback.md) for complete documentation.
254
+
255
+ ---
256
+
257
+ ## Git Workflow Integration
258
+
259
+ This project uses **Lefthook** for automated quality gates at commit and push time.
260
+
261
+ ### Pre-Commit Checks (Automatic)
262
+
263
+ **TDD Enforcement**:
264
+ - Verifies source files have corresponding test files
265
+ - Interactive prompts: Option to unstage, continue, or abort
266
+ - Supports multiple languages: JS, TS, JSX, TSX, Python, Go, Java, Ruby
267
+
268
+ **Bypass** (emergencies only):
269
+ ```bash
270
+ git commit --no-verify
271
+ ```
272
+
273
+ ### Pre-Push Checks (Automatic)
274
+
275
+ **Three-layer protection**:
276
+
277
+ 1. **Branch Protection**: Blocks direct push to main/master
278
+ ```
279
+ ✅ Feature branches: allowed
280
+ ❌ main/master: blocked
281
+ ```
282
+
283
+ 2. **ESLint Check**: Strict mode (zero errors, zero warnings)
284
+ ```bash
285
+ bunx eslint . # Must pass before push
286
+ ```
287
+
288
+ 3. **Test Suite**: All tests must pass
289
+ ```bash
290
+ bun test # Auto-detects package manager
291
+ ```
292
+
293
+ **Bypass** (emergencies only):
294
+ ```bash
295
+ LEFTHOOK=0 git push
296
+ ```
297
+
298
+ ### Pull Request Workflow
299
+
300
+ **Feature branch naming**:
301
+ ```bash
302
+ feat/feature-name # New feature
303
+ fix/bug-name # Bug fix
304
+ docs/doc-name # Documentation
305
+ refactor/name # Code refactoring
306
+ test/test-name # Test additions
307
+ chore/name # Maintenance
308
+ ```
309
+
310
+ **PR checklist** (auto-filled from template):
311
+ - Summary & detailed changes
312
+ - Type of change (feat/fix/docs/refactor/test/chore)
313
+ - Forge workflow stage (research/dev/validate/verify)
314
+ - Testing plan (manual/e2e/unit)
315
+ - **Self-review checklist** (catches 80% of bugs!)
316
+ - **Beads integration**: `Closes beads-xxx`
317
+ - Screenshots (if UI changes)
318
+ - Merge criteria verification
319
+
320
+ **Merge strategy** (squash-only):
321
+ - GitHub configured for squash merging only
322
+ - One clean commit per PR
323
+ - Linear git history
324
+ - Branches auto-delete after merge
325
+
326
+ ### Git + Beads Workflow
327
+
328
+ **Complete cycle**:
329
+ ```bash
330
+ # 1. Create Beads issue
331
+ bd create "Add feature X" # Returns: beads-abc123
332
+
333
+ # 2. Create feature branch
334
+ git checkout -b feat/feature-x
335
+
336
+ # 3. Develop with TDD
337
+ # (Pre-commit hook checks tests exist)
338
+ git commit -m "test: add feature tests"
339
+ git commit -m "feat: implement feature"
340
+ git commit -m "refactor: optimize logic"
341
+
342
+ # 4. Push to remote
343
+ # (Pre-push checks: branch protection ✅, ESLint ✅, tests ✅)
344
+ git push -u origin feat/feature-x
345
+
346
+ # 5. Create PR with Beads reference
347
+ gh pr create --title "feat: add feature X" --body "Closes beads-abc123"
348
+
349
+ # 6. After merge
350
+ bd close beads-abc123 # Automatic if PR body has "Closes beads-xxx"
351
+ bd sync # Sync to git remote
352
+ git checkout main
353
+ git pull # Get merged changes
354
+ ```
355
+
356
+ ### Emergency Bypasses
357
+
358
+ **When to use**:
359
+ - Production outage
360
+ - Critical security patch
361
+ - Data loss prevention
362
+ - CI/CD system down
363
+
364
+ **How to bypass**:
365
+ ```bash
366
+ # Skip pre-commit (TDD check)
367
+ git commit --no-verify
368
+
369
+ # Skip pre-push (branch protection + ESLint + tests)
370
+ LEFTHOOK=0 git push
371
+ ```
372
+
373
+ **⚠️ IMPORTANT**: Always document bypass reason in PR description!
374
+
375
+ ### Quality Gate Results
376
+
377
+ After implementing this workflow:
378
+
379
+ | Metric | Target | How to Measure |
380
+ |--------|--------|----------------|
381
+ | Bugs in production | <2/month | Issue tracker |
382
+ | ESLint issues shipped | 0 | `bunx eslint .` |
383
+ | Test coverage regressions | 0 | `bun test` |
384
+ | Emergency bypasses | <1/month | Git log |
385
+ | Time to merge | <30 min | GitHub PR metrics |
386
+
387
+ ---
388
+
389
+ ## Tips & Best Practices
390
+
391
+ 1. **Always TDD**: Write tests BEFORE implementation
392
+ 2. **Research in /plan Phase 2**: Use parallel-deep-research before implementing
393
+ 3. **Security first**: OWASP Top 10 analysis mandatory
394
+ 4. **Document decisions**: Evidence and reasoning in research docs
395
+ 5. **Update Beads regularly**: Keep status current for handoffs
396
+ 6. **Commit frequently**: After each TDD cycle
397
+ 7. **Address ALL PR feedback**: GitHub Actions, Greptile, SonarCloud
398
+ 8. **Update docs progressively**: Don't wait until the end
399
+ 9. **Verify at the end**: Final documentation check catches gaps
400
+ 10. **Sync often**: `bd sync` at end of every session