forge-cc 0.1.4 → 0.1.6
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 +96 -10
- package/dist/cli.js +225 -7
- package/dist/cli.js.map +1 -1
- package/dist/go/auto-chain.d.ts +37 -5
- package/dist/go/auto-chain.js +220 -81
- package/dist/go/auto-chain.js.map +1 -1
- package/dist/go/executor.d.ts +2 -0
- package/dist/go/executor.js.map +1 -1
- package/dist/hooks/pre-commit.js +9 -3
- package/dist/hooks/pre-commit.js.map +1 -1
- package/dist/reporter/human.d.ts +5 -0
- package/dist/reporter/human.js +30 -0
- package/dist/reporter/human.js.map +1 -1
- package/dist/setup/templates.js +97 -122
- package/dist/setup/templates.js.map +1 -1
- package/dist/spec/generator.d.ts +20 -0
- package/dist/spec/generator.js +23 -2
- package/dist/spec/generator.js.map +1 -1
- package/dist/spec/interview.d.ts +20 -2
- package/dist/spec/interview.js +8 -0
- package/dist/spec/interview.js.map +1 -1
- package/dist/spec/scanner.d.ts +34 -0
- package/dist/spec/scanner.js +93 -0
- package/dist/spec/scanner.js.map +1 -1
- package/dist/spec/templates.d.ts +22 -0
- package/dist/spec/templates.js +8 -0
- package/dist/spec/templates.js.map +1 -1
- package/dist/utils/platform.d.ts +29 -0
- package/dist/utils/platform.js +90 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/worktree/identity.d.ts +9 -0
- package/dist/worktree/identity.js +32 -0
- package/dist/worktree/identity.js.map +1 -0
- package/dist/worktree/manager.d.ts +70 -0
- package/dist/worktree/manager.js +217 -0
- package/dist/worktree/manager.js.map +1 -0
- package/dist/worktree/parallel.d.ts +87 -0
- package/dist/worktree/parallel.js +328 -0
- package/dist/worktree/parallel.js.map +1 -0
- package/dist/worktree/session.d.ts +64 -0
- package/dist/worktree/session.js +193 -0
- package/dist/worktree/session.js.map +1 -0
- package/dist/worktree/state-merge.d.ts +43 -0
- package/dist/worktree/state-merge.js +162 -0
- package/dist/worktree/state-merge.js.map +1 -0
- package/hooks/pre-commit-verify.js +9 -3
- package/hooks/version-check.js +78 -78
- package/package.json +1 -1
- package/skills/forge-go.md +39 -0
- package/skills/forge-setup.md +183 -157
- package/skills/forge-spec.md +50 -12
- package/skills/forge-update.md +92 -72
package/skills/forge-go.md
CHANGED
|
@@ -65,6 +65,12 @@ Verify the execution environment is ready:
|
|
|
65
65
|
|
|
66
66
|
> You have uncommitted changes. Commit or stash them before running /forge:go.
|
|
67
67
|
|
|
68
|
+
5. **Milestone size:** Count waves and agents in the milestone. If >3 waves or >6 total agents, warn:
|
|
69
|
+
|
|
70
|
+
> Warning: This milestone has {N} waves and {M} agents. Large milestones risk context overflow. Consider splitting before execution.
|
|
71
|
+
|
|
72
|
+
This is a pre-flight warning, not a hard abort — the user can choose to proceed. But the warning should be prominent so they can split the milestone first if needed.
|
|
73
|
+
|
|
68
74
|
Print the pre-flight summary:
|
|
69
75
|
|
|
70
76
|
```
|
|
@@ -78,6 +84,21 @@ Print the pre-flight summary:
|
|
|
78
84
|
Ready to execute Milestone 4.
|
|
79
85
|
```
|
|
80
86
|
|
|
87
|
+
### Step 2.5 — Session Isolation (Automatic)
|
|
88
|
+
|
|
89
|
+
The execution engine automatically creates a git worktree for isolated execution. This happens transparently — you don't need to manage it manually.
|
|
90
|
+
|
|
91
|
+
**What happens behind the scenes:**
|
|
92
|
+
1. A worktree is created at `../.forge-wt/<repo>/<session-id>/` based on the feature branch
|
|
93
|
+
2. A session is registered in `.forge/sessions.json`
|
|
94
|
+
3. All wave execution happens inside the worktree directory
|
|
95
|
+
4. After completion, changes are merged back to the feature branch
|
|
96
|
+
5. The worktree and session are cleaned up
|
|
97
|
+
|
|
98
|
+
**Why:** Multiple users or terminals can run `/forge:go` simultaneously without corrupting each other's work. Each session gets an isolated copy of the codebase.
|
|
99
|
+
|
|
100
|
+
**If worktree creation fails:** The engine falls back to running in the main working directory (original behavior). A warning is printed but execution continues.
|
|
101
|
+
|
|
81
102
|
### Step 3 — Execute Waves
|
|
82
103
|
|
|
83
104
|
Parse the milestone section from the PRD. Each milestone contains waves with agent definitions:
|
|
@@ -325,6 +346,23 @@ After each milestone completes (Step 5-7):
|
|
|
325
346
|
|
|
326
347
|
This prevents context rot — each milestone starts with clean context reading CLAUDE.md + STATE.md + current milestone section only (~20% of context window).
|
|
327
348
|
|
|
349
|
+
### Parallel Milestones (dependsOn)
|
|
350
|
+
|
|
351
|
+
When milestones specify `dependsOn` fields in the PRD, the scheduler can identify which milestones are independent and run them in parallel:
|
|
352
|
+
|
|
353
|
+
- Milestones with no `dependsOn` (or `dependsOn: []`) can run in the first wave
|
|
354
|
+
- Milestones that depend on completed milestones become ready as dependencies finish
|
|
355
|
+
- The scheduler builds a DAG and groups milestones into execution waves
|
|
356
|
+
|
|
357
|
+
Example PRD milestone with dependencies:
|
|
358
|
+
```
|
|
359
|
+
### Milestone 3: Integration Layer
|
|
360
|
+
**dependsOn:** 1, 2
|
|
361
|
+
**Goal:** Combine components from M1 and M2...
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
If no `dependsOn` fields are present, milestones execute sequentially (backward compatible).
|
|
365
|
+
|
|
328
366
|
### Step 9 — Linear Issue Start (On Milestone Begin)
|
|
329
367
|
|
|
330
368
|
At the START of milestone execution (between Step 2 and Step 3), if Linear is configured:
|
|
@@ -347,3 +385,4 @@ If Linear is not configured, skip silently.
|
|
|
347
385
|
> Milestone {N} has no wave definitions. Update the PRD with agent assignments before running /forge:go.
|
|
348
386
|
- **Already on correct milestone:** If STATE.md's current milestone matches the target, proceed normally (this is the expected case).
|
|
349
387
|
- **Linear auth fails:** Warn but continue execution. Linear sync is not blocking.
|
|
388
|
+
- **Worktree conflict:** If the worktree directory already exists (e.g., from a crashed session), the engine attempts `npx forge cleanup` first. If that fails, it falls back to main directory execution.
|
package/skills/forge-setup.md
CHANGED
|
@@ -1,157 +1,183 @@
|
|
|
1
|
-
# /forge:setup — Initialize or Refresh a Forge Project
|
|
2
|
-
|
|
3
|
-
Bootstrap a new project with forge-cc scaffolding, or refresh an existing project's forge files to the latest templates. Creates `.forge.json`, `CLAUDE.md`, planning docs, and installs hooks.
|
|
4
|
-
|
|
5
|
-
## Instructions
|
|
6
|
-
|
|
7
|
-
Follow these steps exactly. Do not skip confirmation.
|
|
8
|
-
|
|
9
|
-
### Step 1 — Detect Project
|
|
10
|
-
|
|
11
|
-
Check the current directory for existing forge files:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
ls .forge.json CLAUDE.md .planning/STATE.md .planning/ROADMAP.md tasks/lessons.md 2>/dev/null
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Determine which files exist. This determines whether this is a fresh setup or a refresh.
|
|
18
|
-
|
|
19
|
-
- **If `.forge.json` exists:** This is an existing forge project → default to Refresh mode
|
|
20
|
-
- **If `.forge.json` does not exist:** This is a new project → default to Fresh Setup mode
|
|
21
|
-
|
|
22
|
-
### Step 2 — Choose Setup Mode
|
|
23
|
-
|
|
24
|
-
Present the detected mode and ask the user to confirm or override:
|
|
25
|
-
|
|
26
|
-
<AskUserQuestion>
|
|
27
|
-
question: "Detected {existing/new} forge project. Which mode?"
|
|
28
|
-
options:
|
|
29
|
-
- "Fresh Setup — scaffold all forge files from scratch"
|
|
30
|
-
- "Refresh — update existing files to latest templates (preserves Learned Rules and lessons)"
|
|
31
|
-
</AskUserQuestion>
|
|
32
|
-
|
|
33
|
-
**Fresh Setup** will create all files, overwriting any that exist.
|
|
34
|
-
**Refresh** will update templates while preserving:
|
|
35
|
-
- `CLAUDE.md` → keeps `## Learned Rules` section content
|
|
36
|
-
- `tasks/lessons.md` → keeps all existing lessons
|
|
37
|
-
- `.planning/STATE.md` → keeps current state
|
|
38
|
-
- `.planning/ROADMAP.md` → keeps current roadmap
|
|
39
|
-
|
|
40
|
-
### Step 3 — Configure Gates
|
|
41
|
-
|
|
42
|
-
Ask the user which verification gates to enable:
|
|
43
|
-
|
|
44
|
-
<AskUserQuestion>
|
|
45
|
-
question: "Which verification gates should be active?"
|
|
46
|
-
multiSelect: true
|
|
47
|
-
options:
|
|
48
|
-
- "types — TypeScript type checking (tsc --noEmit)"
|
|
49
|
-
- "lint — ESLint / Biome linting"
|
|
50
|
-
- "tests — Vitest / Jest test runner"
|
|
51
|
-
- "visual — Playwright screenshot regression"
|
|
52
|
-
- "runtime — Start the app and check for crashes"
|
|
53
|
-
- "prd — PRD completeness check"
|
|
54
|
-
</AskUserQuestion>
|
|
55
|
-
|
|
56
|
-
Default recommendation: `types`, `lint`, `tests`.
|
|
57
|
-
|
|
58
|
-
Also collect project metadata (skip in Refresh mode if `.forge.json` already has values):
|
|
59
|
-
|
|
60
|
-
<AskUserQuestion>
|
|
61
|
-
question: "Project name?"
|
|
62
|
-
</AskUserQuestion>
|
|
63
|
-
|
|
64
|
-
<AskUserQuestion>
|
|
65
|
-
question: "Tech stack? (e.g., TypeScript, React, Node.js)"
|
|
66
|
-
</AskUserQuestion>
|
|
67
|
-
|
|
68
|
-
<AskUserQuestion>
|
|
69
|
-
question: "One-line project description?"
|
|
70
|
-
</AskUserQuestion>
|
|
71
|
-
|
|
72
|
-
### Step 4 — Create or Update Files
|
|
73
|
-
|
|
74
|
-
Use the template functions from `forge-cc/src/setup/templates.ts` to generate file contents. The templates are:
|
|
75
|
-
|
|
76
|
-
- `forgeConfigTemplate(ctx)` → `.forge.json`
|
|
77
|
-
- `claudeMdTemplate(ctx)` → `CLAUDE.md`
|
|
78
|
-
- `stateMdTemplate(ctx)` → `.planning/STATE.md`
|
|
79
|
-
- `roadmapMdTemplate(ctx)` → `.planning/ROADMAP.md`
|
|
80
|
-
- `lessonsMdTemplate(ctx)` → `tasks/lessons.md`
|
|
81
|
-
- `gitignoreForgeLines()` → lines to append to `.gitignore`
|
|
82
|
-
|
|
83
|
-
**Fresh Setup mode:** Create all files. Create directories `.planning/` and `tasks/` if they don't exist. Append forge lines to `.gitignore` if not already present.
|
|
84
|
-
|
|
85
|
-
**Refresh mode:** Only overwrite `.forge.json` and the structural parts of `CLAUDE.md` (everything except `## Learned Rules`). Do NOT touch `STATE.md`, `ROADMAP.md`, or `lessons.md`.
|
|
86
|
-
|
|
87
|
-
Write the actual files using the Write tool. Do not just print them.
|
|
88
|
-
|
|
89
|
-
### Step 5 — Patch Global Config
|
|
90
|
-
|
|
91
|
-
Check if `~/.claude/CLAUDE.md` exists:
|
|
92
|
-
|
|
93
|
-
- **If it does not exist:** Create it using `globalClaudeMdTemplate()` from the templates.
|
|
94
|
-
- **If it exists:** Leave it alone. Do not overwrite the user's global config.
|
|
95
|
-
|
|
96
|
-
### Step 6 — Install
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
```bash
|
|
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
|
-
|
|
1
|
+
# /forge:setup — Initialize or Refresh a Forge Project
|
|
2
|
+
|
|
3
|
+
Bootstrap a new project with forge-cc scaffolding, or refresh an existing project's forge files to the latest templates. Creates `.forge.json`, `CLAUDE.md`, planning docs, and installs hooks.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Follow these steps exactly. Do not skip confirmation.
|
|
8
|
+
|
|
9
|
+
### Step 1 — Detect Project
|
|
10
|
+
|
|
11
|
+
Check the current directory for existing forge files:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
ls .forge.json CLAUDE.md .planning/STATE.md .planning/ROADMAP.md tasks/lessons.md 2>/dev/null
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Determine which files exist. This determines whether this is a fresh setup or a refresh.
|
|
18
|
+
|
|
19
|
+
- **If `.forge.json` exists:** This is an existing forge project → default to Refresh mode
|
|
20
|
+
- **If `.forge.json` does not exist:** This is a new project → default to Fresh Setup mode
|
|
21
|
+
|
|
22
|
+
### Step 2 — Choose Setup Mode
|
|
23
|
+
|
|
24
|
+
Present the detected mode and ask the user to confirm or override:
|
|
25
|
+
|
|
26
|
+
<AskUserQuestion>
|
|
27
|
+
question: "Detected {existing/new} forge project. Which mode?"
|
|
28
|
+
options:
|
|
29
|
+
- "Fresh Setup — scaffold all forge files from scratch"
|
|
30
|
+
- "Refresh — update existing files to latest templates (preserves Learned Rules and lessons)"
|
|
31
|
+
</AskUserQuestion>
|
|
32
|
+
|
|
33
|
+
**Fresh Setup** will create all files, overwriting any that exist.
|
|
34
|
+
**Refresh** will update templates while preserving:
|
|
35
|
+
- `CLAUDE.md` → keeps `## Learned Rules` section content
|
|
36
|
+
- `tasks/lessons.md` → keeps all existing lessons
|
|
37
|
+
- `.planning/STATE.md` → keeps current state
|
|
38
|
+
- `.planning/ROADMAP.md` → keeps current roadmap
|
|
39
|
+
|
|
40
|
+
### Step 3 — Configure Gates
|
|
41
|
+
|
|
42
|
+
Ask the user which verification gates to enable:
|
|
43
|
+
|
|
44
|
+
<AskUserQuestion>
|
|
45
|
+
question: "Which verification gates should be active?"
|
|
46
|
+
multiSelect: true
|
|
47
|
+
options:
|
|
48
|
+
- "types — TypeScript type checking (tsc --noEmit)"
|
|
49
|
+
- "lint — ESLint / Biome linting"
|
|
50
|
+
- "tests — Vitest / Jest test runner"
|
|
51
|
+
- "visual — Playwright screenshot regression"
|
|
52
|
+
- "runtime — Start the app and check for crashes"
|
|
53
|
+
- "prd — PRD completeness check"
|
|
54
|
+
</AskUserQuestion>
|
|
55
|
+
|
|
56
|
+
Default recommendation: `types`, `lint`, `tests`.
|
|
57
|
+
|
|
58
|
+
Also collect project metadata (skip in Refresh mode if `.forge.json` already has values):
|
|
59
|
+
|
|
60
|
+
<AskUserQuestion>
|
|
61
|
+
question: "Project name?"
|
|
62
|
+
</AskUserQuestion>
|
|
63
|
+
|
|
64
|
+
<AskUserQuestion>
|
|
65
|
+
question: "Tech stack? (e.g., TypeScript, React, Node.js)"
|
|
66
|
+
</AskUserQuestion>
|
|
67
|
+
|
|
68
|
+
<AskUserQuestion>
|
|
69
|
+
question: "One-line project description?"
|
|
70
|
+
</AskUserQuestion>
|
|
71
|
+
|
|
72
|
+
### Step 4 — Create or Update Files
|
|
73
|
+
|
|
74
|
+
Use the template functions from `forge-cc/src/setup/templates.ts` to generate file contents. The templates are:
|
|
75
|
+
|
|
76
|
+
- `forgeConfigTemplate(ctx)` → `.forge.json`
|
|
77
|
+
- `claudeMdTemplate(ctx)` → `CLAUDE.md`
|
|
78
|
+
- `stateMdTemplate(ctx)` → `.planning/STATE.md`
|
|
79
|
+
- `roadmapMdTemplate(ctx)` → `.planning/ROADMAP.md`
|
|
80
|
+
- `lessonsMdTemplate(ctx)` → `tasks/lessons.md`
|
|
81
|
+
- `gitignoreForgeLines()` → lines to append to `.gitignore`
|
|
82
|
+
|
|
83
|
+
**Fresh Setup mode:** Create all files. Create directories `.planning/` and `tasks/` if they don't exist. Append forge lines to `.gitignore` if not already present.
|
|
84
|
+
|
|
85
|
+
**Refresh mode:** Only overwrite `.forge.json` and the structural parts of `CLAUDE.md` (everything except `## Learned Rules`). Do NOT touch `STATE.md`, `ROADMAP.md`, or `lessons.md`.
|
|
86
|
+
|
|
87
|
+
Write the actual files using the Write tool. Do not just print them.
|
|
88
|
+
|
|
89
|
+
### Step 5 — Patch Global Config
|
|
90
|
+
|
|
91
|
+
Check if `~/.claude/CLAUDE.md` exists:
|
|
92
|
+
|
|
93
|
+
- **If it does not exist:** Create it using `globalClaudeMdTemplate()` from the templates.
|
|
94
|
+
- **If it exists:** Leave it alone. Do not overwrite the user's global config.
|
|
95
|
+
|
|
96
|
+
### Step 6 — Install Skills
|
|
97
|
+
|
|
98
|
+
Copy all forge skills to `~/.claude/commands/forge/` so they're discoverable via `/forge:*`:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
mkdir -p ~/.claude/commands/forge
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Find the installed forge-cc package and copy skill files, stripping the `forge-` prefix:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
SKILLS_DIR="$(dirname "$(which forge)")/../lib/node_modules/forge-cc/skills"
|
|
108
|
+
# Fallback: check local node_modules
|
|
109
|
+
if [ ! -d "$SKILLS_DIR" ]; then
|
|
110
|
+
SKILLS_DIR="node_modules/forge-cc/skills"
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
for f in "$SKILLS_DIR"/forge-*.md; do
|
|
114
|
+
name=$(basename "$f" | sed 's/^forge-//')
|
|
115
|
+
cp "$f" ~/.claude/commands/forge/"$name"
|
|
116
|
+
done
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Print: "Installed forge skills to ~/.claude/commands/forge/"
|
|
120
|
+
|
|
121
|
+
### Step 7 — Install Hooks
|
|
122
|
+
|
|
123
|
+
Check if the user has a `.claude/settings.json` or `.claude/settings.local.json` in the project:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
ls .claude/settings.json .claude/settings.local.json 2>/dev/null
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
If no settings file exists, create `.claude/settings.local.json` with the version-check hook:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"hooks": {
|
|
134
|
+
"PreToolUse": [
|
|
135
|
+
{
|
|
136
|
+
"matcher": "Task",
|
|
137
|
+
"hooks": [
|
|
138
|
+
{
|
|
139
|
+
"type": "command",
|
|
140
|
+
"command": "node node_modules/forge-cc/hooks/version-check.js"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
If a settings file already exists, inform the user:
|
|
150
|
+
|
|
151
|
+
> Settings file already exists. To add the version-check hook manually, add this to your hooks config:
|
|
152
|
+
> `"command": "node node_modules/forge-cc/hooks/version-check.js"`
|
|
153
|
+
|
|
154
|
+
### Step 8 — Summary
|
|
155
|
+
|
|
156
|
+
Print a summary of everything that was created or updated:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
## Forge Setup Complete
|
|
160
|
+
|
|
161
|
+
**Mode:** {Fresh Setup / Refresh}
|
|
162
|
+
**Project:** {projectName}
|
|
163
|
+
**Gates:** {comma-separated list}
|
|
164
|
+
|
|
165
|
+
### Files Created/Updated
|
|
166
|
+
- ~/.claude/commands/forge/*.md ✓ (skills)
|
|
167
|
+
- .forge.json ✓
|
|
168
|
+
- CLAUDE.md ✓
|
|
169
|
+
- .planning/STATE.md ✓
|
|
170
|
+
- .planning/ROADMAP.md ✓
|
|
171
|
+
- tasks/lessons.md ✓
|
|
172
|
+
- .gitignore (forge lines) ✓
|
|
173
|
+
- .claude/settings.local.json ✓ (version-check hook)
|
|
174
|
+
|
|
175
|
+
### Next Steps
|
|
176
|
+
1. Review the generated `CLAUDE.md` and customize the Code Map section
|
|
177
|
+
2. Run `npx forge verify` to test your gate configuration
|
|
178
|
+
3. Run `/forge:spec` to create a PRD for your first feature
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
Do NOT commit or push. The user decides when to commit the scaffolded files.
|
package/skills/forge-spec.md
CHANGED
|
@@ -83,12 +83,31 @@ Conduct an adaptive interview using the interview engine logic from `src/spec/in
|
|
|
83
83
|
4. **Scope** — what's out, sacred files, boundaries
|
|
84
84
|
5. **Milestones** — phasing, dependencies, delivery chunks
|
|
85
85
|
|
|
86
|
+
**Milestone Sizing Constraint (Hard Rule):**
|
|
87
|
+
|
|
88
|
+
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.
|
|
89
|
+
|
|
90
|
+
**Milestone Dependencies (dependsOn):**
|
|
91
|
+
|
|
92
|
+
During the milestones phase of the interview, ask about milestone dependencies using AskUserQuestion. For each milestone after the first, ask:
|
|
93
|
+
|
|
94
|
+
- question: "Does Milestone {N} depend on any previous milestones?"
|
|
95
|
+
- options:
|
|
96
|
+
- "No dependencies — can start immediately"
|
|
97
|
+
- "Depends on Milestone {N-1} (sequential)"
|
|
98
|
+
- "Depends on specific milestones (I'll specify)"
|
|
99
|
+
|
|
100
|
+
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).
|
|
101
|
+
|
|
102
|
+
Independent milestones enable parallel execution via `/forge:go`, which creates separate worktrees for each parallel milestone.
|
|
103
|
+
|
|
86
104
|
**Interview Rules:**
|
|
87
105
|
|
|
88
|
-
- **
|
|
89
|
-
- **
|
|
90
|
-
- **
|
|
91
|
-
- **
|
|
106
|
+
- **NEVER present questions as numbered text — always use AskUserQuestion with 2-4 options per question.** Every interview question MUST be delivered via Claude Code's AskUserQuestion tool with structured multiple-choice options. Do not print numbered lists of questions for the user to answer in free text.
|
|
107
|
+
- **Lead with recommendations.** Every question includes context from the codebase scan as the question text. Never ask a blank "what do you want to build?" question.
|
|
108
|
+
- **Ask 1 question at a time via AskUserQuestion.** Each question gets its own AskUserQuestion call with 2-4 predefined options derived from codebase scan context and common patterns. Always include a final option like "Other (I'll describe)" to allow the user to provide a custom answer.
|
|
109
|
+
- **Follow interesting threads.** If the user's selection mentions migration, breaking changes, multiple user types, or external integrations, follow up with targeted AskUserQuestion calls.
|
|
110
|
+
- **Show progress.** After each answer round, show a compact status as text output:
|
|
92
111
|
|
|
93
112
|
```
|
|
94
113
|
Progress: [##---] Problem & Goals (2/2) | User Stories (0/2) | Technical (0/1) | Scope (0/1) | Milestones (0/1)
|
|
@@ -101,22 +120,35 @@ Progress: [##---] Problem & Goals (2/2) | User Stories (0/2) | Technical (0/1) |
|
|
|
101
120
|
- **Stop when complete.** When all sections have enough info (Problem 2+, Users 2+, Technical 1+, Scope 1+, Milestones 1+), move to Step 4. Don't drag the interview out.
|
|
102
121
|
- **Allow early exit.** If the user says "that's enough", "skip", or "generate it", respect that and move to Step 4 with what you have.
|
|
103
122
|
|
|
104
|
-
**Question Format:**
|
|
123
|
+
**Question Format (AskUserQuestion):**
|
|
124
|
+
|
|
125
|
+
Each interview question MUST use AskUserQuestion. Build the question text from codebase scan context and the section being asked about. Provide 2-4 options that reflect likely answers based on the scan results, plus a free-text escape hatch. Example:
|
|
105
126
|
|
|
106
127
|
```
|
|
107
|
-
|
|
128
|
+
AskUserQuestion:
|
|
129
|
+
question: "[Section] Context from scan or previous answers. Question text here?"
|
|
130
|
+
options:
|
|
131
|
+
- "Option A — a likely answer based on scan findings"
|
|
132
|
+
- "Option B — another plausible direction"
|
|
133
|
+
- "Option C — a third possibility (if applicable)"
|
|
134
|
+
- "Other (I'll describe)"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
If the user selects "Other (I'll describe)", prompt them for a free-text answer using a follow-up AskUserQuestion or accept their typed response.
|
|
108
138
|
|
|
109
|
-
|
|
139
|
+
**Do NOT do this (anti-pattern):**
|
|
110
140
|
|
|
111
|
-
|
|
112
|
-
|
|
141
|
+
```
|
|
142
|
+
### Round N
|
|
113
143
|
|
|
114
|
-
|
|
115
|
-
|
|
144
|
+
1. **[Section]** Question text?
|
|
145
|
+
2. **[Section]** Question text?
|
|
116
146
|
|
|
117
|
-
> Answer by number
|
|
147
|
+
> Answer by number...
|
|
118
148
|
```
|
|
119
149
|
|
|
150
|
+
This numbered-text format is explicitly prohibited. Always use AskUserQuestion.
|
|
151
|
+
|
|
120
152
|
### Step 4 — Generate PRD
|
|
121
153
|
|
|
122
154
|
Using all gathered interview answers and codebase scan results, generate the final PRD. Use the generator module at `src/spec/generator.ts`:
|
|
@@ -154,9 +186,13 @@ The PRD should follow this structure:
|
|
|
154
186
|
- [ ] Issue title — brief description
|
|
155
187
|
|
|
156
188
|
### Milestone 2: {Name}
|
|
189
|
+
**dependsOn:** 1
|
|
190
|
+
**Goal:** {What this delivers}
|
|
157
191
|
...
|
|
158
192
|
```
|
|
159
193
|
|
|
194
|
+
**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.
|
|
195
|
+
|
|
160
196
|
Write the final PRD to `.planning/prds/{project-slug}.md`. Tell the user:
|
|
161
197
|
|
|
162
198
|
> Final PRD written to `.planning/prds/{slug}.md`.
|
|
@@ -241,6 +277,8 @@ Linear: {project URL}
|
|
|
241
277
|
- Open PRs and transition issues automatically
|
|
242
278
|
```
|
|
243
279
|
|
|
280
|
+
**Note:** `/forge:go` now uses git worktrees for session isolation. Multiple users can run `/forge:go` on different milestones simultaneously without conflicts.
|
|
281
|
+
|
|
244
282
|
## Edge Cases
|
|
245
283
|
|
|
246
284
|
- **No Linear connection:** Warn the user. Still generate the PRD locally — skip the Linear sync steps.
|