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-setup.md
CHANGED
|
@@ -1,388 +1,149 @@
|
|
|
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.
|
|
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
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
Print a summary
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
##
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
**Refresh mode:** Only overwrite `.forge.json` and the structural parts of `CLAUDE.md` (everything except `## Learned Rules`). Do NOT touch `lessons.md`.
|
|
152
|
-
|
|
153
|
-
Write the actual files using the Write tool. Do not just print them.
|
|
154
|
-
|
|
155
|
-
**If a test scaffold plan exists from Step 3.5**, also execute it now:
|
|
156
|
-
- Write the test runner config file (`vitest.config.ts` or `jest.config.ts`)
|
|
157
|
-
- Write test stub files for each selected category
|
|
158
|
-
- Write structural test files if selected
|
|
159
|
-
- Update `package.json` with test script and devDependencies
|
|
160
|
-
- Persist the `testing` section to `.forge.json`
|
|
161
|
-
|
|
162
|
-
**Cleanup deprecated files (both modes):** Check if `.planning/STATE.md` or `.planning/ROADMAP.md` exist. These are deprecated (replaced by per-PRD status JSON) and waste tokens every session. If either exists, ask the user:
|
|
163
|
-
|
|
164
|
-
<AskUserQuestion>
|
|
165
|
-
question: "Found deprecated .planning/STATE.md and/or ROADMAP.md. These are no longer used — how should we handle them?"
|
|
166
|
-
header: "Deprecated files"
|
|
167
|
-
options:
|
|
168
|
-
- "Archive — move to .planning/archive/ (Recommended)"
|
|
169
|
-
- "Delete — remove them permanently"
|
|
170
|
-
- "Keep — leave them as-is"
|
|
171
|
-
</AskUserQuestion>
|
|
172
|
-
|
|
173
|
-
- **Archive:** `mkdir -p .planning/archive && mv .planning/STATE.md .planning/ROADMAP.md .planning/archive/ 2>/dev/null`
|
|
174
|
-
- **Delete:** `rm -f .planning/STATE.md .planning/ROADMAP.md`
|
|
175
|
-
- **Keep:** Do nothing (warn: "These files will burn tokens on startup if any CLAUDE.md still references them.")
|
|
176
|
-
|
|
177
|
-
### Step 5 — Patch Global Config
|
|
178
|
-
|
|
179
|
-
Check if `~/.claude/CLAUDE.md` exists:
|
|
180
|
-
|
|
181
|
-
- **If it does not exist:** Create it using `globalClaudeMdTemplate()` from the templates.
|
|
182
|
-
- **If it exists:** Leave it alone. Do not overwrite the user's global config.
|
|
183
|
-
|
|
184
|
-
### Step 6 — Install Skills
|
|
185
|
-
|
|
186
|
-
Copy all forge skills to `~/.claude/commands/forge/` so they're discoverable via `/forge:*`:
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
mkdir -p ~/.claude/commands/forge
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Find the installed forge-cc package and copy skill files, stripping the `forge-` prefix:
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
SKILLS_DIR="$(dirname "$(which forge)")/../lib/node_modules/forge-cc/skills"
|
|
196
|
-
# Fallback: check local node_modules
|
|
197
|
-
if [ ! -d "$SKILLS_DIR" ]; then
|
|
198
|
-
SKILLS_DIR="node_modules/forge-cc/skills"
|
|
199
|
-
fi
|
|
200
|
-
|
|
201
|
-
for f in "$SKILLS_DIR"/forge-*.md; do
|
|
202
|
-
name=$(basename "$f" | sed 's/^forge-//')
|
|
203
|
-
cp "$f" ~/.claude/commands/forge/"$name"
|
|
204
|
-
done
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
Print: "Installed forge skills to ~/.claude/commands/forge/"
|
|
208
|
-
|
|
209
|
-
### Step 7 — Environment Health Check
|
|
210
|
-
|
|
211
|
-
Run `forge doctor` to check for missing optional dependencies:
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
forge doctor
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
Review the output. If Playwright or Chromium is missing, ask the user:
|
|
218
|
-
|
|
219
|
-
<AskUserQuestion>
|
|
220
|
-
question: "Playwright enables visual regression + runtime testing but is not installed. Install now?"
|
|
221
|
-
options:
|
|
222
|
-
- "Yes — run npm install -g playwright && npx playwright install chromium"
|
|
223
|
-
- "No — skip for now (visual and runtime gates will be unavailable)"
|
|
224
|
-
</AskUserQuestion>
|
|
225
|
-
|
|
226
|
-
If yes, run the install commands:
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
npm install -g playwright && npx playwright install chromium
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
If the install succeeds, confirm: "Playwright + Chromium installed successfully."
|
|
233
|
-
If it fails, print the error and continue — this is not a blocker for setup.
|
|
234
|
-
|
|
235
|
-
If `forge doctor` shows all checks passing, print: "Environment checks passed." and continue.
|
|
236
|
-
|
|
237
|
-
### Step 8 — Install Hooks
|
|
238
|
-
|
|
239
|
-
The version-check hook **must always be installed**. Read the existing settings file (if any), merge the hook in, and write it back.
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
cat .claude/settings.local.json 2>/dev/null || echo "{}"
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
The target hook entry is:
|
|
246
|
-
|
|
247
|
-
```json
|
|
248
|
-
{
|
|
249
|
-
"matcher": "Task",
|
|
250
|
-
"hooks": [
|
|
251
|
-
{
|
|
252
|
-
"type": "command",
|
|
253
|
-
"command": "node node_modules/forge-cc/hooks/version-check.js"
|
|
254
|
-
}
|
|
255
|
-
]
|
|
256
|
-
}
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
**Merge logic — follow ALL 5 steps. Do NOT overwrite the file; you MUST read-merge-write to preserve existing user settings:**
|
|
260
|
-
|
|
261
|
-
1. Parse the existing file (or start with `{}`). **Use the Read tool first** — never write without reading.
|
|
262
|
-
2. Ensure `hooks.PreToolUse` exists as an array. If the key is missing, create it. If it exists, preserve all existing entries.
|
|
263
|
-
3. Check if any entry in `hooks.PreToolUse` already has a hook with `command` containing `version-check.js`. **If found, skip — already installed. Do not duplicate it.**
|
|
264
|
-
4. If NOT found, append the hook entry to `hooks.PreToolUse`. Do not replace existing entries.
|
|
265
|
-
5. Write the merged result back to `.claude/settings.local.json`, preserving ALL existing settings (permissions, other hooks, custom keys).
|
|
266
|
-
|
|
267
|
-
Create the `.claude/` directory if it doesn't exist (`mkdir -p .claude`).
|
|
268
|
-
|
|
269
|
-
### Step 9 — Run Verification
|
|
270
|
-
|
|
271
|
-
**Only verify setup-safe gates.** Several gates structurally cannot pass during setup because their prerequisites don't exist yet:
|
|
272
|
-
|
|
273
|
-
| Gate | Why it's deferred |
|
|
274
|
-
|------|-------------------|
|
|
275
|
-
| `prd` | No PRD file exists until `/forge:spec` runs |
|
|
276
|
-
| `visual` | Dev server may not be running; Playwright timeouts expected |
|
|
277
|
-
| `runtime` | Dev server may not be running |
|
|
278
|
-
| `codex` | Post-PR only — runs in Step 10 after PR creation |
|
|
279
|
-
|
|
280
|
-
**Setup-safe gates:** `types`, `lint`, `tests`, `review`
|
|
281
|
-
|
|
282
|
-
Build the `--gate` flag from the user's selected gates, keeping **only** the setup-safe ones:
|
|
283
|
-
|
|
284
|
-
```bash
|
|
285
|
-
npx forge verify --gate types,lint,tests,review
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
(Include only gates the user selected that are in the setup-safe set. If the user only selected `types` and `lint`, run `--gate types,lint`.)
|
|
289
|
-
|
|
290
|
-
**CRITICAL: NEVER remove a gate from `.forge.json` to make verification pass.** The `.forge.json` gates list is the user's full desired configuration for development. Deferred gates will be verified later during `/forge:go` and post-PR steps.
|
|
291
|
-
|
|
292
|
-
If any setup-safe gate fails, fix the issue before proceeding. Common fixes:
|
|
293
|
-
- **lint:** Run the project's lint autofix (e.g., `npx biome check --fix .`)
|
|
294
|
-
- **tests:** Convert failing stub tests to `it.todo('description')` so they show as pending
|
|
295
|
-
- **types:** Fix any type errors introduced by scaffolding
|
|
296
|
-
|
|
297
|
-
Re-run the setup-safe gates until they pass.
|
|
298
|
-
|
|
299
|
-
### Step 10 — Commit, PR, and Codex Review
|
|
300
|
-
|
|
301
|
-
Once all gates pass, automatically create a branch, commit, open a PR, and poll for Codex review.
|
|
302
|
-
|
|
303
|
-
**Create branch and commit:**
|
|
304
|
-
|
|
305
|
-
**IMPORTANT — CRLF check is mandatory before staging.** Run `git diff --stat` first. If any files show changes but have zero meaningful content diff (CRLF-only / whitespace-only noise on unrelated files), discard them with `git checkout -- <file>` BEFORE running `git add`. Skipping this check causes unrelated files to be included in the commit.
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
git checkout -b feat/forge-setup
|
|
309
|
-
git diff --stat # Check for CRLF noise — discard any whitespace-only changes on unrelated files
|
|
310
|
-
git add -A
|
|
311
|
-
git commit -m "feat: initialize forge workflow scaffolding
|
|
312
|
-
|
|
313
|
-
- .forge.json config with gate selection
|
|
314
|
-
- CLAUDE.md project instructions
|
|
315
|
-
- .planning/ directory for PRD status tracking
|
|
316
|
-
- Test stubs and structural tests (if enabled)
|
|
317
|
-
- Version-check hook in .claude/settings.local.json
|
|
318
|
-
|
|
319
|
-
Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
320
|
-
git push -u origin feat/forge-setup
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
**Open PR:**
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
gh pr create --title "feat: initialize forge workflow" --body "$(cat <<'EOF'
|
|
327
|
-
## Summary
|
|
328
|
-
- Scaffold forge verification gates, planning docs, and test infrastructure
|
|
329
|
-
- Gates configured: {comma-separated list}
|
|
330
|
-
- Test stubs: {N} it.todo() stubs as pending backlog + {N} structural tests passing
|
|
331
|
-
|
|
332
|
-
## Test plan
|
|
333
|
-
- [x] `npx forge verify` passes all gates
|
|
334
|
-
- [x] `npx tsc --noEmit` clean
|
|
335
|
-
- [ ] Codex review (auto-polling)
|
|
336
|
-
EOF
|
|
337
|
-
)"
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
**Codex Review Gate:**
|
|
341
|
-
|
|
342
|
-
After `gh pr create` succeeds, poll for Codex review comments:
|
|
343
|
-
|
|
344
|
-
1. **Poll loop:** Every 60 seconds, check for new PR review comments:
|
|
345
|
-
```bash
|
|
346
|
-
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
2. **Duration:** Poll for up to 8 minutes (8 checks at 60-second intervals).
|
|
350
|
-
|
|
351
|
-
3. **If comments found:** For each unresolved comment, address it — either fix the code or reply with justification. Push fixes and re-poll.
|
|
352
|
-
|
|
353
|
-
4. **Timeout:** If no comments appear after 8 minutes, proceed — Codex may not be configured for this repository.
|
|
354
|
-
|
|
355
|
-
**IMPORTANT:** Do NOT merge the PR automatically. Merging is a hard-to-reverse action that requires explicit user confirmation. Always stop here and let the user decide when to merge.
|
|
356
|
-
|
|
357
|
-
### Step 11 — Summary
|
|
358
|
-
|
|
359
|
-
Print a summary of everything that was created or updated:
|
|
360
|
-
|
|
361
|
-
```
|
|
362
|
-
## Forge Setup Complete
|
|
363
|
-
|
|
364
|
-
**Mode:** {Fresh Setup / Refresh}
|
|
365
|
-
**Project:** {projectName}
|
|
366
|
-
**Gates:** {comma-separated list}
|
|
367
|
-
**PR:** {PR URL}
|
|
368
|
-
|
|
369
|
-
### Files Created/Updated
|
|
370
|
-
- ~/.claude/commands/forge/*.md ✓ (skills)
|
|
371
|
-
- .forge.json ✓
|
|
372
|
-
- CLAUDE.md ✓
|
|
373
|
-
- tasks/lessons.md ✓
|
|
374
|
-
- .gitignore (forge lines) ✓
|
|
375
|
-
- .claude/settings.local.json ✓ (version-check hook)
|
|
376
|
-
|
|
377
|
-
### Test Planning
|
|
378
|
-
{If tests gate enabled: "Test planning: {N} test stubs scaffolded, {runner} configured, structural tests {included/skipped}"}
|
|
379
|
-
{If tests gate not enabled: "Test planning: skipped (tests gate not enabled)"}
|
|
380
|
-
|
|
381
|
-
### Verification
|
|
382
|
-
- All gates passed ✓
|
|
383
|
-
- Codex review: {resolved N comments / no comments / not configured}
|
|
384
|
-
|
|
385
|
-
### Next Steps
|
|
386
|
-
1. Review the generated `CLAUDE.md` and customize the Code Map section
|
|
387
|
-
2. Run `/forge:spec` to create a PRD for your first feature
|
|
388
|
-
```
|
|
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. The `forge setup` CLI handles all file operations; this skill handles the conversation layer.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Follow these steps exactly. Do not skip confirmation.
|
|
8
|
+
|
|
9
|
+
### Step 1 — Detect Project State
|
|
10
|
+
|
|
11
|
+
Check the current directory for existing forge files:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
ls .forge.json CLAUDE.md 2>/dev/null
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- **If `.forge.json` exists:** This is an existing forge project (Refresh mode)
|
|
18
|
+
- **If `.forge.json` does not exist:** This is a new project (Fresh Setup mode)
|
|
19
|
+
|
|
20
|
+
Present the detected mode:
|
|
21
|
+
|
|
22
|
+
<AskUserQuestion>
|
|
23
|
+
question: "Detected {existing/new} forge project. Which mode?"
|
|
24
|
+
options:
|
|
25
|
+
- "Fresh Setup — scaffold all forge files from scratch"
|
|
26
|
+
- "Refresh — update existing files to latest templates (preserves Learned Rules and lessons)"
|
|
27
|
+
</AskUserQuestion>
|
|
28
|
+
|
|
29
|
+
### Step 2 — Run Setup CLI
|
|
30
|
+
|
|
31
|
+
Run the forge setup CLI, which handles:
|
|
32
|
+
- Generating `.forge.json` with auto-detected gates
|
|
33
|
+
- Installing skill files to `~/.claude/commands/forge/`
|
|
34
|
+
- Installing pre-commit hook
|
|
35
|
+
- Appending forge section to CLAUDE.md
|
|
36
|
+
- Validating Linear connection
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx forge setup
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Review the output. If `.forge.json` was created, read it and show the auto-detected configuration to the user.
|
|
43
|
+
|
|
44
|
+
### Step 3 — Interactive Configuration
|
|
45
|
+
|
|
46
|
+
If this is a Fresh Setup (or the user wants to reconfigure), ask about gate selection:
|
|
47
|
+
|
|
48
|
+
<AskUserQuestion>
|
|
49
|
+
question: "Which gates should be active? (Recommended: all three)"
|
|
50
|
+
header: "Gates"
|
|
51
|
+
multiSelect: true
|
|
52
|
+
options:
|
|
53
|
+
- "types — TypeScript type checking (tsc --noEmit) (Recommended)"
|
|
54
|
+
- "lint — Biome linting (Recommended)"
|
|
55
|
+
- "tests — Vitest / Jest test runner (Recommended)"
|
|
56
|
+
</AskUserQuestion>
|
|
57
|
+
|
|
58
|
+
If the user's selections differ from the auto-detected gates in `.forge.json`, update the `gates` array in `.forge.json` to match their choices.
|
|
59
|
+
|
|
60
|
+
For Refresh mode, skip gate selection unless the user explicitly wants to change gates.
|
|
61
|
+
|
|
62
|
+
### Step 4 — Environment Health Check
|
|
63
|
+
|
|
64
|
+
Run the doctor CLI to check for missing dependencies:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx forge doctor
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Review the output. If any checks show errors, help the user resolve them.
|
|
71
|
+
|
|
72
|
+
### Step 5 — Verification
|
|
73
|
+
|
|
74
|
+
Run verification to confirm everything works:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npx forge verify
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**CRITICAL: NEVER remove a gate from `.forge.json` to make verification pass.** Deferred gates will be verified later during `/forge:go`.
|
|
81
|
+
|
|
82
|
+
If any gate fails, fix the issue before proceeding.
|
|
83
|
+
|
|
84
|
+
### Step 6 — Commit, PR, and Review
|
|
85
|
+
|
|
86
|
+
Once all gates pass, create a branch, commit, and open a PR:
|
|
87
|
+
|
|
88
|
+
**IMPORTANT — CRLF check is mandatory before staging.** Run `git diff --stat` first. If any files show whitespace-only changes on unrelated files, discard them with `git checkout -- <file>` BEFORE staging.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git checkout -b feat/forge-setup
|
|
92
|
+
git diff --stat
|
|
93
|
+
git add .forge.json CLAUDE.md .forge/ .claude/ tasks/
|
|
94
|
+
git commit -m "feat: initialize forge workflow scaffolding
|
|
95
|
+
|
|
96
|
+
- .forge.json config with gate selection
|
|
97
|
+
- CLAUDE.md project instructions
|
|
98
|
+
- Pre-commit hook
|
|
99
|
+
- Version-check hook
|
|
100
|
+
|
|
101
|
+
Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
102
|
+
git push -u origin feat/forge-setup
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Open PR:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
gh pr create --title "feat: initialize forge workflow" --body "$(cat <<'EOF'
|
|
109
|
+
## Summary
|
|
110
|
+
- Scaffold forge verification gates, planning docs, and hook infrastructure
|
|
111
|
+
- Gates configured: {comma-separated list}
|
|
112
|
+
|
|
113
|
+
## Test plan
|
|
114
|
+
- [x] `npx forge verify` passes all setup-safe gates
|
|
115
|
+
- [x] `npx forge doctor` all checks pass
|
|
116
|
+
- [ ] Codex review (auto-polling)
|
|
117
|
+
EOF
|
|
118
|
+
)"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If the `codex` gate is enabled, poll for Codex review comments (up to 8 minutes, 60-second intervals). Address any comments found.
|
|
122
|
+
|
|
123
|
+
**IMPORTANT:** Do NOT merge the PR automatically. Let the user decide when to merge.
|
|
124
|
+
|
|
125
|
+
### Step 7 — Summary
|
|
126
|
+
|
|
127
|
+
Print a summary:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
## Forge Setup Complete
|
|
131
|
+
|
|
132
|
+
**Mode:** {Fresh Setup / Refresh}
|
|
133
|
+
**Gates:** {comma-separated list}
|
|
134
|
+
**PR:** {PR URL}
|
|
135
|
+
|
|
136
|
+
### Files Created/Updated
|
|
137
|
+
- .forge.json
|
|
138
|
+
- CLAUDE.md (forge section)
|
|
139
|
+
- .forge/hooks/pre-commit-verify.js
|
|
140
|
+
- ~/.claude/commands/forge/*.md (skills)
|
|
141
|
+
|
|
142
|
+
### Verification
|
|
143
|
+
- Setup-safe gates passed
|
|
144
|
+
- Doctor checks: {pass/issues found}
|
|
145
|
+
|
|
146
|
+
### Next Steps
|
|
147
|
+
1. Review the generated `CLAUDE.md` and customize as needed
|
|
148
|
+
2. Run `/forge:spec` to create a PRD for your first feature
|
|
149
|
+
```
|