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
package/README.md ADDED
@@ -0,0 +1,414 @@
1
+ # Forge
2
+
3
+ [![npm version](https://img.shields.io/npm/v/forge-workflow.svg)](https://www.npmjs.com/package/forge-workflow)
4
+ [![npm downloads](https://img.shields.io/npm/dw/forge-workflow.svg)](https://www.npmjs.com/package/forge-workflow)
5
+ [![license](https://img.shields.io/npm/l/forge-workflow.svg)](https://github.com/harshanandak/forge/blob/master/LICENSE)
6
+ [![Tests](https://github.com/harshanandak/forge/actions/workflows/test.yml/badge.svg)](https://github.com/harshanandak/forge/actions/workflows/test.yml)
7
+ [![ESLint](https://github.com/harshanandak/forge/actions/workflows/eslint.yml/badge.svg)](https://github.com/harshanandak/forge/actions/workflows/eslint.yml)
8
+ [![Greptile Quality Gate](https://github.com/harshanandak/forge/actions/workflows/greptile-quality-gate.yml/badge.svg)](https://github.com/harshanandak/forge/actions/workflows/greptile-quality-gate.yml)
9
+ [![Package Size](https://github.com/harshanandak/forge/actions/workflows/size-check.yml/badge.svg)](https://github.com/harshanandak/forge/actions/workflows/size-check.yml)
10
+ [![Coverage](https://img.shields.io/badge/coverage-80%25-brightgreen.svg)](https://github.com/harshanandak/forge)
11
+ [![CodeQL](https://github.com/harshanandak/forge/actions/workflows/codeql.yml/badge.svg)](https://github.com/harshanandak/forge/actions/workflows/codeql.yml)
12
+ [![Security Policy](https://img.shields.io/badge/security-policy-blue.svg)](https://github.com/harshanandak/forge/blob/master/SECURITY.md)
13
+
14
+ Ship features with confidence using a 7-stage TDD-first workflow for AI coding agents.
15
+
16
+ ```
17
+ /plan → /dev → /validate → /ship → /review → /premerge → /verify
18
+ ```
19
+
20
+ ✅ **TDD-First**: Write tests before code
21
+ ✅ **Design-First**: One-question-at-a-time Q&A captures intent upfront
22
+ ✅ **Multi-Agent**: Universal AGENTS.md works with 8 agents
23
+
24
+ ---
25
+
26
+ ## Quick Example
27
+
28
+ **Adding a login button with Forge:**
29
+
30
+ ```bash
31
+ /plan login-button # Design Q&A → research → branch + task list
32
+ /dev # TDD: RED → GREEN → REFACTOR cycles
33
+ /validate # Type check + lint + tests + security scan
34
+ /ship # Create PR with full documentation
35
+ ```
36
+
37
+ **Result**: Feature shipped with tests, security validated, fully documented.
38
+
39
+ **Without Forge** (chaotic):
40
+ - Code first, tests later (or never)
41
+ - No research or planning
42
+ - Security issues found in production
43
+ - Documentation forgotten
44
+
45
+ **With Forge** (systematic):
46
+ - Tests written BEFORE code (TDD)
47
+ - Research-backed decisions
48
+ - OWASP Top 10 analysis built-in
49
+ - Documentation at every stage
50
+
51
+ → [See complete walkthrough in QUICKSTART.md](QUICKSTART.md)
52
+
53
+ ---
54
+
55
+ ## Installation
56
+
57
+ ```bash
58
+ # Step 1: Install the package
59
+ bun install forge-workflow
60
+
61
+ # Step 2: Setup for your AI agent
62
+ bunx forge setup
63
+ ```
64
+
65
+ **That's it!** Forge will:
66
+ - Create AGENTS.md (universal instructions)
67
+ - Setup agent-specific files (Claude, Cursor, etc.)
68
+ - Create docs/ folder with guides
69
+
70
+ **Prerequisites**: Node.js, Git, GitHub account
71
+ **Optional tools**: Beads (issue tracking)
72
+
73
+ → [Detailed setup guide for all agents](docs/SETUP.md)
74
+
75
+ ---
76
+
77
+ ## The 7 Stages
78
+
79
+ | Stage | Command | Purpose |
80
+ |-------|---------|---------|
81
+ | **utility** | `/status` | Check current context, active work |
82
+ | **1. Plan** | `/plan` | Design Q&A → research → branch + task list |
83
+ | **2. Dev** | `/dev` | Subagent TDD per task (spec + quality review) |
84
+ | **3. Validate** | `/validate` | Validate: types, lint, tests, security |
85
+ | **4. Ship** | `/ship` | Create PR with documentation |
86
+ | **5. Review** | `/review` | Address ALL PR feedback (Greptile, reviewers, CI/CD) |
87
+ | **6. Premerge** | `/premerge` | Complete docs on feature branch, hand off PR |
88
+ | **7. Verify** | `/verify` | Post-merge health check (CI on main) |
89
+
90
+ **Full workflow guide**: [docs/WORKFLOW.md](docs/WORKFLOW.md)
91
+
92
+ ---
93
+
94
+ ## Supported AI Agents
95
+
96
+ Works with **7 AI coding agents** via universal AGENTS.md:
97
+
98
+ ### Tier 1 (Primary Support)
99
+
100
+ | Agent | Features | Setup Time |
101
+ |-------|----------|------------|
102
+ | **Claude Code** | Custom slash commands, .claude/ directory | 30 seconds |
103
+ | **GitHub Copilot** | Enterprise support, .github/copilot-instructions.md | 30 seconds |
104
+ | **Kilo Code** | Auto failure recovery, .kilo.md | 30 seconds |
105
+ | **Cursor** | Native modes (Plan/Ask/Debug), .cursor/rules/ | 30 seconds |
106
+ | **Codex CLI** | OpenAI terminal agent, AGENTS.md | 30 seconds |
107
+
108
+ ### Tier 2 (Optional Support)
109
+
110
+ | Agent | Features | Setup Time |
111
+ |-------|----------|------------|
112
+ | **OpenCode** | Flexible, opencode.json | 30 seconds |
113
+ | **Goose** | Model flexibility, open-source | 30 seconds |
114
+
115
+ **Quick setup** (auto-detects agents):
116
+ ```bash
117
+ bunx forge setup
118
+ ```
119
+
120
+ **Setup for specific agent**:
121
+ ```bash
122
+ bunx forge setup --agent=copilot # GitHub Copilot
123
+ bunx forge setup --agent=cursor # Cursor IDE
124
+ bunx forge setup --agent=kilo # Kilo Code
125
+ bunx forge setup --agent=codex # Codex CLI
126
+ ```
127
+
128
+ **Setup for all Tier 1 agents**:
129
+ ```bash
130
+ bunx forge setup --all
131
+ ```
132
+
133
+ → [Agent-specific setup instructions](docs/SETUP.md)
134
+
135
+ ---
136
+
137
+ ## What Makes Forge Different
138
+
139
+ ### 1. TDD-First Development
140
+ Tests are written **BEFORE** code, every single time:
141
+ - **RED**: Write a failing test
142
+ - **GREEN**: Write minimal code to pass
143
+ - **REFACTOR**: Clean up and commit
144
+ - **REPEAT**: Next feature
145
+
146
+ No feature ships without tests. Period.
147
+
148
+ ### 2. Research-First Planning
149
+ AI researches best practices before you write a line of code:
150
+ - Web search for latest patterns
151
+ - OWASP Top 10 security analysis
152
+ - Codebase pattern analysis
153
+ - Decisions documented with evidence
154
+
155
+ Saves hours of debugging and refactoring later.
156
+
157
+ ### 3. Universal Compatibility
158
+ One workflow, works with ALL major AI agents:
159
+ - Single `AGENTS.md` file (universal standard)
160
+ - Agent-specific enhancements (slash commands, skills)
161
+ - Git-backed persistence (Beads)
162
+ - No vendor lock-in
163
+
164
+ Switch agents anytime without changing your workflow.
165
+
166
+ ### 4. Built-in TDD Enforcement (v1.5.0)
167
+ Git hooks automatically enforce TDD practices:
168
+ - **Pre-commit**: Blocks source commits without tests
169
+ - **Pre-push**: Runs full test suite before push
170
+ - **Interactive**: Guided recovery when violations occur
171
+ - **CI/CD aware**: Auto-aborts in non-interactive environments
172
+
173
+ ```bash
174
+ # Validation CLI
175
+ forge-validate status # Check project prerequisites
176
+ forge-validate dev # Validate before /dev stage
177
+ forge-validate ship # Validate before /ship stage
178
+ ```
179
+
180
+ ### 5. Smart Tool Recommendations (v1.7.0)
181
+ Intelligent plugin catalog with 30+ curated tools:
182
+ - **Auto-detection**: Scans your project for frameworks, databases, auth, payments, and more
183
+ - **Budget modes**: free, open-source, startup, professional, custom
184
+ - **CLI-first**: Prefers CLI tools over MCPs for portability
185
+ - **Free alternatives**: Every paid tool shows free alternatives
186
+
187
+ ```bash
188
+ bunx forge recommend # Recommendations for your project
189
+ bunx forge recommend --budget free # Only free tools
190
+ ```
191
+
192
+ → [Validation docs](docs/VALIDATION.md) | [Plugin docs](lib/agents/README.md)
193
+
194
+ ### 6. Enhanced Onboarding (v1.6.0) 🆕
195
+ Smart setup that adapts to your project:
196
+
197
+ **Intelligent File Merging**
198
+ - Preserves your existing AGENTS.md content
199
+ - Adds Forge workflow without overwriting
200
+ - Three options: smart merge, keep, or replace
201
+ ```bash
202
+ bunx forge setup --merge=smart # Intelligent merge
203
+ ```
204
+
205
+ **Auto-Detection**
206
+ - Detects framework (Next.js, React, Vue, Express)
207
+ - Detects language (TypeScript, JavaScript)
208
+ - Analyzes git stats and CI/CD setup
209
+ - Infers project stage (new, active, stable)
210
+ - Saves to `.forge/context.json`
211
+
212
+ **Workflow Profiles**
213
+ - Adapts workflow based on work type:
214
+ - `feature`: Full 7-stage workflow (auto-escalates to critical for auth/payment)
215
+ - `fix`: Streamlined 5-stage workflow (auto-escalates to hotfix for production)
216
+ - `refactor`: Behavior-preserving 5-stage workflow
217
+ - `chore`: Minimal 3-stage workflow (docs/deps/config)
218
+ ```bash
219
+ bunx forge setup --type=critical # Set workflow manually
220
+ ```
221
+
222
+ **Context Interview** (optional)
223
+ ```bash
224
+ bunx forge setup --interview # Gather project context
225
+ ```
226
+
227
+ → [Enhanced onboarding guide](docs/ENHANCED_ONBOARDING.md)
228
+
229
+ ### 7. Automated Quality Gates 🆕
230
+ Multi-layer quality enforcement before merge:
231
+
232
+ **Greptile AI Code Review**
233
+ - AI-powered review on every PR
234
+ - Catches bugs, security issues, performance problems
235
+ - Detailed inline feedback with fix suggestions
236
+ - Automatic re-review after changes
237
+ ```bash
238
+ # Branch protection requires Greptile review to pass
239
+ # Typically completes in 1-2 minutes
240
+ ```
241
+
242
+ **GitHub Actions Workflows**
243
+ - Greptile Quality Gate: Enforces minimum score (≥4/5)
244
+ - ESLint checks: Code quality validation
245
+ - Test suite: All tests must pass
246
+
247
+ **Git Hooks (Lefthook)**
248
+ - Pre-commit: TDD enforcement (tests required)
249
+ - Pre-push: Full test suite + lint checks
250
+ - Branch protection: Blocks direct push to main/master
251
+
252
+ → [Greptile setup guide](docs/GREPTILE_SETUP.md)
253
+
254
+ ---
255
+
256
+ ## The Toolchain
257
+
258
+ Forge integrates with powerful tools:
259
+
260
+ ```
261
+ ┌──────────────────────────────────────────────┐
262
+ │ FORGE TOOLCHAIN │
263
+ ├──────────────────────────────────────────────┤
264
+ │ │
265
+ │ ┌──────────┐ ┌──────────┐ │
266
+ │ │ BEADS │ │ GITHUB │ │
267
+ │ │ Issue │ │ PR │ │
268
+ │ │ Tracking │ │ Workflow │ │
269
+ │ └──────────┘ └──────────┘ │
270
+ │ │ │ │
271
+ │ └──────────────────────────────┘ │
272
+ │ │ │
273
+ │ ┌─────▼─────┐ │
274
+ │ │ FORGE │ │
275
+ │ │ 7-Stage │ │
276
+ │ │ Workflow │ │
277
+ │ └───────────┘ │
278
+ │ │
279
+ └──────────────────────────────────────────────┘
280
+ ```
281
+
282
+ **All tools are optional** - Forge works standalone.
283
+
284
+ **Beads** (optional): Git-backed issue tracking that survives context clearing
285
+ ```bash
286
+ bun add -g @beads/bd && bd init
287
+ ```
288
+
289
+ **GitHub CLI** (recommended): Required for PR workflow
290
+ ```bash
291
+ gh auth login
292
+ ```
293
+
294
+ → [Complete toolchain guide](docs/TOOLCHAIN.md)
295
+
296
+ ---
297
+
298
+ ## Real-World Examples
299
+
300
+ ### Example 1: Simple Feature (20 minutes)
301
+ **Task**: Add a health check endpoint
302
+
303
+ ```bash
304
+ /plan health-check-endpoint # Design Q&A → research → branch + task list
305
+ /dev # 8 min: TDD implementation
306
+ /validate # 2 min: All validations pass
307
+ /ship # 2 min: PR created
308
+ # → Greptile AI review completes (~2 min)
309
+ /review # 3 min: Address Greptile feedback
310
+ /premerge # 2 min: Complete docs, hand off PR
311
+ ```
312
+
313
+ ### Example 2: Bug Fix with Security (30 minutes)
314
+ **Task**: Fix SQL injection vulnerability
315
+
316
+ ```bash
317
+ /plan sql-injection-fix # Design Q&A → OWASP research → branch
318
+ /dev # 8 min: Fix + tests
319
+ /validate # 3 min: Security scan
320
+ /ship # 2 min: PR with security notes
321
+ # → Greptile validates security fix (~2 min)
322
+ /review # 5 min: Address security feedback
323
+ /premerge # 3 min: Complete docs, hand off PR
324
+ ```
325
+
326
+ ### Example 3: Architecture Change (2-3 days)
327
+ **Task**: Add authentication system
328
+
329
+ ```bash
330
+ /plan user-authentication # Design Q&A → deep research → branch
331
+ /dev # 1-2 days: TDD implementation
332
+ /validate # 30 min: Full validation
333
+ /ship # 15 min: PR with docs
334
+ /review # Varies: Address feedback
335
+ /premerge # 15 min: Complete docs, hand off PR
336
+ /verify # 15 min: Post-merge health check
337
+ ```
338
+
339
+ → [More examples in docs/EXAMPLES.md](docs/EXAMPLES.md)
340
+
341
+ ---
342
+
343
+ ## Core Principles
344
+
345
+ **TDD-First**: Tests before code, always
346
+ **Design-First**: One-question-at-a-time Q&A captures intent before research
347
+ **Security Built-In**: OWASP Top 10 for every feature
348
+ **Documentation Progressive**: Update at each stage
349
+ **Multi-Session**: Work persists across sessions
350
+
351
+ → [Read the philosophy in docs/WORKFLOW.md](docs/WORKFLOW.md)
352
+
353
+ ---
354
+
355
+ ## Next Steps
356
+
357
+ 📚 **New to Forge?**
358
+ → [QUICKSTART.md](QUICKSTART.md) - Your first feature in 5 minutes
359
+
360
+ 📖 **Learn the workflow**
361
+ → [docs/WORKFLOW.md](docs/WORKFLOW.md) - Complete guide with examples
362
+
363
+ 🛠️ **Setup the toolchain**
364
+ → [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md) - Beads, GitHub CLI
365
+
366
+ 🎯 **See real examples**
367
+ → [docs/EXAMPLES.md](docs/EXAMPLES.md) - Real-world use cases
368
+
369
+ 💬 **Have questions?**
370
+ → [GitHub Discussions](https://github.com/harshanandak/forge/discussions)
371
+
372
+ 🐛 **Found a bug?**
373
+ → [GitHub Issues](https://github.com/harshanandak/forge/issues)
374
+
375
+ ---
376
+
377
+ ## Quick Reference
378
+
379
+ ```bash
380
+ # Forge commands
381
+ /status # Check current context
382
+ /plan <feature> # Design Q&A → research → branch + task list
383
+ /dev # TDD development
384
+ /validate # Validate everything
385
+ /ship # Create PR
386
+ /review <pr> # Address feedback
387
+ /premerge <pr> # Complete docs, hand off PR
388
+ /verify # Post-merge health check
389
+
390
+ # Beads commands (optional)
391
+ bd init # Initialize tracking
392
+ bd ready # Find ready work
393
+ bd create "title" # Create issue
394
+ bd update <id> --status X # Update status
395
+ bd sync # Sync with git
396
+ ```
397
+
398
+ ---
399
+
400
+ ## License
401
+
402
+ MIT © Harsha Nandak
403
+
404
+ ---
405
+
406
+ **Ready to start?**
407
+
408
+ ```bash
409
+ bun install forge-workflow
410
+ bunx forge setup
411
+ /status
412
+ ```
413
+
414
+ Then open [QUICKSTART.md](QUICKSTART.md) and ship your first feature! 🚀