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.
Files changed (72) hide show
  1. package/README.md +454 -338
  2. package/dist/cli.js +194 -906
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config/loader.d.ts +1 -1
  5. package/dist/config/loader.js +49 -56
  6. package/dist/config/loader.js.map +1 -1
  7. package/dist/config/schema.d.ts +37 -125
  8. package/dist/config/schema.js +13 -28
  9. package/dist/config/schema.js.map +1 -1
  10. package/dist/doctor.d.ts +10 -0
  11. package/dist/doctor.js +148 -0
  12. package/dist/doctor.js.map +1 -0
  13. package/dist/gates/index.d.ts +14 -12
  14. package/dist/gates/index.js +53 -105
  15. package/dist/gates/index.js.map +1 -1
  16. package/dist/gates/lint-gate.d.ts +2 -2
  17. package/dist/gates/lint-gate.js +60 -66
  18. package/dist/gates/lint-gate.js.map +1 -1
  19. package/dist/gates/tests-gate.d.ts +2 -4
  20. package/dist/gates/tests-gate.js +75 -203
  21. package/dist/gates/tests-gate.js.map +1 -1
  22. package/dist/gates/types-gate.d.ts +2 -2
  23. package/dist/gates/types-gate.js +53 -59
  24. package/dist/gates/types-gate.js.map +1 -1
  25. package/dist/go/linear-sync-cli.js +13 -4
  26. package/dist/go/linear-sync-cli.js.map +1 -1
  27. package/dist/go/linear-sync.d.ts +1 -0
  28. package/dist/go/linear-sync.js +67 -4
  29. package/dist/go/linear-sync.js.map +1 -1
  30. package/dist/linear/client.d.ts +34 -105
  31. package/dist/linear/client.js +85 -365
  32. package/dist/linear/client.js.map +1 -1
  33. package/dist/linear/issues.d.ts +3 -1
  34. package/dist/linear/issues.js +14 -2
  35. package/dist/linear/issues.js.map +1 -1
  36. package/dist/linear/projects.js +3 -2
  37. package/dist/linear/projects.js.map +1 -1
  38. package/dist/linear/sync.d.ts +15 -0
  39. package/dist/linear/sync.js +102 -0
  40. package/dist/linear/sync.js.map +1 -0
  41. package/dist/runner/loop.d.ts +4 -0
  42. package/dist/runner/loop.js +168 -0
  43. package/dist/runner/loop.js.map +1 -0
  44. package/dist/runner/prompt.d.ts +14 -0
  45. package/dist/runner/prompt.js +59 -0
  46. package/dist/runner/prompt.js.map +1 -0
  47. package/dist/runner/update.d.ts +1 -0
  48. package/dist/runner/update.js +72 -0
  49. package/dist/runner/update.js.map +1 -0
  50. package/dist/server.d.ts +6 -2
  51. package/dist/server.js +43 -101
  52. package/dist/server.js.map +1 -1
  53. package/dist/setup.d.ts +5 -0
  54. package/dist/setup.js +208 -0
  55. package/dist/setup.js.map +1 -0
  56. package/dist/state/cache.d.ts +3 -0
  57. package/dist/state/cache.js +23 -0
  58. package/dist/state/cache.js.map +1 -0
  59. package/dist/state/status.d.ts +66 -0
  60. package/dist/state/status.js +96 -0
  61. package/dist/state/status.js.map +1 -0
  62. package/dist/types.d.ts +46 -114
  63. package/dist/worktree/manager.d.ts +6 -103
  64. package/dist/worktree/manager.js +25 -296
  65. package/dist/worktree/manager.js.map +1 -1
  66. package/hooks/pre-commit-verify.js +109 -109
  67. package/package.json +3 -2
  68. package/skills/forge-go.md +583 -575
  69. package/skills/forge-setup.md +149 -388
  70. package/skills/forge-spec.md +367 -342
  71. package/skills/forge-triage.md +179 -133
  72. package/skills/forge-update.md +87 -93
@@ -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. 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 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 Setupscaffold 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
-
38
- ### Step 3 — Configure Gates
39
-
40
- Ask the user which verification gates to enable. **AskUserQuestion supports max 4 options — use TWO questions to cover all 8 gates:**
41
-
42
- <AskUserQuestion>
43
- question: "Which core gates should be active? (Recommended: all four)"
44
- header: "Core gates"
45
- multiSelect: true
46
- options:
47
- - "types — TypeScript type checking (tsc --noEmit) (Recommended)"
48
- - "lint — ESLint / Biome linting (Recommended)"
49
- - "tests Vitest / Jest test runner (Recommended)"
50
- - "prd — PRD completeness check"
51
- </AskUserQuestion>
52
-
53
- <AskUserQuestion>
54
- question: "Enable any advanced gates? These require extra setup (Playwright, dev server, API access)."
55
- header: "Advanced gates"
56
- multiSelect: true
57
- options:
58
- - "visual Playwright screenshot regression (requires Playwright + Chromium)"
59
- - "runtime — Start the app and check for crashes (requires devServerUrl)"
60
- - "review AI code review (runs during forge verify)"
61
- - "codex — Codex PR review polling (runs after PR creation)"
62
- </AskUserQuestion>
63
-
64
- Combine selections from both questions into the final gates list.
65
-
66
- Also collect project metadata (skip in Refresh mode if `.forge.json` already has values):
67
-
68
- <AskUserQuestion>
69
- question: "Project name?"
70
- </AskUserQuestion>
71
-
72
- <AskUserQuestion>
73
- question: "Tech stack? (e.g., TypeScript, React, Node.js)"
74
- </AskUserQuestion>
75
-
76
- <AskUserQuestion>
77
- question: "One-line project description?"
78
- </AskUserQuestion>
79
-
80
- ### Step 3.5 Interactive Test Planning
81
-
82
- **Skip this step if "tests" was NOT selected in Step 3.**
83
-
84
- Run the test analysis engine on the project:
85
-
86
- ```typescript
87
- import { analyzeForTestPlanning } from 'forge-cc/src/test-scaffold/analyze';
88
- const analysis = await analyzeForTestPlanning(projectDir);
89
- ```
90
-
91
- Present findings to the user:
92
-
93
- ```
94
- ## Test Analysis
95
-
96
- **Framework detected:** {e.g., "Next.js App Router with Vitest"}
97
- **Coverage summary:** Found {N} source files, {M} test files
98
- ```
99
-
100
- For each category with untested files, ask:
101
-
102
- <AskUserQuestion>
103
- question: "Scaffold tests for {category description}? ({N} untested files)"
104
- options:
105
- - "Yes — scaffold test stubs for these files"
106
- - "No — skip this category"
107
- </AskUserQuestion>
108
-
109
- If the test runner was NOT already detected from `package.json`, ask:
110
-
111
- <AskUserQuestion>
112
- question: "Which test runner?"
113
- options:
114
- - "Vitest (Recommended)"
115
- - "Jest"
116
- </AskUserQuestion>
117
-
118
- Ask about structural tests:
119
-
120
- <AskUserQuestion>
121
- question: "Include structural tests? (circular import detection, file naming conventions)"
122
- options:
123
- - "Yes (Recommended)"
124
- - "No"
125
- </AskUserQuestion>
126
-
127
- Print a summary of what will be scaffolded:
128
-
129
- ```
130
- ## Test Scaffold Plan
131
-
132
- - Config file: {vitest.config.ts / jest.config.ts}
133
- - Package.json updates: test script, devDependencies
134
- - Test stubs: {count} across {categories}
135
- - Structural tests: {Yes / No}
136
- ```
137
-
138
- Store the scaffold plan for execution in Step 4. The testing config will be persisted to `.forge.json`.
139
-
140
- ### Step 4 — Create or Update Files
141
-
142
- Use the template functions from `forge-cc/src/setup/templates.ts` to generate file contents. **Always include `forgeVersion` in the SetupContext** — read it from forge-cc's own `package.json` (`node_modules/forge-cc/package.json` → `.version` field). This stamps the installed version into `.forge.json` so the version-check hook can detect when a refresh is needed after an update. The templates are:
143
-
144
- - `forgeConfigTemplate(ctx)` `.forge.json` (includes `forgeVersion`)
145
- - `claudeMdTemplate(ctx)` → `CLAUDE.md`
146
- - `lessonsMdTemplate(ctx)` → `tasks/lessons.md`
147
- - `gitignoreForgeLines()` lines to append to `.gitignore`
148
-
149
- **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.
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 2Run 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
+ ```