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,482 @@
1
+ # Forge Workflow Examples
2
+
3
+ Real-world examples showing how to use Forge for different scenarios.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ - [Example 1: Simple Feature](#example-1-simple-feature)
10
+ - [Example 2: Bug Fix with Security](#example-2-bug-fix-with-security)
11
+ - [Example 3: Multi-File Refactor](#example-3-multi-file-refactor)
12
+ - [Example 4: Team Collaboration](#example-4-team-collaboration)
13
+
14
+ ---
15
+
16
+ ## Example 1: Simple Feature
17
+
18
+ **Task**: Add a health check endpoint
19
+
20
+ **Estimated Time**: 15 minutes
21
+
22
+ **Workflow**: Tactical
23
+
24
+ ### Step-by-Step
25
+
26
+ ```bash
27
+ # ═══════════════════════════════════════════════════════════
28
+ # STAGE 1: STATUS - Where are we?
29
+ # ═══════════════════════════════════════════════════════════
30
+ /status
31
+
32
+ # Output:
33
+ # ✓ Branch: main
34
+ # ✓ Clean working directory
35
+ # ✓ No active work
36
+
37
+ # ═══════════════════════════════════════════════════════════
38
+ # STAGE 2: PLAN (includes design + research in Phase 2)
39
+ # ═══════════════════════════════════════════════════════════
40
+ /plan health-check-endpoint
41
+
42
+ # Creates:
43
+ # - Branch: feat/health-check-endpoint
44
+ # - Beads issue: PROJ-42
45
+
46
+ # ═══════════════════════════════════════════════════════════
47
+ # STAGE 4: DEV (TDD)
48
+ # ═══════════════════════════════════════════════════════════
49
+ /dev
50
+
51
+ # RED: Write failing test
52
+ # File: tests/health.test.js
53
+ describe('GET /health', () => {
54
+ it('returns 200 OK with status', async () => {
55
+ const response = await request(app).get('/health');
56
+ expect(response.status).toBe(200);
57
+ expect(response.body).toEqual({ status: 'ok' });
58
+ });
59
+ });
60
+ # Run → ❌ Fails
61
+
62
+ # GREEN: Minimal code
63
+ # File: routes/health.js
64
+ router.get('/health', (req, res) => {
65
+ res.status(200).json({ status: 'ok' });
66
+ });
67
+ # Run → ✅ Passes
68
+
69
+ # REFACTOR: (none needed)
70
+ git commit -m "feat: add health check endpoint"
71
+
72
+ # ═══════════════════════════════════════════════════════════
73
+ # STAGE 5: CHECK
74
+ # ═══════════════════════════════════════════════════════════
75
+ /validate
76
+
77
+ # ✓ Type check passed
78
+ # ✓ Linter passed
79
+ # ✓ Tests passed (1 test)
80
+ # ✓ Security scan passed
81
+
82
+ # ═══════════════════════════════════════════════════════════
83
+ # STAGE 6: SHIP
84
+ # ═══════════════════════════════════════════════════════════
85
+ /ship
86
+
87
+ # Created PR #42
88
+ # URL: https://github.com/you/project/pull/42
89
+ ```
90
+
91
+ **Result**: Feature shipped in 15 minutes with tests and documentation.
92
+
93
+ ---
94
+
95
+ ## Example 2: Bug Fix with Security
96
+
97
+ **Task**: Fix SQL injection vulnerability in search endpoint
98
+
99
+ **Estimated Time**: 30 minutes
100
+
101
+ **Severity**: High (security vulnerability)
102
+
103
+ ### Step-by-Step
104
+
105
+ ```bash
106
+ # ═══════════════════════════════════════════════════════════
107
+ # STAGE 1: STATUS
108
+ # ═══════════════════════════════════════════════════════════
109
+ /status
110
+
111
+ # If Beads installed:
112
+ bd create "SQL injection in search endpoint" \
113
+ --type bug \
114
+ --priority 0 \
115
+ --label "security,critical"
116
+
117
+ # ═══════════════════════════════════════════════════════════
118
+ # STAGE 2: PLAN (includes research in Phase 2)
119
+ # ═══════════════════════════════════════════════════════════
120
+ /plan sql-injection-fix-search
121
+
122
+ # Branch: fix/sql-injection-search
123
+ # Updates issue: PROJ-123
124
+
125
+ # ═══════════════════════════════════════════════════════════
126
+ # STAGE 4: DEV (TDD for security)
127
+ # ═══════════════════════════════════════════════════════════
128
+ /dev
129
+
130
+ # RED: Write test for SQL injection attempt
131
+ describe('POST /search security', () => {
132
+ it('prevents SQL injection via search param', async () => {
133
+ const maliciousInput = "'; DROP TABLE users--";
134
+ const response = await request(app)
135
+ .post('/search')
136
+ .send({ query: maliciousInput });
137
+
138
+ expect(response.status).toBe(200);
139
+ // Verify database still intact
140
+ const users = await db.query('SELECT COUNT(*) FROM users');
141
+ expect(users.rows[0].count).toBeGreaterThan(0);
142
+ });
143
+ });
144
+ # Run → ❌ Fails (database affected)
145
+
146
+ # GREEN: Fix with parameterized query
147
+ // Before (vulnerable):
148
+ const results = await db.query(
149
+ `SELECT * FROM products WHERE name LIKE '%${req.body.query}%'`
150
+ );
151
+
152
+ // After (safe):
153
+ const results = await db.query(
154
+ 'SELECT * FROM products WHERE name LIKE $1',
155
+ [`%${req.body.query}%`]
156
+ );
157
+ # Run → ✅ Passes
158
+
159
+ # REFACTOR: Add input validation
160
+ const { query } = req.body;
161
+ if (!query || typeof query !== 'string') {
162
+ return res.status(400).json({ error: 'Invalid query' });
163
+ }
164
+ if (query.length > 100) {
165
+ return res.status(400).json({ error: 'Query too long' });
166
+ }
167
+
168
+ git commit -m "fix: prevent SQL injection in search endpoint
169
+
170
+ - Use parameterized queries
171
+ - Add input validation
172
+ - Add security test
173
+
174
+ OWASP A03:2021 Injection"
175
+
176
+ # ═══════════════════════════════════════════════════════════
177
+ # STAGE 5: CHECK
178
+ # ═══════════════════════════════════════════════════════════
179
+ /validate
180
+
181
+ # ✓ Type check passed
182
+ # ✓ Linter passed
183
+ # ✓ Tests passed (including security test)
184
+ # ✓ Security scan: SQL injection vulnerability FIXED
185
+
186
+ # ═══════════════════════════════════════════════════════════
187
+ # STAGE 6: SHIP
188
+ # ═══════════════════════════════════════════════════════════
189
+ /ship
190
+
191
+ # PR description includes:
192
+ # ## Security Fix
193
+ # - Fixed SQL injection in search endpoint
194
+ # - OWASP A03:2021 Injection
195
+ # - Severity: High
196
+ #
197
+ # ## Changes
198
+ # - Parameterized queries
199
+ # - Input validation (type + length)
200
+ # - Security test added
201
+ #
202
+ # ## Verification
203
+ # - ✓ Manual sqlmap testing
204
+ # - ✓ Automated security scan passed
205
+ ```
206
+
207
+ **Result**: Security vulnerability fixed with tests in 30 minutes.
208
+
209
+ ---
210
+
211
+ ## Example 3: Multi-File Refactor
212
+
213
+ **Task**: Extract authentication logic to separate service
214
+
215
+ **Estimated Time**: 2-3 hours
216
+
217
+ **Files Affected**: 5-6 files
218
+
219
+ ### Step-by-Step
220
+
221
+ ```bash
222
+ # ═══════════════════════════════════════════════════════════
223
+ # STAGE 1: STATUS
224
+ # ═══════════════════════════════════════════════════════════
225
+ /status
226
+
227
+ bd create "Extract auth logic to service" \
228
+ --type chore \
229
+ --priority 2
230
+
231
+ # ═══════════════════════════════════════════════════════════
232
+ # STAGE 2: PLAN (includes research in Phase 2)
233
+ # ═══════════════════════════════════════════════════════════
234
+ /plan auth-service-extraction
235
+
236
+ # Branch: refactor/auth-service
237
+ # Issue: PROJ-85
238
+
239
+ # Plan includes:
240
+ # 1. Create AuthService class
241
+ # 2. Extract login logic
242
+ # 3. Extract signup logic
243
+ # 4. Extract token validation
244
+ # 5. Update all references
245
+ # 6. Add service tests
246
+
247
+ # ═══════════════════════════════════════════════════════════
248
+ # STAGE 4: DEV (TDD for each method)
249
+ # ═══════════════════════════════════════════════════════════
250
+ /dev
251
+
252
+ # RED: Test for AuthService.login()
253
+ describe('AuthService', () => {
254
+ describe('login', () => {
255
+ it('returns JWT for valid credentials', async () => {
256
+ const result = await authService.login('user@test.com', 'password123');
257
+ expect(result.token).toBeDefined();
258
+ expect(jwt.verify(result.token, SECRET)).toBeTruthy();
259
+ });
260
+ });
261
+ });
262
+ # Run → ❌ Fails (AuthService doesn't exist)
263
+
264
+ # GREEN: Create AuthService
265
+ class AuthService {
266
+ async login(email, password) {
267
+ const user = await db.findUserByEmail(email);
268
+ if (!user || !(await bcrypt.compare(password, user.password))) {
269
+ throw new Error('Invalid credentials');
270
+ }
271
+ return {
272
+ token: jwt.sign({ userId: user.id }, SECRET, { expiresIn: '24h' })
273
+ };
274
+ }
275
+ }
276
+ # Run → ✅ Passes
277
+
278
+ # REFACTOR: Update routes to use service
279
+ // Before:
280
+ app.post('/login', async (req, res) => {
281
+ const user = await db.findUserByEmail(req.body.email);
282
+ // ... inline JWT logic
283
+ });
284
+
285
+ // After:
286
+ app.post('/login', async (req, res) => {
287
+ const result = await authService.login(req.body.email, req.body.password);
288
+ res.json(result);
289
+ });
290
+
291
+ git commit -m "refactor: extract login to AuthService"
292
+
293
+ # Repeat for signup, token validation, etc.
294
+ # 5-6 commits total
295
+
296
+ # ═══════════════════════════════════════════════════════════
297
+ # STAGE 5: CHECK
298
+ # ═══════════════════════════════════════════════════════════
299
+ /validate
300
+
301
+ # ✓ Type check passed
302
+ # ✓ Linter passed
303
+ # ✓ Tests passed (15 new service tests + existing route tests)
304
+ # ✓ Security scan passed
305
+
306
+ # ═══════════════════════════════════════════════════════════
307
+ # STAGE 6: SHIP
308
+ # ═══════════════════════════════════════════════════════════
309
+ /ship
310
+
311
+ # PR #85
312
+ # - Created AuthService class
313
+ # - Extracted 3 route handlers
314
+ # - 15 service tests
315
+ # - All existing tests still pass
316
+ ```
317
+
318
+ **Result**: Clean refactor with full test coverage in 2-3 hours.
319
+
320
+ ---
321
+
322
+ ## Example 4: Team Collaboration
323
+
324
+ **Task**: Multiple developers working on same project with Beads
325
+
326
+ ### Scenario
327
+
328
+ Team of 3 developers:
329
+ - **Alice**: Working on payment integration
330
+ - **Bob**: Working on email notifications
331
+ - **Charlie**: Working on admin dashboard
332
+
333
+ ### Workflow
334
+
335
+ ```bash
336
+ # ═══════════════════════════════════════════════════════════
337
+ # PROJECT SETUP (Once per project)
338
+ # ═══════════════════════════════════════════════════════════
339
+ bd init --prefix SHOP
340
+ bd sync # Commit .beads/ to git
341
+
342
+ # ═══════════════════════════════════════════════════════════
343
+ # ALICE: Payment Integration
344
+ # ═══════════════════════════════════════════════════════════
345
+
346
+ # Morning: Check what's available
347
+ bd ready
348
+ # Output:
349
+ # SHOP-1: Payment integration (ready)
350
+ # SHOP-3: Admin dashboard (ready)
351
+
352
+ # Claim work
353
+ bd update SHOP-1 --status in_progress
354
+ /status
355
+ /plan stripe-payment-integration
356
+ /dev
357
+
358
+ # Midday: Progress update
359
+ bd comments SHOP-1 "Stripe SDK integrated, working on webhooks"
360
+
361
+ # Afternoon: Blocked on API keys
362
+ bd update SHOP-1 --status blocked --comment "Need production Stripe API keys"
363
+
364
+ # Create dependency
365
+ bd create "Get Stripe API keys from DevOps" --type chore --priority 1
366
+ bd dep add SHOP-1 SHOP-5 # SHOP-1 depends on SHOP-5
367
+
368
+ bd sync # Push to git
369
+
370
+ # ═══════════════════════════════════════════════════════════
371
+ # BOB: Email Notifications (Same Time)
372
+ # ═══════════════════════════════════════════════════════════
373
+
374
+ # Morning: Pull latest, check work
375
+ git pull
376
+ bd sync # Sync with Alice's updates
377
+
378
+ bd ready
379
+ # Output:
380
+ # SHOP-3: Admin dashboard (ready)
381
+ # SHOP-2: Email notifications (ready)
382
+
383
+ # Claim different feature
384
+ bd update SHOP-2 --status in_progress
385
+ /plan email-notifications
386
+ /dev
387
+
388
+ # No conflicts with Alice (different files)
389
+
390
+ # End of day: Complete
391
+ bd close SHOP-2 --reason "Implemented with SendGrid"
392
+ /ship
393
+ bd sync
394
+
395
+ # ═══════════════════════════════════════════════════════════
396
+ # CHARLIE: Admin Dashboard (Next Day)
397
+ # ═══════════════════════════════════════════════════════════
398
+
399
+ # Morning: Check dependencies
400
+ git pull
401
+ bd sync
402
+
403
+ bd show SHOP-3
404
+ # Output:
405
+ # Status: ready
406
+ # Depends on: (none)
407
+
408
+ bd update SHOP-3 --status in_progress
409
+
410
+ # Discovers overlap with Bob's work
411
+ bd comments SHOP-3 "Need Bob's email service for user notifications"
412
+ bd dep add SHOP-3 SHOP-2 # SHOP-3 depends on SHOP-2
413
+
414
+ # Bob's work already merged, so can proceed
415
+ /plan admin-dashboard
416
+ /dev
417
+
418
+ # ═══════════════════════════════════════════════════════════
419
+ # COLLABORATION PATTERNS
420
+ # ═══════════════════════════════════════════════════════════
421
+
422
+ # Check what teammates are working on:
423
+ bd list --status in_progress
424
+
425
+ # Check blocked work:
426
+ bd blocked
427
+ # Output:
428
+ # SHOP-1: Payment integration (blocked by SHOP-5)
429
+
430
+ # Find work with no blockers:
431
+ bd ready
432
+
433
+ # See full project status:
434
+ bd stats
435
+ # Output:
436
+ # Total issues: 12
437
+ # Open: 8
438
+ # In Progress: 3 (Alice, Bob, Charlie)
439
+ # Blocked: 1 (SHOP-1)
440
+ # Done: 4
441
+
442
+ # Always sync at end of session:
443
+ bd sync
444
+ ```
445
+
446
+ **Result**: Team can work in parallel, track dependencies, and avoid conflicts.
447
+
448
+ ---
449
+
450
+ ## Key Takeaways
451
+
452
+ ### 1. Simple Features (15-30 min)
453
+ - `/plan` includes design intent + research (Phase 2)
454
+ - TDD keeps scope focused
455
+
456
+ ### 2. Bug Fixes with Security (30-60 min)
457
+ - OWASP research happens in `/plan` Phase 2
458
+ - Security tests are mandatory
459
+ - Priority 0 for critical vulnerabilities
460
+
461
+ ### 3. Multi-File Refactors (2-4 hours)
462
+ - TDD for each extracted method
463
+ - Commit after each GREEN cycle
464
+ - All existing tests must pass
465
+
466
+ ### 4. Team Collaboration
467
+ - Beads tracks dependencies
468
+ - `bd ready` finds available work
469
+ - `bd sync` at end of every session
470
+ - Comments keep teammates informed
471
+
472
+ ---
473
+
474
+ ## Next Steps
475
+
476
+ 📚 **New to Forge?** → [QUICKSTART.md](../QUICKSTART.md)
477
+
478
+ 📖 **Learn workflow** → [WORKFLOW.md](WORKFLOW.md)
479
+
480
+ 🛠️ **Setup tools** → [SETUP.md](SETUP.md)
481
+
482
+ 💬 **Questions?** → [GitHub Discussions](https://github.com/harshanandak/forge/discussions)