forge-cc 0.1.41 → 1.0.0
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.
- package/README.md +454 -338
- package/dist/cli.js +194 -935
- package/dist/cli.js.map +1 -1
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.js +49 -56
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +37 -125
- package/dist/config/schema.js +13 -28
- package/dist/config/schema.js.map +1 -1
- package/dist/doctor.d.ts +10 -0
- package/dist/doctor.js +148 -0
- package/dist/doctor.js.map +1 -0
- package/dist/gates/index.d.ts +14 -12
- package/dist/gates/index.js +53 -105
- package/dist/gates/index.js.map +1 -1
- package/dist/gates/lint-gate.d.ts +2 -2
- package/dist/gates/lint-gate.js +60 -66
- package/dist/gates/lint-gate.js.map +1 -1
- package/dist/gates/tests-gate.d.ts +2 -4
- package/dist/gates/tests-gate.js +75 -203
- package/dist/gates/tests-gate.js.map +1 -1
- package/dist/gates/types-gate.d.ts +2 -2
- package/dist/gates/types-gate.js +53 -59
- package/dist/gates/types-gate.js.map +1 -1
- package/dist/linear/client.d.ts +31 -108
- package/dist/linear/client.js +88 -388
- package/dist/linear/client.js.map +1 -1
- package/dist/linear/sync.d.ts +15 -0
- package/dist/linear/sync.js +102 -0
- package/dist/linear/sync.js.map +1 -0
- package/dist/runner/loop.d.ts +4 -0
- package/dist/runner/loop.js +168 -0
- package/dist/runner/loop.js.map +1 -0
- package/dist/runner/prompt.d.ts +14 -0
- package/dist/runner/prompt.js +59 -0
- package/dist/runner/prompt.js.map +1 -0
- package/dist/runner/update.d.ts +1 -0
- package/dist/runner/update.js +72 -0
- package/dist/runner/update.js.map +1 -0
- package/dist/server.d.ts +6 -2
- package/dist/server.js +43 -101
- package/dist/server.js.map +1 -1
- package/dist/setup.d.ts +5 -0
- package/dist/setup.js +208 -0
- package/dist/setup.js.map +1 -0
- package/dist/state/cache.d.ts +3 -0
- package/dist/state/cache.js +23 -0
- package/dist/state/cache.js.map +1 -0
- package/dist/state/status.d.ts +66 -0
- package/dist/state/status.js +96 -0
- package/dist/state/status.js.map +1 -0
- package/dist/types.d.ts +46 -114
- package/dist/worktree/manager.d.ts +6 -103
- package/dist/worktree/manager.js +25 -296
- package/dist/worktree/manager.js.map +1 -1
- package/hooks/pre-commit-verify.js +109 -109
- package/package.json +3 -2
- package/skills/forge-go.md +20 -13
- package/skills/forge-setup.md +149 -388
- package/skills/forge-spec.md +367 -342
- package/skills/forge-triage.md +179 -133
- package/skills/forge-update.md +87 -93
package/README.md
CHANGED
|
@@ -1,338 +1,454 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/forge--cc-Autonomous_Dev_Workflow-white?style=for-the-badge&labelColor=000000" />
|
|
4
|
-
<img src="https://img.shields.io/badge/forge--cc-Autonomous_Dev_Workflow-000000?style=for-the-badge&labelColor=white" alt="forge-cc" />
|
|
5
|
-
</picture>
|
|
6
|
-
</p>
|
|
7
|
-
|
|
8
|
-
<p align="center">
|
|
9
|
-
<strong>Idea to merged PR. Autonomous agent teams. Zero manual git.</strong>
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
|
-
<p align="center">
|
|
13
|
-
<a href="https://www.npmjs.com/package/forge-cc"><img src="https://img.shields.io/npm/v/forge-cc?style=flat-square&color=0969da" alt="npm" /></a>
|
|
14
|
-
<img src="https://img.shields.io/badge/Claude_Code-plugin-7c3aed?style=flat-square&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTIgMkw0IDdWMTdMMTIgMjJMMjAgMTdWN0wxMiAyWiIgZmlsbD0id2hpdGUiLz48L3N2Zz4=&logoColor=white" alt="Claude Code" />
|
|
15
|
-
<img src="https://img.shields.io/badge/node-%3E%3D18-339933?style=flat-square&logo=node.js&logoColor=white" alt="node" />
|
|
16
|
-
<img src="https://img.shields.io/npm/l/forge-cc?style=flat-square&color=22863a" alt="MIT" />
|
|
17
|
-
</p>
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## What is forge-cc?
|
|
22
|
-
|
|
23
|
-
forge-cc is a Claude Code plugin that turns your AI coding agent into an autonomous development team. You describe what you want to build. Forge breaks it into milestones, spins up parallel agent teams, verifies every line of code
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
npm install -g forge-cc
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## The Workflow
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
| **
|
|
128
|
-
| **
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
**
|
|
169
|
-
|
|
170
|
-
**Automatic cleanup** -- When a milestone finishes
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
#
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
| `
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
###
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
The
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/forge--cc-Autonomous_Dev_Workflow-white?style=for-the-badge&labelColor=000000" />
|
|
4
|
+
<img src="https://img.shields.io/badge/forge--cc-Autonomous_Dev_Workflow-000000?style=for-the-badge&labelColor=white" alt="forge-cc" />
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<strong>Idea to merged PR. Autonomous agent teams. Zero manual git.</strong>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/forge-cc"><img src="https://img.shields.io/npm/v/forge-cc?style=flat-square&color=0969da" alt="npm" /></a>
|
|
14
|
+
<img src="https://img.shields.io/badge/Claude_Code-plugin-7c3aed?style=flat-square&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTIgMkw0IDdWMTdMMTIgMjJMMjAgMTdWN0wxMiAyWiIgZmlsbD0id2hpdGUiLz48L3N2Zz4=&logoColor=white" alt="Claude Code" />
|
|
15
|
+
<img src="https://img.shields.io/badge/node-%3E%3D18-339933?style=flat-square&logo=node.js&logoColor=white" alt="node" />
|
|
16
|
+
<img src="https://img.shields.io/npm/l/forge-cc?style=flat-square&color=22863a" alt="MIT" />
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What is forge-cc?
|
|
22
|
+
|
|
23
|
+
forge-cc is a Claude Code plugin that turns your AI coding agent into an autonomous development team. You describe what you want to build. Forge breaks it into milestones, spins up parallel agent teams in isolated worktrees, verifies every line of code through automated gates, and creates the PR -- all without you touching git.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
npm install -g forge-cc
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## The Workflow
|
|
32
|
+
|
|
33
|
+
Five skill commands take you from raw idea to production-ready, merged code.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
+-----------------------------------------------------------------------------------+
|
|
37
|
+
| |
|
|
38
|
+
| YOU HAVE AN IDEA FORGE DOES THE REST |
|
|
39
|
+
| |
|
|
40
|
+
| "We need auth, +-----------+ +-----------+ +-----------+ |
|
|
41
|
+
| a dashboard, | | | | | | |
|
|
42
|
+
| and email | TRIAGE +--> SPEC +--> GO | |
|
|
43
|
+
| notifications" | | | | | | |
|
|
44
|
+
| +-----+-----+ +-----+-----+ +-----+-----+ |
|
|
45
|
+
| | | | |
|
|
46
|
+
| Creates Linear Scans codebase Agent teams |
|
|
47
|
+
| projects from + interviews build each |
|
|
48
|
+
| brain dump you + generates milestone |
|
|
49
|
+
| PRD + milestones in worktrees |
|
|
50
|
+
| | |
|
|
51
|
+
| v |
|
|
52
|
+
| +----------------+ |
|
|
53
|
+
| | VERIFY + PR | |
|
|
54
|
+
| +----------------+ |
|
|
55
|
+
| |
|
|
56
|
+
+-----------------------------------------------------------------------------------+
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `/forge:triage` -- Brain Dump to Backlog
|
|
60
|
+
|
|
61
|
+
Paste sticky notes, Slack messages, or stream-of-consciousness feature ideas. Forge extracts distinct projects, deduplicates against your existing Linear backlog, and creates them after your confirmation.
|
|
62
|
+
|
|
63
|
+
### `/forge:spec` -- Project to PRD
|
|
64
|
+
|
|
65
|
+
Pick a project from Linear. Forge scans your codebase in parallel (structure, routes, dependencies, patterns), then conducts an adaptive interview -- leading with recommendations based on what it found, not blank-slate questions. The output is a full PRD with milestones sized to fit agent context windows, synced back to Linear with issues and status tracking.
|
|
66
|
+
|
|
67
|
+
### `/forge:go` -- Milestones to Merged Code
|
|
68
|
+
|
|
69
|
+
This is the engine. Each milestone is executed by an autonomous agent team:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
+---------------------------------------------------------------------+
|
|
73
|
+
| EXECUTIVE (orchestrator) |
|
|
74
|
+
| Plans waves, assigns tasks, resolves escalations |
|
|
75
|
+
+---------------------------------------------------------------------+
|
|
76
|
+
| REVIEWER (persistent across all waves) |
|
|
77
|
+
| Reviews diff against PRD after each wave |
|
|
78
|
+
| Findings go through consensus protocol with builders |
|
|
79
|
+
+-------------------+-------------------+-----------------------------+
|
|
80
|
+
| BUILDER 1 | BUILDER 2 | BUILDER N ... |
|
|
81
|
+
| Parallel agents | Parallel agents | Each gets a task, |
|
|
82
|
+
| within each wave | within each wave | writes + tests code |
|
|
83
|
+
+-------------------+-------------------+-----------------------------+
|
|
84
|
+
| NOTETAKER (optional, for 3+ waves or 4+ agents) |
|
|
85
|
+
| Tracks decisions, file ownership, cross-agent dependencies |
|
|
86
|
+
+---------------------------------------------------------------------+
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**What happens during execution:**
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Wave 1 -> Verify -> Review -> Fix -> Wave 2 -> ... -> PR
|
|
93
|
+
| | | |
|
|
94
|
+
| | | +-- Fix agents spawn for accepted findings
|
|
95
|
+
| | +-- Reviewer + builders reach consensus on issues
|
|
96
|
+
| +-- Types + lint + tests run automatically (self-healing loop)
|
|
97
|
+
+-- Parallel builder agents execute independent tasks
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The agent team architecture is skill-driven (defined in `/forge:go` markdown), not baked into the TypeScript codebase. This makes the orchestration pattern easy to modify.
|
|
101
|
+
|
|
102
|
+
### `npx forge run` -- Auto-Chain Milestones
|
|
103
|
+
|
|
104
|
+
Run all remaining milestones for a PRD autonomously via the Ralph loop. Each milestone gets a fresh Claude session (no context degradation), spawned in an isolated worktree. On verification failure, the loop retries up to `maxIterations` times before stopping.
|
|
105
|
+
|
|
106
|
+
### `/forge:setup` and `/forge:update`
|
|
107
|
+
|
|
108
|
+
`/forge:setup` initializes a project: auto-detects your stack, creates `.forge.json`, installs skills and hooks, and scaffolds planning directories. `/forge:update` checks for newer forge-cc versions and upgrades.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Verification Gates
|
|
113
|
+
|
|
114
|
+
Forge runs **3 verification gates** that catch issues before code ships:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
+----------+ +----------+ +----------+
|
|
118
|
+
| TYPES | | LINT | | TESTS |
|
|
119
|
+
| tsc | | biome | | vitest/ |
|
|
120
|
+
| --noEmit | | check | | jest |
|
|
121
|
+
+----------+ +----------+ +----------+
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
| Gate | What it catches |
|
|
125
|
+
|------|----------------|
|
|
126
|
+
| **types** | Compilation errors, type mismatches (`tsc --noEmit`) |
|
|
127
|
+
| **lint** | Style violations, dead imports, code smells (`biome check`) |
|
|
128
|
+
| **tests** | Broken behavior, regressions (`vitest` or `jest`) |
|
|
129
|
+
|
|
130
|
+
Gates run sequentially with configurable per-gate timeouts (default 2 minutes each). Results are cached to `.forge/last-verify.json`.
|
|
131
|
+
|
|
132
|
+
**Self-healing (Ralph loop):** When a gate fails during `forge run`, the errors are fed back to Claude as structured context -- file path, line number, error message. Claude fixes the issues and re-runs verification. This loops up to `maxIterations` (default 5) times before stopping. Most failures resolve automatically.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Linear Integration
|
|
137
|
+
|
|
138
|
+
Forge manages your Linear project lifecycle end-to-end. Every state transition happens automatically as work progresses:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Linear State: Backlog --> Planned --> In Progress --> In Review --> Done
|
|
142
|
+
| | | | |
|
|
143
|
+
Forge Action: triage /forge:spec /forge:go /forge:go user merges,
|
|
144
|
+
creates generates PRD, starts last milestone runs
|
|
145
|
+
projects syncs milestones milestone completes linear-sync done
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
State names are configurable via `linearStates` in `.forge.json` (default: "Planned", "In Progress", "In Review", "Done").
|
|
149
|
+
|
|
150
|
+
Set `LINEAR_API_KEY` in your environment to enable. Forge creates projects, milestones, and issues during spec, transitions them through states during execution, and marks them done when the user merges the PR.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Branch & Worktree Management
|
|
155
|
+
|
|
156
|
+
You never touch git. Forge handles the entire branch lifecycle:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
main -----------------------------------------------------------> main (updated)
|
|
160
|
+
| ^
|
|
161
|
+
+---> feat/my-project ---> worktree m1 ---> wave 1..N ---> merge ---+
|
|
162
|
+
| |
|
|
163
|
+
+---> worktree m2 ---> (sequential)---+
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Worktree isolation** -- Each milestone runs in its own git worktree at `../.forge-wt/<repo>/<slug>-m<N>/`. Parallel agents within a wave share the worktree, but separate milestones get separate worktrees. Merges back to the feature branch use `--ff-only`.
|
|
167
|
+
|
|
168
|
+
**Minimal footprint** -- Worktree management is 3 functions (~50 lines): `createWorktree`, `mergeWorktree`, `removeWorktree`. No session registry, no parallel scheduler, no sessions.json.
|
|
169
|
+
|
|
170
|
+
**Automatic cleanup** -- When a milestone finishes (pass or fail), its worktree is removed. Protected branches (`main`, `master`) are never committed to directly.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Quick Start
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# 1. Install
|
|
178
|
+
npm install -g forge-cc
|
|
179
|
+
|
|
180
|
+
# 2. Set up your project
|
|
181
|
+
npx forge setup
|
|
182
|
+
|
|
183
|
+
# 3. (Optional) Set Linear API key for project management
|
|
184
|
+
export LINEAR_API_KEY="lin_api_..."
|
|
185
|
+
|
|
186
|
+
# 4. Start building
|
|
187
|
+
# /forge:triage -> /forge:spec -> /forge:go
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`forge setup` auto-detects your stack (TypeScript, Biome, test runner), creates `.forge.json`, installs enforcement hooks, syncs skill files to `~/.claude/commands/forge/`, and updates your `CLAUDE.md`. Run `npx forge doctor` anytime to check your environment.
|
|
191
|
+
|
|
192
|
+
### Configuration
|
|
193
|
+
|
|
194
|
+
`.forge.json` in your project root:
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"gates": ["types", "lint", "tests"],
|
|
199
|
+
"maxIterations": 5,
|
|
200
|
+
"linearTeam": "ENG"
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
<details>
|
|
205
|
+
<summary><b>Full configuration reference</b></summary>
|
|
206
|
+
|
|
207
|
+
| Option | Type | Default | Description |
|
|
208
|
+
|--------|------|---------|-------------|
|
|
209
|
+
| `gates` | `string[]` | `["types", "lint", "tests"]` | Which verification gates to run |
|
|
210
|
+
| `gateTimeouts` | `Record<string, number>` | `{}` | Per-gate timeout in ms (default 120000 per gate) |
|
|
211
|
+
| `maxIterations` | `number` | `5` | Max Ralph loop retry iterations |
|
|
212
|
+
| `linearTeam` | `string` | `""` | Linear team key or name for lifecycle sync |
|
|
213
|
+
| `linearStates` | `object` | see below | Custom Linear state names |
|
|
214
|
+
| `verifyFreshness` | `number` | `600000` | Verify cache validity in ms (default 10 min) |
|
|
215
|
+
| `forgeVersion` | `string` | `"1.0.0"` | Version stamp from setup (used by version-check hook) |
|
|
216
|
+
|
|
217
|
+
**`linearStates` defaults:**
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"planned": "Planned",
|
|
222
|
+
"inProgress": "In Progress",
|
|
223
|
+
"inReview": "In Review",
|
|
224
|
+
"done": "Done"
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Environment:** Set `LINEAR_API_KEY` to enable Linear integration.
|
|
229
|
+
|
|
230
|
+
</details>
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## CLI Reference
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Verification
|
|
238
|
+
npx forge verify # Run all configured gates
|
|
239
|
+
npx forge verify --gate types,lint # Run specific gates
|
|
240
|
+
npx forge verify --json # Output results as JSON
|
|
241
|
+
|
|
242
|
+
# Milestone execution
|
|
243
|
+
npx forge run --prd <slug> # Auto-chain all milestones for a PRD
|
|
244
|
+
|
|
245
|
+
# Status
|
|
246
|
+
npx forge status # Show PRD progress across all projects
|
|
247
|
+
|
|
248
|
+
# Setup & maintenance
|
|
249
|
+
npx forge setup # Initialize forge for a project
|
|
250
|
+
npx forge setup --skills-only # Only sync skill files
|
|
251
|
+
npx forge doctor # Environment health check
|
|
252
|
+
npx forge update # Check for and install updates
|
|
253
|
+
|
|
254
|
+
# Linear sync (used by skills, can also be called directly)
|
|
255
|
+
npx forge linear-sync start --slug <slug> --milestone <n>
|
|
256
|
+
npx forge linear-sync complete --slug <slug> --milestone <n> [--last] [--pr-url <url>]
|
|
257
|
+
npx forge linear-sync done --slug <slug>
|
|
258
|
+
npx forge linear-sync list-issues --slug <slug>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Skill Commands
|
|
262
|
+
|
|
263
|
+
Skills are Claude Code slash commands installed to `~/.claude/commands/forge/`:
|
|
264
|
+
|
|
265
|
+
| Skill | Description |
|
|
266
|
+
|-------|-------------|
|
|
267
|
+
| `/forge:triage` | Brain dump to Linear projects -- extracts, deduplicates, creates |
|
|
268
|
+
| `/forge:spec` | Linear project to PRD with milestones -- scans codebase, interviews, generates |
|
|
269
|
+
| `/forge:go` | Execute milestones with wave-based agent teams -- build, verify, review, PR |
|
|
270
|
+
| `/forge:setup` | Run project scaffolding -- config, hooks, skills, CLAUDE.md |
|
|
271
|
+
| `/forge:update` | Check for updates and upgrade forge-cc |
|
|
272
|
+
|
|
273
|
+
### Enforcement Hooks
|
|
274
|
+
|
|
275
|
+
Forge installs two Claude Code hooks during setup:
|
|
276
|
+
|
|
277
|
+
- **Pre-commit hook** (`pre-commit-verify.js`) -- Blocks commits that haven't passed verification. Checks branch protection (no direct commits to main/master), verify cache freshness, and `result === 'PASSED'` in `.forge/last-verify.json`.
|
|
278
|
+
- **Version check hook** (`version-check.js`) -- Non-blocking notice when a newer forge-cc version is available or when project setup is stale.
|
|
279
|
+
|
|
280
|
+
### MCP Server
|
|
281
|
+
|
|
282
|
+
Expose the verification pipeline as an MCP tool for programmatic access:
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"mcpServers": {
|
|
287
|
+
"forge-cc": {
|
|
288
|
+
"command": "node",
|
|
289
|
+
"args": ["node_modules/forge-cc/dist/server.js"]
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Tool:** `forge_run_pipeline`
|
|
296
|
+
|
|
297
|
+
| Input | Type | Description |
|
|
298
|
+
|-------|------|-------------|
|
|
299
|
+
| `projectDir` | `string?` | Project directory (defaults to cwd) |
|
|
300
|
+
| `gates` | `string[]?` | Filter to specific gates |
|
|
301
|
+
|
|
302
|
+
Returns the full pipeline result as JSON (result status, per-gate pass/fail, errors with file/line/message).
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## How It's Different
|
|
307
|
+
|
|
308
|
+
| Without forge | With forge |
|
|
309
|
+
|--------------|-----------|
|
|
310
|
+
| Agent writes code, you review everything | Agent teams build, verify, review, and fix their own code |
|
|
311
|
+
| Manual git branching, PRs, merges | Automatic worktrees, branches, and PRs |
|
|
312
|
+
| "Tests pass" = done | 3 gates: types + lint + tests, with self-healing retry loop |
|
|
313
|
+
| One agent, one task, serial | Parallel agent teams with wave-based execution |
|
|
314
|
+
| Context rot across long sessions | Fresh session per milestone, no degradation |
|
|
315
|
+
| Linear updated manually | Automatic state transitions through your pipeline |
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Troubleshooting
|
|
320
|
+
|
|
321
|
+
<details>
|
|
322
|
+
<summary><b>Common issues</b></summary>
|
|
323
|
+
|
|
324
|
+
### `forge run` fails when invoked from within Claude Code
|
|
325
|
+
|
|
326
|
+
Forge strips the `CLAUDECODE` environment variable before spawning `claude` subprocesses. Claude Code uses this variable to detect nested sessions and blocks them. If `forge run` hangs or exits immediately, ensure you're running it from a terminal, not from inside an active Claude Code session. When invoked via the `/forge:go` skill, this is handled automatically.
|
|
327
|
+
|
|
328
|
+
### Pre-commit hook blocks commits
|
|
329
|
+
|
|
330
|
+
The pre-commit hook requires a passing verification cached in `.forge/last-verify.json`. Run `npx forge verify` to populate the cache. The cache expires after `verifyFreshness` ms (default 10 minutes).
|
|
331
|
+
|
|
332
|
+
### Linear sync runs but does nothing
|
|
333
|
+
|
|
334
|
+
If `forge linear-sync` produces no output, check:
|
|
335
|
+
1. `LINEAR_API_KEY` is set in your environment
|
|
336
|
+
2. Your `.planning/status/<slug>.json` has `linearTeamId` and `linearProjectId` populated (these are set during `/forge:spec`)
|
|
337
|
+
3. Run `npx forge doctor` to validate the API key and team configuration
|
|
338
|
+
|
|
339
|
+
### `forge run` on Windows
|
|
340
|
+
|
|
341
|
+
On Windows, to locate the globally installed `forge-cc` package programmatically, use `process.env.APPDATA + '/npm/node_modules/forge-cc'`. Don't use bash path traversal -- backslash escaping breaks (the `\n` in `npm\node_modules` is interpreted as a newline).
|
|
342
|
+
|
|
343
|
+
### Doctor says checks failed
|
|
344
|
+
|
|
345
|
+
Run `npx forge doctor` to see which checks fail. Required: Node.js >= 18 and git. Optional: `gh` CLI (for PR workflows), `LINEAR_API_KEY` (for Linear integration).
|
|
346
|
+
|
|
347
|
+
</details>
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
<details>
|
|
352
|
+
<summary><h2>Architecture & Contributor Reference</h2></summary>
|
|
353
|
+
|
|
354
|
+
### Project Structure
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
forge-cc/
|
|
358
|
+
src/
|
|
359
|
+
cli.ts # CLI entry (npx forge)
|
|
360
|
+
server.ts # MCP server (stdio transport)
|
|
361
|
+
types.ts # Core types
|
|
362
|
+
doctor.ts # Environment health checks
|
|
363
|
+
setup.ts # Project scaffolding
|
|
364
|
+
config/
|
|
365
|
+
loader.ts # .forge.json reader + auto-detection
|
|
366
|
+
schema.ts # Zod schema for .forge.json
|
|
367
|
+
gates/
|
|
368
|
+
index.ts # Gate registry + pipeline runner
|
|
369
|
+
types-gate.ts # TypeScript gate (tsc --noEmit)
|
|
370
|
+
lint-gate.ts # Lint gate (biome check)
|
|
371
|
+
tests-gate.ts # Tests gate (vitest/jest)
|
|
372
|
+
linear/
|
|
373
|
+
client.ts # @linear/sdk wrapper (team-scoped)
|
|
374
|
+
sync.ts # Linear state transitions
|
|
375
|
+
runner/
|
|
376
|
+
loop.ts # Ralph loop executor
|
|
377
|
+
prompt.ts # Prompt builder + PRD section extractor
|
|
378
|
+
update.ts # Version check
|
|
379
|
+
state/
|
|
380
|
+
status.ts # PRD status CRUD
|
|
381
|
+
cache.ts # Verify cache writer
|
|
382
|
+
worktree/
|
|
383
|
+
manager.ts # createWorktree, mergeWorktree, removeWorktree
|
|
384
|
+
skills/ # Claude Code skill definitions (markdown)
|
|
385
|
+
hooks/ # Installable hooks (pre-commit, version-check)
|
|
386
|
+
tests/ # Test suite (vitest)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Design Decisions
|
|
390
|
+
|
|
391
|
+
**Skill-driven orchestration.** The agent team architecture (executive, reviewer, builders, notetaker) is defined in skill markdown files, not in TypeScript. This means the orchestration pattern can be modified by editing a markdown file -- no code changes, no builds.
|
|
392
|
+
|
|
393
|
+
**File system as memory.** Milestones communicate through `.planning/status/<slug>.json` files and the PRD itself. No in-memory state is passed between milestones. This enables the "fresh process per milestone" pattern that avoids context degradation.
|
|
394
|
+
|
|
395
|
+
**Minimal worktree management.** Three functions, ~50 lines. No session registry, no parallel DAG scheduler. Worktrees are created at `../.forge-wt/<repo>/<slug>-m<N>/` and cleaned up after each milestone.
|
|
396
|
+
|
|
397
|
+
**Gate pipeline, not gate tree.** Gates run sequentially, not in parallel. This is intentional -- types must pass before lint makes sense, lint before tests. Per-gate timeouts (default 2 minutes) prevent hangs.
|
|
398
|
+
|
|
399
|
+
### Extension Points
|
|
400
|
+
|
|
401
|
+
**Adding a gate:** Create a new file in `src/gates/` implementing the `Gate` interface (`name: string`, `run: (projectDir: string) => Promise<GateResult>`). Register it in `src/cli.ts` and `src/server.ts` with `registerGate()`.
|
|
402
|
+
|
|
403
|
+
**Custom Linear states:** Override the default state names in `.forge.json`:
|
|
404
|
+
|
|
405
|
+
```json
|
|
406
|
+
{
|
|
407
|
+
"linearStates": {
|
|
408
|
+
"planned": "Todo",
|
|
409
|
+
"inProgress": "Doing",
|
|
410
|
+
"inReview": "Review",
|
|
411
|
+
"done": "Complete"
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Custom gate timeouts:** Set per-gate timeouts in milliseconds:
|
|
417
|
+
|
|
418
|
+
```json
|
|
419
|
+
{
|
|
420
|
+
"gateTimeouts": {
|
|
421
|
+
"tests": 300000
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Key Lessons Learned
|
|
427
|
+
|
|
428
|
+
These lessons were learned during forge-cc's own development and are baked into the workflow:
|
|
429
|
+
|
|
430
|
+
- **Milestone sizing matters.** Every milestone must be completable in one agent context window. If it's too large, split it. The `/forge:spec` skill enforces this.
|
|
431
|
+
- **No compaction chaining.** Never rely on Claude Code's context compaction for multi-milestone execution. Fresh processes per milestone (via `forge run`) are the correct pattern -- the file system is the only memory between iterations.
|
|
432
|
+
- **Restage at wave boundaries.** Parallel builder agents can disrupt each other's git index. Restage all files at wave boundaries.
|
|
433
|
+
- **Verify between waves.** Run `tsc --noEmit` between every wave, not just at the end. Catches cross-agent integration issues early.
|
|
434
|
+
- **Silent failure is a bug.** CLI commands that touch external systems must print what they did or why they skipped. No-output-as-success is not acceptable.
|
|
435
|
+
|
|
436
|
+
### Development
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
npm install # Dependencies
|
|
440
|
+
npm run build # Build
|
|
441
|
+
npm test # Tests
|
|
442
|
+
npx tsc --noEmit # Type check
|
|
443
|
+
npx forge verify # Self-verify
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Stack:** TypeScript (ES2022 strict), Node.js 18+, MCP SDK, Commander, Zod, Vitest
|
|
447
|
+
|
|
448
|
+
</details>
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
<p align="center">
|
|
453
|
+
<sub>MIT License • Built for <a href="https://docs.anthropic.com/en/docs/claude-code">Claude Code</a></sub>
|
|
454
|
+
</p>
|