forge-cc 0.1.16 → 0.1.18
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.
|
@@ -36,8 +36,7 @@ function parseImports(filePath: string): string[] {
|
|
|
36
36
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
37
37
|
const importRegex = /(?:import|export)\\s.*?from\\s+["'](.+?)["']/g;
|
|
38
38
|
const imports: string[] = [];
|
|
39
|
-
|
|
40
|
-
while ((match = importRegex.exec(content)) !== null) {
|
|
39
|
+
for (const match of content.matchAll(importRegex)) {
|
|
41
40
|
const specifier = match[1];
|
|
42
41
|
// Only resolve relative imports
|
|
43
42
|
if (!specifier.startsWith(".")) continue;
|
|
@@ -193,8 +192,7 @@ function parseExports(filePath: string): string[] {
|
|
|
193
192
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
194
193
|
const exportRegex = /export\\s.*?from\\s+["'](.+?)["']/g;
|
|
195
194
|
const exports: string[] = [];
|
|
196
|
-
|
|
197
|
-
while ((match = exportRegex.exec(content)) !== null) {
|
|
195
|
+
for (const match of content.matchAll(exportRegex)) {
|
|
198
196
|
exports.push(match[1]);
|
|
199
197
|
}
|
|
200
198
|
return exports;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structural-templates.js","sourceRoot":"","sources":["../../src/setup/structural-templates.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,2EAA2E;AAC3E,qDAAqD;AAYrD,8EAA8E;AAC9E,gCAAgC;AAChC,8EAA8E;AAE9E,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IACtD,OAAO;;;;;;;;;;qBAUY,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"structural-templates.js","sourceRoot":"","sources":["../../src/setup/structural-templates.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,2EAA2E;AAC3E,qDAAqD;AAYrD,8EAA8E;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D,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC;KACvC,CAAC,CAAC;IAEH,mEAAmE;IACnE,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,GAAG,OAAO,uCAAuC;YACvD,OAAO,EAAE,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC;SACxD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -54,7 +54,7 @@ export function nextjsApiRouteTemplate(sourcePath) {
|
|
|
54
54
|
const moduleName = extractModuleName(sourcePath);
|
|
55
55
|
const testPath = deriveTestPath(sourcePath);
|
|
56
56
|
const importPath = computeRelativeImport(testPath, sourcePath);
|
|
57
|
-
return `import { describe, it, expect
|
|
57
|
+
return `import { describe, it, expect } from "vitest";
|
|
58
58
|
import { NextRequest } from "next/server";
|
|
59
59
|
|
|
60
60
|
// TODO: Update imports to match the actual exports from the source module
|
package/package.json
CHANGED
package/skills/forge-setup.md
CHANGED
|
@@ -244,7 +244,77 @@ The target hook entry is:
|
|
|
244
244
|
|
|
245
245
|
Create the `.claude/` directory if it doesn't exist (`mkdir -p .claude`).
|
|
246
246
|
|
|
247
|
-
### Step 9 —
|
|
247
|
+
### Step 9 — Run Verification
|
|
248
|
+
|
|
249
|
+
Run `npx forge verify` to confirm all gates pass with the scaffolded files:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
npx forge verify
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
If any gate fails, fix the issues before proceeding. Common fixes:
|
|
256
|
+
- **lint:** Run the project's lint autofix (e.g., `npx biome check --fix .`)
|
|
257
|
+
- **tests:** Convert failing stub tests to `it.todo('description')` so they show as pending
|
|
258
|
+
- **types:** Fix any type errors introduced by scaffolding
|
|
259
|
+
|
|
260
|
+
Re-run `npx forge verify` until all gates pass.
|
|
261
|
+
|
|
262
|
+
### Step 10 — Commit, PR, and Codex Review
|
|
263
|
+
|
|
264
|
+
Once all gates pass, automatically create a branch, commit, open a PR, and poll for Codex review.
|
|
265
|
+
|
|
266
|
+
**Create branch and commit:**
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
git checkout -b feat/forge-setup
|
|
270
|
+
git add -A
|
|
271
|
+
git commit -m "feat: initialize forge workflow scaffolding
|
|
272
|
+
|
|
273
|
+
- .forge.json config with gate selection
|
|
274
|
+
- CLAUDE.md project instructions
|
|
275
|
+
- .planning/ directory with STATE.md and ROADMAP.md
|
|
276
|
+
- Test stubs and structural tests (if enabled)
|
|
277
|
+
- Version-check hook in .claude/settings.local.json
|
|
278
|
+
|
|
279
|
+
Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
280
|
+
git push -u origin feat/forge-setup
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Important:** Before `git add -A`, check `git diff --stat` for CRLF-only noise on unrelated files. If any files show changes but have zero content diff, discard them with `git checkout -- <file>` before staging.
|
|
284
|
+
|
|
285
|
+
**Open PR:**
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
gh pr create --title "feat: initialize forge workflow" --body "$(cat <<'EOF'
|
|
289
|
+
## Summary
|
|
290
|
+
- Scaffold forge verification gates, planning docs, and test infrastructure
|
|
291
|
+
- Gates configured: {comma-separated list}
|
|
292
|
+
- Test stubs: {N} it.todo() stubs as pending backlog + {N} structural tests passing
|
|
293
|
+
|
|
294
|
+
## Test plan
|
|
295
|
+
- [x] `npx forge verify` passes all gates
|
|
296
|
+
- [x] `npx tsc --noEmit` clean
|
|
297
|
+
- [ ] Codex review (auto-polling)
|
|
298
|
+
EOF
|
|
299
|
+
)"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Codex Review Gate:**
|
|
303
|
+
|
|
304
|
+
After `gh pr create` succeeds, poll for Codex review comments:
|
|
305
|
+
|
|
306
|
+
1. **Poll loop:** Every 60 seconds, check for new PR review comments:
|
|
307
|
+
```bash
|
|
308
|
+
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
2. **Duration:** Poll for up to 8 minutes (8 checks at 60-second intervals).
|
|
312
|
+
|
|
313
|
+
3. **If comments found:** For each unresolved comment, address it — either fix the code or reply with justification. Push fixes and re-poll.
|
|
314
|
+
|
|
315
|
+
4. **Timeout:** If no comments appear after 8 minutes, proceed — Codex may not be configured for this repository.
|
|
316
|
+
|
|
317
|
+
### Step 11 — Summary
|
|
248
318
|
|
|
249
319
|
Print a summary of everything that was created or updated:
|
|
250
320
|
|
|
@@ -254,6 +324,7 @@ Print a summary of everything that was created or updated:
|
|
|
254
324
|
**Mode:** {Fresh Setup / Refresh}
|
|
255
325
|
**Project:** {projectName}
|
|
256
326
|
**Gates:** {comma-separated list}
|
|
327
|
+
**PR:** {PR URL}
|
|
257
328
|
|
|
258
329
|
### Files Created/Updated
|
|
259
330
|
- ~/.claude/commands/forge/*.md ✓ (skills)
|
|
@@ -269,12 +340,11 @@ Print a summary of everything that was created or updated:
|
|
|
269
340
|
{If tests gate enabled: "Test planning: {N} test stubs scaffolded, {runner} configured, structural tests {included/skipped}"}
|
|
270
341
|
{If tests gate not enabled: "Test planning: skipped (tests gate not enabled)"}
|
|
271
342
|
|
|
343
|
+
### Verification
|
|
344
|
+
- All gates passed ✓
|
|
345
|
+
- Codex review: {resolved N comments / no comments / not configured}
|
|
346
|
+
|
|
272
347
|
### Next Steps
|
|
273
348
|
1. Review the generated `CLAUDE.md` and customize the Code Map section
|
|
274
|
-
2. Run
|
|
275
|
-
3. Run `/forge:spec` to create a PRD for your first feature
|
|
349
|
+
2. Run `/forge:spec` to create a PRD for your first feature
|
|
276
350
|
```
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
Do NOT commit or push. The user decides when to commit the scaffolded files.
|