forge-cc 0.1.40 → 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 -906
- 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/go/linear-sync-cli.js +13 -4
- package/dist/go/linear-sync-cli.js.map +1 -1
- package/dist/go/linear-sync.d.ts +1 -0
- package/dist/go/linear-sync.js +67 -4
- package/dist/go/linear-sync.js.map +1 -1
- package/dist/linear/client.d.ts +34 -105
- package/dist/linear/client.js +85 -365
- package/dist/linear/client.js.map +1 -1
- package/dist/linear/issues.d.ts +3 -1
- package/dist/linear/issues.js +14 -2
- package/dist/linear/issues.js.map +1 -1
- package/dist/linear/projects.js +3 -2
- package/dist/linear/projects.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 +583 -575
- 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/skills/forge-spec.md
CHANGED
|
@@ -1,342 +1,367 @@
|
|
|
1
|
-
# /forge:spec — Linear Project to PRD with Milestones
|
|
2
|
-
|
|
3
|
-
Turn a Linear project into a detailed PRD with milestones and issues. This skill scans the codebase, conducts an adaptive interview, generates a PRD, and syncs the plan back to Linear.
|
|
4
|
-
|
|
5
|
-
## Instructions
|
|
6
|
-
|
|
7
|
-
Follow these steps exactly. The interview is adaptive — lead with recommendations, not blank-slate questions.
|
|
8
|
-
|
|
9
|
-
### Step 1 — Select Linear Project
|
|
10
|
-
|
|
11
|
-
Fetch incomplete projects from Linear:
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
Use mcp__linear__list_projects to get all existing projects.
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Filter to projects in "Backlog" state (these are triaged but not yet specced). Present them as a numbered list:
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
## Projects Ready for Spec
|
|
21
|
-
|
|
22
|
-
1. **Project Name** — description
|
|
23
|
-
2. **Project Name** — description
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Then ask:
|
|
27
|
-
|
|
28
|
-
> Which project would you like to spec? Pick a number, or type a project name.
|
|
29
|
-
|
|
30
|
-
If no Backlog projects exist, say:
|
|
31
|
-
|
|
32
|
-
> No projects in Backlog state. Run `/forge:triage` first to create projects from your ideas, or create one directly in Linear.
|
|
33
|
-
|
|
34
|
-
Wait for the user's selection before continuing.
|
|
35
|
-
|
|
36
|
-
### Step 2 — Scan the Codebase
|
|
37
|
-
|
|
38
|
-
Run 3 parallel codebase scan agents using the Task tool
|
|
39
|
-
|
|
40
|
-
**Agent 1 — Structure Scanner:**
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Report
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**Agent 3 — Data/APIs Scanner:**
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Report
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Combine the results into a
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
## Codebase Scan Complete
|
|
65
|
-
|
|
66
|
-
- **Framework:** Next.js (TypeScript)
|
|
67
|
-
- **Pages:** 12 | **API Routes:** 8
|
|
68
|
-
- **Dependencies:** 24 | **DB Files:** 3
|
|
69
|
-
- **Key Files:** src/lib/auth.ts, src/db/schema.prisma, ...
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
If the current working directory does not look like a project (no package.json, no src/), warn:
|
|
73
|
-
|
|
74
|
-
> This directory doesn't look like a project root. Should I scan here, or provide a path to the project?
|
|
75
|
-
|
|
76
|
-
### Step 3 — LLM-Driven Adaptive Interview
|
|
77
|
-
|
|
78
|
-
You (the LLM) drive the interview
|
|
79
|
-
|
|
80
|
-
The interview covers 5 sections:
|
|
81
|
-
|
|
82
|
-
1. **Problem & Goals** — core problem, desired outcome, success criteria, impact/urgency, current workarounds, who feels the pain
|
|
83
|
-
2. **User Stories** — primary users, user workflows step-by-step, secondary users, edge cases, permissions/roles, error states
|
|
84
|
-
3. **Technical Approach** — architecture pattern, data model/schema, APIs/integrations, auth/security, performance requirements, error handling, existing code to leverage
|
|
85
|
-
4. **Scope** — in scope boundaries, out of scope, sacred files/areas, constraints, future phases explicitly deferred
|
|
86
|
-
5. **Milestones** — breakdown into chunks, dependencies between milestones, sizing (fits in one agent context?), verification criteria, delivery order, risk areas
|
|
87
|
-
|
|
88
|
-
**Interview Loop — You Drive:**
|
|
89
|
-
|
|
90
|
-
1.
|
|
91
|
-
2.
|
|
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
|
-
|
|
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
|
-
For each milestone in the PRD:
|
|
273
|
-
|
|
274
|
-
```
|
|
275
|
-
Use mcp__linear__create_milestone with:
|
|
276
|
-
- projectId: the selected project's ID
|
|
277
|
-
- name: milestone name
|
|
278
|
-
- description: milestone goal
|
|
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
|
-
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
1
|
+
# /forge:spec — Linear Project to PRD with Milestones
|
|
2
|
+
|
|
3
|
+
Turn a Linear project into a detailed PRD with milestones and issues. This skill scans the codebase, conducts an adaptive interview, generates a PRD, and syncs the plan back to Linear.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Follow these steps exactly. The interview is adaptive — lead with recommendations, not blank-slate questions.
|
|
8
|
+
|
|
9
|
+
### Step 1 — Select Linear Project
|
|
10
|
+
|
|
11
|
+
Fetch incomplete projects from Linear:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Use mcp__linear__list_projects to get all existing projects.
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Filter to projects in "Backlog" state (these are triaged but not yet specced). Present them as a numbered list:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
## Projects Ready for Spec
|
|
21
|
+
|
|
22
|
+
1. **Project Name** — description
|
|
23
|
+
2. **Project Name** — description
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then ask:
|
|
27
|
+
|
|
28
|
+
> Which project would you like to spec? Pick a number, or type a project name.
|
|
29
|
+
|
|
30
|
+
If no Backlog projects exist, say:
|
|
31
|
+
|
|
32
|
+
> No projects in Backlog state. Run `/forge:triage` first to create projects from your ideas, or create one directly in Linear.
|
|
33
|
+
|
|
34
|
+
Wait for the user's selection before continuing.
|
|
35
|
+
|
|
36
|
+
### Step 2 — Scan the Codebase
|
|
37
|
+
|
|
38
|
+
Run 3 parallel codebase scan agents using the Task tool (subagent_type: Explore):
|
|
39
|
+
|
|
40
|
+
**Agent 1 — Structure Scanner:**
|
|
41
|
+
```
|
|
42
|
+
Use Glob and Read tools to scan for: package.json, tsconfig.json, .env*, config files, key directories (src/, app/, pages/, lib/).
|
|
43
|
+
Report: framework, language, dependencies, project structure, build tools.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Agent 2 — Routes/UI Scanner:**
|
|
47
|
+
```
|
|
48
|
+
Use Glob and Grep tools to scan for: route files, pages, layouts, navigation components, route definitions.
|
|
49
|
+
Look in common locations: src/app/, src/pages/, src/routes/, app/, pages/.
|
|
50
|
+
Grep for route patterns (e.g., "createBrowserRouter", "Route", "router.", "app.get", "app.post").
|
|
51
|
+
Report: routing framework, page count, API route count, layout structure.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Agent 3 — Data/APIs Scanner:**
|
|
55
|
+
```
|
|
56
|
+
Use Glob and Grep tools to scan for: API endpoints, database files (schema.prisma, migrations/, models/), env files (.env*), external service configs, ORM setup, SDK clients.
|
|
57
|
+
Grep for patterns like "fetch(", "axios", "prisma.", "mongoose.", "createClient".
|
|
58
|
+
Report: database type, API patterns, external integrations, auth setup.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Combine the results into a plain-text summary. Print a brief overview:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
## Codebase Scan Complete
|
|
65
|
+
|
|
66
|
+
- **Framework:** Next.js (TypeScript)
|
|
67
|
+
- **Pages:** 12 | **API Routes:** 8
|
|
68
|
+
- **Dependencies:** 24 | **DB Files:** 3
|
|
69
|
+
- **Key Files:** src/lib/auth.ts, src/db/schema.prisma, ...
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If the current working directory does not look like a project (no package.json, no src/), warn:
|
|
73
|
+
|
|
74
|
+
> This directory doesn't look like a project root. Should I scan here, or provide a path to the project?
|
|
75
|
+
|
|
76
|
+
### Step 3 — LLM-Driven Adaptive Interview
|
|
77
|
+
|
|
78
|
+
You (the LLM) drive the interview directly. Track coverage mentally across the 5 sections. No TypeScript state tracking — you are the state tracker.
|
|
79
|
+
|
|
80
|
+
The interview covers 5 sections:
|
|
81
|
+
|
|
82
|
+
1. **Problem & Goals** — core problem, desired outcome, success criteria, impact/urgency, current workarounds, who feels the pain
|
|
83
|
+
2. **User Stories** — primary users, user workflows step-by-step, secondary users, edge cases, permissions/roles, error states
|
|
84
|
+
3. **Technical Approach** — architecture pattern, data model/schema, APIs/integrations, auth/security, performance requirements, error handling, existing code to leverage
|
|
85
|
+
4. **Scope** — in scope boundaries, out of scope, sacred files/areas, constraints, future phases explicitly deferred
|
|
86
|
+
5. **Milestones** — breakdown into chunks, dependencies between milestones, sizing (fits in one agent context?), verification criteria, delivery order, risk areas
|
|
87
|
+
|
|
88
|
+
**Interview Loop — You Drive:**
|
|
89
|
+
|
|
90
|
+
1. Start with a broad opening question for Problem & Goals, informed by scan results
|
|
91
|
+
2. After each answer:
|
|
92
|
+
- Assess coverage gaps mentally (which topics are uncovered? which answers were vague?)
|
|
93
|
+
- Generate the next question based on: scan results, all prior Q&A, what's still ambiguous
|
|
94
|
+
- Probe deeper on vague or short answers — don't accept "TBD" or one-liners for important topics
|
|
95
|
+
- Move to the next section when the current one has thorough coverage
|
|
96
|
+
- Revisit earlier sections if later answers reveal new info
|
|
97
|
+
3. Continue until all 5 sections have adequate coverage
|
|
98
|
+
|
|
99
|
+
**Question Principles — Encode These:**
|
|
100
|
+
|
|
101
|
+
- Ask about edge cases, error states, and "what could go wrong"
|
|
102
|
+
- When the user mentions an integration, ask about auth, rate limits, failure modes
|
|
103
|
+
- When the user describes a workflow, walk through it step-by-step
|
|
104
|
+
- For milestones, actively challenge sizing — "is this too big for one context window?"
|
|
105
|
+
- Don't ask yes/no questions — ask "how" and "what" questions that elicit detail
|
|
106
|
+
- Circle back to earlier sections when new info surfaces
|
|
107
|
+
- Follow interesting threads: if the user mentions migration, breaking changes, multiple user types, or external services, dig deeper
|
|
108
|
+
|
|
109
|
+
**Stop Condition:**
|
|
110
|
+
|
|
111
|
+
You determine you have enough detail for a thorough PRD across ALL sections, with no significant ambiguity remaining. Before transitioning to Step 4, print a coverage summary showing the final state of each section.
|
|
112
|
+
|
|
113
|
+
**Early Exit:**
|
|
114
|
+
|
|
115
|
+
If the user says "stop", "that's enough", "skip", or "generate it" at any time, respect that and move to Step 4 with what you have.
|
|
116
|
+
|
|
117
|
+
**Milestone Sizing Constraint (Hard Rule):**
|
|
118
|
+
|
|
119
|
+
Each milestone MUST be completable in one main agent context window. If a milestone requires more than ~4 agents across 2-3 waves, split it. This is non-negotiable — large milestones cause context overflow and execution failures. When interviewing about milestones, actively recommend splitting any milestone that looks too large.
|
|
120
|
+
|
|
121
|
+
**Milestone Dependencies (dependsOn):**
|
|
122
|
+
|
|
123
|
+
During the milestones phase of the interview, ask about milestone dependencies using AskUserQuestion. For each milestone after the first, ask:
|
|
124
|
+
|
|
125
|
+
- question: "Does Milestone {N} depend on any previous milestones?"
|
|
126
|
+
- options:
|
|
127
|
+
- "No dependencies — can start immediately"
|
|
128
|
+
- "Depends on Milestone {N-1} (sequential)"
|
|
129
|
+
- "Depends on specific milestones (I'll specify)"
|
|
130
|
+
|
|
131
|
+
If milestones have explicit dependencies, include `**dependsOn:** 1, 2` in the milestone section of the PRD. If no dependencies are specified, omit the field (backward compatible — treated as sequential).
|
|
132
|
+
|
|
133
|
+
Independent milestones enable parallel execution via `/forge:go`, which creates separate worktrees for each parallel milestone.
|
|
134
|
+
|
|
135
|
+
**Question Format:**
|
|
136
|
+
|
|
137
|
+
Mix AskUserQuestion (for structured choices) and conversational questions (for open-ended probing):
|
|
138
|
+
|
|
139
|
+
- **Use AskUserQuestion** when there are clear option sets (architecture choices, yes/no with detail, picking from scan-derived options). Provide 2-4 options plus "Other (I'll describe)".
|
|
140
|
+
- **Use conversational questions** when probing for depth, asking "how" or "what" questions, or exploring topics that don't have predefined options.
|
|
141
|
+
- **NEVER present questions as numbered text lists.** Each structured question gets its own AskUserQuestion call.
|
|
142
|
+
- **Lead with recommendations.** Every question includes context from the codebase scan. Never ask a blank "what do you want to build?" question.
|
|
143
|
+
|
|
144
|
+
**Progress Display:**
|
|
145
|
+
|
|
146
|
+
After each answer, show a compact coverage status:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
Progress: Problem & Goals [thorough] | User Stories [moderate] | Technical [thin] | Scope [none] | Milestones [none]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Draft Updates:**
|
|
153
|
+
|
|
154
|
+
- **Update the PRD draft every 2-3 answers.** Write to `.planning/prds/{project-slug}.md`. Tell the user:
|
|
155
|
+
|
|
156
|
+
> Updated PRD draft at `.planning/prds/{slug}.md` — you can review it anytime.
|
|
157
|
+
|
|
158
|
+
**Do NOT do this (anti-pattern):**
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
### Round N
|
|
162
|
+
|
|
163
|
+
1. **[Section]** Question text?
|
|
164
|
+
2. **[Section]** Question text?
|
|
165
|
+
|
|
166
|
+
> Answer by number...
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
This numbered-text format is explicitly prohibited. Always use AskUserQuestion for structured choices.
|
|
170
|
+
|
|
171
|
+
### Step 4 — Generate PRD
|
|
172
|
+
|
|
173
|
+
Using all gathered interview answers and codebase scan results, generate the final PRD directly. The LLM synthesizes all interview data into the PRD — no external generator module needed.
|
|
174
|
+
|
|
175
|
+
The PRD should follow this structure:
|
|
176
|
+
|
|
177
|
+
```markdown
|
|
178
|
+
# PRD: {Project Name}
|
|
179
|
+
|
|
180
|
+
## Problem & Goals
|
|
181
|
+
{Synthesized from interview answers}
|
|
182
|
+
|
|
183
|
+
## User Stories
|
|
184
|
+
{Structured user stories derived from interview}
|
|
185
|
+
|
|
186
|
+
## Technical Approach
|
|
187
|
+
{Stack decisions, architecture, constraints — informed by codebase scan}
|
|
188
|
+
|
|
189
|
+
## Scope
|
|
190
|
+
### In Scope
|
|
191
|
+
{What will be built}
|
|
192
|
+
|
|
193
|
+
### Out of Scope
|
|
194
|
+
{Explicitly excluded items}
|
|
195
|
+
|
|
196
|
+
### Sacred Files
|
|
197
|
+
{Files/areas not to be touched}
|
|
198
|
+
|
|
199
|
+
## Milestones
|
|
200
|
+
|
|
201
|
+
### Milestone 1: {Name}
|
|
202
|
+
**Goal:** {What this delivers}
|
|
203
|
+
**Issues:**
|
|
204
|
+
- [ ] Issue title — brief description
|
|
205
|
+
- [ ] Issue title — brief description
|
|
206
|
+
|
|
207
|
+
### Milestone 2: {Name}
|
|
208
|
+
**dependsOn:** 1
|
|
209
|
+
**Goal:** {What this delivers}
|
|
210
|
+
...
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Milestone sizing check:** Before finalizing, review each milestone against the sizing constraint. Every milestone MUST fit in one agent context window (~4 agents across 2-3 waves max). If any milestone exceeds this, split it into smaller milestones before writing the final PRD. Set `maxContextWindowFit: true` on all milestones — if you cannot make a milestone fit, flag it as `maxContextWindowFit: false` and warn the user.
|
|
214
|
+
|
|
215
|
+
**Test criteria guidance:** Test criteria are optional. Only include them when the milestone produces testable behavior. Verification commands (`npx tsc --noEmit`, `npx forge verify`) are always included automatically — test criteria are for additional functional checks beyond mechanical gates. When including test criteria, make them **functional**, not structural:
|
|
216
|
+
- Good: "CLI `npx forge verify` runs and exits 0", "tsc compiles with no errors", "the new gate produces structured JSON output"
|
|
217
|
+
- Bad: "All new source files must have corresponding test files", "Run npx forge verify --gate tests"
|
|
218
|
+
|
|
219
|
+
Write the final PRD to `.planning/prds/{project-slug}.md`.
|
|
220
|
+
|
|
221
|
+
After writing the PRD file, **execute BOTH steps below — do not skip either**:
|
|
222
|
+
|
|
223
|
+
1. **Create status file:** Write `.planning/status/<slug>.json` with all milestones set to "pending". **You MUST include `linearProjectId` and `linearTeamId`** — these are the Linear project UUID and team UUID from the project selected in Step 1. Without `linearProjectId`, `/forge:go` cannot sync Linear issue or project state and will silently skip all Linear operations. Without `linearTeamId`, `forge linear-sync` silently skips all operations. Copy the exact IDs — do not omit these fields:
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"project": "{project name}",
|
|
227
|
+
"slug": "{slug}",
|
|
228
|
+
"branch": "feat/{slug}",
|
|
229
|
+
"createdAt": "{today}",
|
|
230
|
+
"linearProjectId": "{Linear project UUID from Step 1}",
|
|
231
|
+
"linearTeamId": "{team UUID — resolved in Step 5, but placeholder here}",
|
|
232
|
+
"milestones": {
|
|
233
|
+
"1": { "status": "pending" },
|
|
234
|
+
"2": { "status": "pending" }
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
2. **Create feature branch:** `git checkout -b feat/{slug}`
|
|
240
|
+
|
|
241
|
+
Tell the user:
|
|
242
|
+
|
|
243
|
+
> Final PRD written to `.planning/prds/{slug}.md`.
|
|
244
|
+
> Status file created at `.planning/status/{slug}.json`.
|
|
245
|
+
> Feature branch `feat/{slug}` created.
|
|
246
|
+
|
|
247
|
+
Present the full PRD in chat for review and ask:
|
|
248
|
+
|
|
249
|
+
> Review the PRD above. You can:
|
|
250
|
+
> - **Approve** — I'll create milestones and issues in Linear
|
|
251
|
+
> - **Edit** — tell me what to change (e.g., "add a milestone for testing" or "remove the admin user story")
|
|
252
|
+
> - **Regenerate** — start the interview over
|
|
253
|
+
>
|
|
254
|
+
> What would you like to do?
|
|
255
|
+
|
|
256
|
+
Wait for approval before continuing to Step 5.
|
|
257
|
+
|
|
258
|
+
### Step 5 — Sync to Linear
|
|
259
|
+
|
|
260
|
+
After the user approves the PRD, create milestones and issues in Linear.
|
|
261
|
+
|
|
262
|
+
First, get the team ID:
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
Use mcp__linear__list_teams to get available teams.
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
If there is only one team, use it automatically. If multiple, ask the user which team.
|
|
269
|
+
|
|
270
|
+
**Store the team ID** — it will be written to the status file after sync.
|
|
271
|
+
|
|
272
|
+
For each milestone in the PRD:
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
Use mcp__linear__create_milestone with:
|
|
276
|
+
- projectId: the selected project's ID
|
|
277
|
+
- name: milestone name
|
|
278
|
+
- description: milestone goal
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Record the returned milestone ID** for each milestone.
|
|
282
|
+
|
|
283
|
+
For each issue under that milestone:
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
Use mcp__linear__create_issue with:
|
|
287
|
+
- title: issue title
|
|
288
|
+
- description: issue description (from PRD)
|
|
289
|
+
- teamId: the team ID
|
|
290
|
+
- projectId: the project ID
|
|
291
|
+
- milestoneId: the milestone ID just created
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Record the returned issue IDs** for each milestone.
|
|
295
|
+
|
|
296
|
+
**After all milestones and issues are created, do THREE things:**
|
|
297
|
+
|
|
298
|
+
1. **Transition the project to "Planned":**
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
Use mcp__linear__update_project to set the project state to "planned".
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**The project is a separate entity from its milestones and issues.** Creating milestones and issues does NOT automatically update the project state. You must explicitly call `mcp__linear__update_project`. Without this transition, `/forge:go` will find the project still in "Backlog" and the state machine will reject the "In Progress" transition.
|
|
305
|
+
|
|
306
|
+
2. **Update the status file** at `.planning/status/<slug>.json` with the Linear IDs:
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"project": "{project name}",
|
|
311
|
+
"slug": "{slug}",
|
|
312
|
+
"branch": "feat/{slug}",
|
|
313
|
+
"createdAt": "{today}",
|
|
314
|
+
"linearProjectId": "{Linear project UUID from Step 1}",
|
|
315
|
+
"linearTeamId": "{team UUID from this step}",
|
|
316
|
+
"milestones": {
|
|
317
|
+
"1": { "status": "pending", "linearMilestoneId": "{id}", "linearIssueIds": ["{id1}", "{id2}"] },
|
|
318
|
+
"2": { "status": "pending", "linearMilestoneId": "{id}", "linearIssueIds": ["{id1}", "{id2}"] }
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**`linearTeamId` is MANDATORY.** Without it, `forge linear-sync` silently skips all operations. **`linearMilestoneId` and `linearIssueIds` per milestone are MANDATORY.** These enable `/forge:go` to transition issues as milestones are completed.
|
|
324
|
+
|
|
325
|
+
3. **Print a summary:**
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
## Synced to Linear
|
|
329
|
+
|
|
330
|
+
- **Project:** {name} (now "Planned")
|
|
331
|
+
- **Milestones:** {N} created
|
|
332
|
+
- **Issues:** {M} created across all milestones
|
|
333
|
+
|
|
334
|
+
View in Linear: {project URL}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
If any creation fails, report the error and continue with remaining items.
|
|
338
|
+
|
|
339
|
+
### Step 6 — Handoff
|
|
340
|
+
|
|
341
|
+
After sync, print the handoff prompt:
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
## Ready for Development
|
|
345
|
+
|
|
346
|
+
PRD: `.planning/prds/{slug}.md`
|
|
347
|
+
Status: `.planning/status/{slug}.json`
|
|
348
|
+
Branch: `feat/{slug}`
|
|
349
|
+
Linear: {project URL}
|
|
350
|
+
|
|
351
|
+
**Next step:** Run `/forge:go` for one milestone at a time, or exit and run `npx forge run` to execute all milestones autonomously. The execution engine will:
|
|
352
|
+
- Read the PRD and per-PRD status file
|
|
353
|
+
- Spawn agent teams for each milestone
|
|
354
|
+
- Verify each change with forge verification gates
|
|
355
|
+
- Update status JSON and transition Linear issues automatically
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Note:** `/forge:go` now uses git worktrees for session isolation. Multiple users can run `/forge:go` on different milestones simultaneously without conflicts.
|
|
359
|
+
|
|
360
|
+
## Edge Cases
|
|
361
|
+
|
|
362
|
+
- **No Linear connection:** Warn the user. Still generate the PRD locally — skip the Linear sync steps.
|
|
363
|
+
- **Empty codebase:** The interview still works — questions will be more open-ended without scan context. Note this to the user.
|
|
364
|
+
- **User wants to spec a project not in Linear:** Allow it. Skip Step 1 project selection, ask for a project name, and create the Linear project in Step 5 before creating milestones.
|
|
365
|
+
- **User provides info upfront:** If the user includes project details in the same message as `/forge:spec`, use that info to pre-fill interview answers and skip questions that are already answered.
|
|
366
|
+
- **Very large codebase:** Scan agents may return truncated results. That's fine — the interview fills in gaps.
|
|
367
|
+
- **Interrupted interview:** If the user stops mid-interview, save what you have to the PRD draft. They can resume by running `/forge:spec` again and selecting the same project.
|