forge-cc 1.0.0 → 1.0.2
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/dist/cli.js +7 -1
- package/dist/cli.js.map +1 -1
- package/package.json +3 -2
- package/dist/gates/codex-gate.d.ts +0 -51
- package/dist/gates/codex-gate.js +0 -121
- package/dist/gates/codex-gate.js.map +0 -1
- package/dist/gates/prd-gate.d.ts +0 -7
- package/dist/gates/prd-gate.js +0 -193
- package/dist/gates/prd-gate.js.map +0 -1
- package/dist/gates/remediation.d.ts +0 -46
- package/dist/gates/remediation.js +0 -423
- package/dist/gates/remediation.js.map +0 -1
- package/dist/gates/review-gate.d.ts +0 -16
- package/dist/gates/review-gate.js +0 -479
- package/dist/gates/review-gate.js.map +0 -1
- package/dist/gates/runtime-gate.d.ts +0 -5
- package/dist/gates/runtime-gate.js +0 -99
- package/dist/gates/runtime-gate.js.map +0 -1
- package/dist/gates/test-analysis.d.ts +0 -21
- package/dist/gates/test-analysis.js +0 -394
- package/dist/gates/test-analysis.js.map +0 -1
- package/dist/gates/visual-capture.d.ts +0 -24
- package/dist/gates/visual-capture.js +0 -144
- package/dist/gates/visual-capture.js.map +0 -1
- package/dist/gates/visual-gate.d.ts +0 -18
- package/dist/gates/visual-gate.js +0 -234
- package/dist/gates/visual-gate.js.map +0 -1
- package/dist/gates/visual-reviewer.d.ts +0 -11
- package/dist/gates/visual-reviewer.js +0 -211
- package/dist/gates/visual-reviewer.js.map +0 -1
- package/dist/go/auto-chain.d.ts +0 -136
- package/dist/go/auto-chain.js +0 -389
- package/dist/go/auto-chain.js.map +0 -1
- package/dist/go/executor.d.ts +0 -137
- package/dist/go/executor.js +0 -447
- package/dist/go/executor.js.map +0 -1
- package/dist/go/finalize.d.ts +0 -108
- package/dist/go/finalize.js +0 -331
- package/dist/go/finalize.js.map +0 -1
- package/dist/go/linear-sync-cli.d.ts +0 -55
- package/dist/go/linear-sync-cli.js +0 -192
- package/dist/go/linear-sync-cli.js.map +0 -1
- package/dist/go/linear-sync.d.ts +0 -112
- package/dist/go/linear-sync.js +0 -375
- package/dist/go/linear-sync.js.map +0 -1
- package/dist/go/prd-queue.d.ts +0 -43
- package/dist/go/prd-queue.js +0 -67
- package/dist/go/prd-queue.js.map +0 -1
- package/dist/go/prd-selector.d.ts +0 -57
- package/dist/go/prd-selector.js +0 -101
- package/dist/go/prd-selector.js.map +0 -1
- package/dist/go/verify-loop.d.ts +0 -64
- package/dist/go/verify-loop.js +0 -327
- package/dist/go/verify-loop.js.map +0 -1
- package/dist/hooks/pre-commit.d.ts +0 -5
- package/dist/hooks/pre-commit.js +0 -75
- package/dist/hooks/pre-commit.js.map +0 -1
- package/dist/linear/issues.d.ts +0 -22
- package/dist/linear/issues.js +0 -51
- package/dist/linear/issues.js.map +0 -1
- package/dist/linear/milestones.d.ts +0 -11
- package/dist/linear/milestones.js +0 -32
- package/dist/linear/milestones.js.map +0 -1
- package/dist/linear/projects.d.ts +0 -16
- package/dist/linear/projects.js +0 -51
- package/dist/linear/projects.js.map +0 -1
- package/dist/reporter/human.d.ts +0 -7
- package/dist/reporter/human.js +0 -93
- package/dist/reporter/human.js.map +0 -1
- package/dist/reporter/json.d.ts +0 -2
- package/dist/reporter/json.js +0 -4
- package/dist/reporter/json.js.map +0 -1
- package/dist/setup/structural-templates.d.ts +0 -12
- package/dist/setup/structural-templates.js +0 -288
- package/dist/setup/structural-templates.js.map +0 -1
- package/dist/setup/templates.d.ts +0 -17
- package/dist/setup/templates.js +0 -109
- package/dist/setup/templates.js.map +0 -1
- package/dist/setup/test-planner.d.ts +0 -38
- package/dist/setup/test-planner.js +0 -91
- package/dist/setup/test-planner.js.map +0 -1
- package/dist/setup/test-scaffold.d.ts +0 -31
- package/dist/setup/test-scaffold.js +0 -209
- package/dist/setup/test-scaffold.js.map +0 -1
- package/dist/setup/test-templates.d.ts +0 -37
- package/dist/setup/test-templates.js +0 -313
- package/dist/setup/test-templates.js.map +0 -1
- package/dist/spec/generator.d.ts +0 -34
- package/dist/spec/generator.js +0 -227
- package/dist/spec/generator.js.map +0 -1
- package/dist/spec/interview.d.ts +0 -142
- package/dist/spec/interview.js +0 -287
- package/dist/spec/interview.js.map +0 -1
- package/dist/spec/linear-sync.d.ts +0 -48
- package/dist/spec/linear-sync.js +0 -125
- package/dist/spec/linear-sync.js.map +0 -1
- package/dist/spec/scanner.d.ts +0 -79
- package/dist/spec/scanner.js +0 -566
- package/dist/spec/scanner.js.map +0 -1
- package/dist/spec/templates.d.ts +0 -375
- package/dist/spec/templates.js +0 -95
- package/dist/spec/templates.js.map +0 -1
- package/dist/state/prd-status.d.ts +0 -62
- package/dist/state/prd-status.js +0 -122
- package/dist/state/prd-status.js.map +0 -1
- package/dist/state/reader.d.ts +0 -7
- package/dist/state/reader.js +0 -43
- package/dist/state/reader.js.map +0 -1
- package/dist/state/writer.d.ts +0 -21
- package/dist/state/writer.js +0 -106
- package/dist/state/writer.js.map +0 -1
- package/dist/team/consensus.d.ts +0 -28
- package/dist/team/consensus.js +0 -130
- package/dist/team/consensus.js.map +0 -1
- package/dist/team/index.d.ts +0 -4
- package/dist/team/index.js +0 -5
- package/dist/team/index.js.map +0 -1
- package/dist/team/lifecycle.d.ts +0 -37
- package/dist/team/lifecycle.js +0 -92
- package/dist/team/lifecycle.js.map +0 -1
- package/dist/team/reviewer.d.ts +0 -10
- package/dist/team/reviewer.js +0 -345
- package/dist/team/reviewer.js.map +0 -1
- package/dist/team/types.d.ts +0 -269
- package/dist/team/types.js +0 -70
- package/dist/team/types.js.map +0 -1
- package/dist/utils/browser.d.ts +0 -10
- package/dist/utils/browser.js +0 -96
- package/dist/utils/browser.js.map +0 -1
- package/dist/utils/platform.d.ts +0 -29
- package/dist/utils/platform.js +0 -90
- package/dist/utils/platform.js.map +0 -1
- package/dist/worktree/identity.d.ts +0 -9
- package/dist/worktree/identity.js +0 -32
- package/dist/worktree/identity.js.map +0 -1
- package/dist/worktree/parallel.d.ts +0 -87
- package/dist/worktree/parallel.js +0 -328
- package/dist/worktree/parallel.js.map +0 -1
- package/dist/worktree/session.d.ts +0 -67
- package/dist/worktree/session.js +0 -194
- package/dist/worktree/session.js.map +0 -1
- package/dist/worktree/state-merge.d.ts +0 -43
- package/dist/worktree/state-merge.js +0 -162
- package/dist/worktree/state-merge.js.map +0 -1
package/dist/setup/templates.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
// ── Setup Templates ─────────────────────────────────────────────────
|
|
2
|
-
// String template functions used by /forge:setup to scaffold project files.
|
|
3
|
-
// ── .forge.json ─────────────────────────────────────────────────────
|
|
4
|
-
export function forgeConfigTemplate(ctx) {
|
|
5
|
-
const config = {
|
|
6
|
-
gates: ctx.gates,
|
|
7
|
-
maxIterations: 5,
|
|
8
|
-
};
|
|
9
|
-
if (ctx.appDir) {
|
|
10
|
-
config.appDir = ctx.appDir;
|
|
11
|
-
}
|
|
12
|
-
if (ctx.testing) {
|
|
13
|
-
config.testing = ctx.testing;
|
|
14
|
-
}
|
|
15
|
-
if (ctx.forgeVersion) {
|
|
16
|
-
config.forgeVersion = ctx.forgeVersion;
|
|
17
|
-
}
|
|
18
|
-
return JSON.stringify(config, null, 2) + "\n";
|
|
19
|
-
}
|
|
20
|
-
// ── Project CLAUDE.md ───────────────────────────────────────────────
|
|
21
|
-
export function claudeMdTemplate(ctx) {
|
|
22
|
-
const gatesList = ctx.gates.map((g) => `\`${g}\``).join(", ");
|
|
23
|
-
return `# ${ctx.projectName} — Claude Code Instructions
|
|
24
|
-
|
|
25
|
-
## What This Is
|
|
26
|
-
${ctx.description}
|
|
27
|
-
|
|
28
|
-
**Tech:** ${ctx.techStack}
|
|
29
|
-
|
|
30
|
-
## Quick Reference
|
|
31
|
-
|
|
32
|
-
| Action | Command |
|
|
33
|
-
|--------|---------|
|
|
34
|
-
| Run verification | \`npx forge verify\` |
|
|
35
|
-
| Run specific gates | \`npx forge verify --gate ${ctx.gates.join(",")}\` |
|
|
36
|
-
| Check status | \`npx forge status\` |
|
|
37
|
-
| Build | \`npm run build\` |
|
|
38
|
-
| Test | \`npm test\` |
|
|
39
|
-
|
|
40
|
-
## Code Map
|
|
41
|
-
|
|
42
|
-
\`\`\`
|
|
43
|
-
src/
|
|
44
|
-
(add your project structure here)
|
|
45
|
-
\`\`\`
|
|
46
|
-
|
|
47
|
-
## Key Docs
|
|
48
|
-
|
|
49
|
-
| File | Purpose |
|
|
50
|
-
|------|---------|
|
|
51
|
-
| \`.planning/status/<slug>.json\` | Per-PRD milestone status |
|
|
52
|
-
| \`tasks/lessons.md\` | Lessons learned (max 10 active) |
|
|
53
|
-
|
|
54
|
-
## Session Protocol
|
|
55
|
-
- **On start:** Read CLAUDE.md → .planning/status/*.json → tasks/lessons.md
|
|
56
|
-
- **When lost:** Re-read planning docs, don't guess from stale context
|
|
57
|
-
|
|
58
|
-
## Session Protocol END (Mandatory)
|
|
59
|
-
1. \`.planning/status/<slug>.json\` — update milestone status
|
|
60
|
-
2. \`tasks/lessons.md\` — add/refine lessons (max 10, promote when full)
|
|
61
|
-
3. Commit doc updates to the feature branch
|
|
62
|
-
|
|
63
|
-
## Execution Rules
|
|
64
|
-
- **Plan before building.** Read the PRD before touching code.
|
|
65
|
-
- **Verify everything.** Run \`npx forge verify\` after changes land.
|
|
66
|
-
- **All changes via PR.** Never commit directly to main.
|
|
67
|
-
- **Branch naming:** \`feat/short-description\` or \`fix/short-description\`
|
|
68
|
-
|
|
69
|
-
## Verification Gates
|
|
70
|
-
Active gates: ${gatesList}
|
|
71
|
-
|
|
72
|
-
## Learned Rules
|
|
73
|
-
(none yet)
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
// ── tasks/lessons.md ────────────────────────────────────────────────
|
|
77
|
-
export function lessonsMdTemplate(ctx) {
|
|
78
|
-
return `# Lessons Learned — ${ctx.projectName}
|
|
79
|
-
|
|
80
|
-
<!-- Max 10 active one-liners. Format: - **[topic]** The rule -->
|
|
81
|
-
<!-- When full, promote the most battle-tested to CLAUDE.md ## Learned Rules -->
|
|
82
|
-
|
|
83
|
-
(none yet)
|
|
84
|
-
`;
|
|
85
|
-
}
|
|
86
|
-
// ── ~/.claude/CLAUDE.md (global, for fresh installs) ────────────────
|
|
87
|
-
export function globalClaudeMdTemplate() {
|
|
88
|
-
return `# Global Claude Code Instructions
|
|
89
|
-
|
|
90
|
-
## How to Work
|
|
91
|
-
- **Follow instructions exactly.** Skills, CLAUDE.md rules, and workflow steps are tested — execute every step as written, including all AskUserQuestion prompts.
|
|
92
|
-
- **Default to action.** Don't ask for confirmation. Plan internally, execute, verify.
|
|
93
|
-
- **Iterate on failure.** Fix what breaks. Only stop to ask when truly blocked on missing credentials, ambiguous business requirements, or destructive actions on shared infrastructure.
|
|
94
|
-
- **Use agent teams** for non-trivial work (3+ files or 3+ steps).
|
|
95
|
-
|
|
96
|
-
## Verification
|
|
97
|
-
- Never mark complete without proving it works.
|
|
98
|
-
- Build and tests must pass. Run them.
|
|
99
|
-
|
|
100
|
-
## Principles
|
|
101
|
-
- Simple changes only. Find root causes. Touch only what's necessary.
|
|
102
|
-
`;
|
|
103
|
-
}
|
|
104
|
-
// ── .gitignore lines ────────────────────────────────────────────────
|
|
105
|
-
export function gitignoreForgeLines() {
|
|
106
|
-
return `.forge/
|
|
107
|
-
`;
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/setup/templates.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,4EAA4E;AAgB5E,uEAAuE;AAEvE,MAAM,UAAU,mBAAmB,CAAC,GAAiB;IACnD,MAAM,MAAM,GAA4B;QACtC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,aAAa,EAAE,CAAC;KACjB,CAAC;IACF,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAChB,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC/B,CAAC;IACD,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;QACrB,MAAM,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IACzC,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;AAChD,CAAC;AAED,uEAAuE;AAEvE,MAAM,UAAU,gBAAgB,CAAC,GAAiB;IAChD,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE9D,OAAO,KAAK,GAAG,CAAC,WAAW;;;EAG3B,GAAG,CAAC,WAAW;;YAEL,GAAG,CAAC,SAAS;;;;;;;mDAO0B,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAmCtD,SAAS;;;;CAIxB,CAAC;AACF,CAAC;AAED,uEAAuE;AAEvE,MAAM,UAAU,iBAAiB,CAAC,GAAiB;IACjD,OAAO,uBAAuB,GAAG,CAAC,WAAW;;;;;;CAM9C,CAAC;AACF,CAAC;AAED,uEAAuE;AAEvE,MAAM,UAAU,sBAAsB;IACpC,OAAO;;;;;;;;;;;;;;CAcR,CAAC;AACF,CAAC;AAED,uEAAuE;AAEvE,MAAM,UAAU,mBAAmB;IACjC,OAAO;CACR,CAAC;AACF,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { TestAnalysisReport } from "../gates/test-analysis.js";
|
|
2
|
-
import type { TestingConfig } from "../types.js";
|
|
3
|
-
import type { ScaffoldPlan } from "./test-scaffold.js";
|
|
4
|
-
export interface TestPlanningData {
|
|
5
|
-
/** The test analysis report from scanning the project */
|
|
6
|
-
report: TestAnalysisReport;
|
|
7
|
-
/** Human-readable summary of findings */
|
|
8
|
-
summary: string;
|
|
9
|
-
/** Per-category summaries for user confirmation prompts */
|
|
10
|
-
categorySummaries: CategorySummary[];
|
|
11
|
-
}
|
|
12
|
-
export interface CategorySummary {
|
|
13
|
-
name: string;
|
|
14
|
-
sourceCount: number;
|
|
15
|
-
testCount: number;
|
|
16
|
-
untestedCount: number;
|
|
17
|
-
description: string;
|
|
18
|
-
}
|
|
19
|
-
export interface TestPlannerResult {
|
|
20
|
-
/** The test analysis report from scanning the project */
|
|
21
|
-
report: TestAnalysisReport;
|
|
22
|
-
/** Categories the user confirmed for test scaffolding */
|
|
23
|
-
confirmedCategories: string[];
|
|
24
|
-
/** The chosen test runner */
|
|
25
|
-
runner: "vitest" | "jest";
|
|
26
|
-
/** The test directory */
|
|
27
|
-
testDir: string;
|
|
28
|
-
/** Whether structural tests are included */
|
|
29
|
-
structural: boolean;
|
|
30
|
-
/** The generated testing config to persist to .forge.json */
|
|
31
|
-
testingConfig: TestingConfig;
|
|
32
|
-
/** The scaffold plan (ready to execute) */
|
|
33
|
-
scaffoldPlan: ScaffoldPlan;
|
|
34
|
-
}
|
|
35
|
-
/** Analyze the project and prepare the test planning data. */
|
|
36
|
-
export declare function analyzeForTestPlanning(projectDir: string): Promise<TestPlanningData>;
|
|
37
|
-
/** Build the final plan + config after user confirms categories. */
|
|
38
|
-
export declare function buildTestPlan(report: TestAnalysisReport, confirmedCategories: string[], runner: "vitest" | "jest", testDir: string, structural: boolean, projectDir: string): Promise<TestPlannerResult>;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// ── Test Planner ────────────────────────────────────────────────────
|
|
2
|
-
// Interactive test planning module for /forge:setup integration.
|
|
3
|
-
// Analyzes project test coverage, then builds a scaffold plan + config
|
|
4
|
-
// from user-confirmed categories.
|
|
5
|
-
import { analyzeTestCoverage } from "../gates/test-analysis.js";
|
|
6
|
-
import { buildScaffoldPlan } from "./test-scaffold.js";
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
// Category Description Helpers
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
function describeCategoryName(name) {
|
|
11
|
-
switch (name) {
|
|
12
|
-
case "api-routes":
|
|
13
|
-
return "API routes and endpoint handlers";
|
|
14
|
-
case "components":
|
|
15
|
-
return "UI components (React/TSX)";
|
|
16
|
-
case "utils":
|
|
17
|
-
return "Utility functions and helpers";
|
|
18
|
-
case "middleware":
|
|
19
|
-
return "Middleware and interceptors";
|
|
20
|
-
case "models":
|
|
21
|
-
return "Data models, schemas, and entities";
|
|
22
|
-
case "other":
|
|
23
|
-
return "Other source files";
|
|
24
|
-
default:
|
|
25
|
-
return name;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
// Analysis Phase
|
|
30
|
-
// ---------------------------------------------------------------------------
|
|
31
|
-
/** Analyze the project and prepare the test planning data. */
|
|
32
|
-
export async function analyzeForTestPlanning(projectDir) {
|
|
33
|
-
const report = await analyzeTestCoverage(projectDir);
|
|
34
|
-
const categorySummaries = report.categories.map((cat) => ({
|
|
35
|
-
name: cat.name,
|
|
36
|
-
sourceCount: cat.sourceFiles.length,
|
|
37
|
-
testCount: cat.testFiles.length,
|
|
38
|
-
untestedCount: cat.untestedFiles.length,
|
|
39
|
-
description: describeCategoryName(cat.name),
|
|
40
|
-
}));
|
|
41
|
-
const lines = [];
|
|
42
|
-
lines.push(`Framework: ${report.framework.appFramework}`);
|
|
43
|
-
lines.push(`Test runner: ${report.framework.testRunner}`);
|
|
44
|
-
lines.push(`Coverage: ${report.coverage.testFiles} test files / ${report.coverage.sourceFiles} source files (ratio: ${report.coverage.ratio})`);
|
|
45
|
-
if (report.framework.detectedPatterns.length > 0) {
|
|
46
|
-
lines.push(`Detected: ${report.framework.detectedPatterns.join(", ")}`);
|
|
47
|
-
}
|
|
48
|
-
if (categorySummaries.length > 0) {
|
|
49
|
-
lines.push("");
|
|
50
|
-
lines.push("Categories:");
|
|
51
|
-
for (const cat of categorySummaries) {
|
|
52
|
-
lines.push(` - ${cat.name}: ${cat.sourceCount} source, ${cat.testCount} tested, ${cat.untestedCount} untested`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
report,
|
|
57
|
-
summary: lines.join("\n"),
|
|
58
|
-
categorySummaries,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
// ---------------------------------------------------------------------------
|
|
62
|
-
// Plan Building Phase
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
/** Build the final plan + config after user confirms categories. */
|
|
65
|
-
export async function buildTestPlan(report, confirmedCategories, runner, testDir, structural, projectDir) {
|
|
66
|
-
const scaffoldPlan = await buildScaffoldPlan(report, {
|
|
67
|
-
projectDir,
|
|
68
|
-
testDir,
|
|
69
|
-
runner,
|
|
70
|
-
structural,
|
|
71
|
-
categories: confirmedCategories,
|
|
72
|
-
});
|
|
73
|
-
const testingConfig = {
|
|
74
|
-
enforce: true,
|
|
75
|
-
runner,
|
|
76
|
-
testDir,
|
|
77
|
-
sourceDir: "src",
|
|
78
|
-
structural,
|
|
79
|
-
categories: confirmedCategories,
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
report,
|
|
83
|
-
confirmedCategories,
|
|
84
|
-
runner,
|
|
85
|
-
testDir,
|
|
86
|
-
structural,
|
|
87
|
-
testingConfig,
|
|
88
|
-
scaffoldPlan,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=test-planner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-planner.js","sourceRoot":"","sources":["../../src/setup/test-planner.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,iEAAiE;AACjE,uEAAuE;AACvE,kCAAkC;AAIlC,OAAO,EAAE,mBAAmB,EAAE,MAAM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E,IAAI;QACb,MAAM;QACN,OAAO;QACP,SAAS,EAAE,KAAK;QAChB,UAAU;QACV,UAAU,EAAE,mBAAmB;KAChC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,mBAAmB;QACnB,MAAM;QACN,OAAO;QACP,UAAU;QACV,aAAa;QACb,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { TestAnalysisReport } from "../gates/test-analysis.js";
|
|
2
|
-
export interface ScaffoldPlan {
|
|
3
|
-
configFile: {
|
|
4
|
-
path: string;
|
|
5
|
-
content: string;
|
|
6
|
-
} | null;
|
|
7
|
-
packageJsonUpdates: {
|
|
8
|
-
scripts?: Record<string, string>;
|
|
9
|
-
devDependencies?: Record<string, string>;
|
|
10
|
-
};
|
|
11
|
-
testFiles: Array<{
|
|
12
|
-
path: string;
|
|
13
|
-
content: string;
|
|
14
|
-
}>;
|
|
15
|
-
structuralTests: Array<{
|
|
16
|
-
path: string;
|
|
17
|
-
content: string;
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
export interface ScaffoldOptions {
|
|
21
|
-
projectDir: string;
|
|
22
|
-
testDir?: string;
|
|
23
|
-
runner?: "vitest" | "jest";
|
|
24
|
-
structural?: boolean;
|
|
25
|
-
categories?: string[];
|
|
26
|
-
entryPoints?: string[];
|
|
27
|
-
}
|
|
28
|
-
export declare function buildScaffoldPlan(report: TestAnalysisReport, options: ScaffoldOptions): Promise<ScaffoldPlan>;
|
|
29
|
-
export declare function executeScaffoldPlan(plan: ScaffoldPlan, projectDir: string): Promise<{
|
|
30
|
-
filesWritten: string[];
|
|
31
|
-
}>;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
// ── Test Scaffold Engine ────────────────────────────────────────────
|
|
2
|
-
// Orchestrator that takes a TestAnalysisReport + options and produces
|
|
3
|
-
// a ScaffoldPlan: config files, package.json updates, unit test stubs,
|
|
4
|
-
// and structural test stubs. Can also execute the plan to disk.
|
|
5
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
6
|
-
import { dirname, basename, extname } from "node:path";
|
|
7
|
-
import { generateTestTemplate } from "./test-templates.js";
|
|
8
|
-
import { generateStructuralTests } from "./structural-templates.js";
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// Config Generation
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
function needsJsdom(report) {
|
|
13
|
-
const fw = report.framework.appFramework;
|
|
14
|
-
return fw === "nextjs-app" || fw === "nextjs-pages" || fw === "react-vite";
|
|
15
|
-
}
|
|
16
|
-
function generateVitestConfig(report, testDir) {
|
|
17
|
-
const lines = [];
|
|
18
|
-
lines.push(`import { defineConfig } from "vitest/config";`);
|
|
19
|
-
lines.push(``);
|
|
20
|
-
lines.push(`export default defineConfig({`);
|
|
21
|
-
lines.push(` test: {`);
|
|
22
|
-
lines.push(` include: ["${testDir}/**/*.test.ts", "${testDir}/**/*.test.tsx"],`);
|
|
23
|
-
if (needsJsdom(report)) {
|
|
24
|
-
lines.push(` environment: "jsdom",`);
|
|
25
|
-
}
|
|
26
|
-
lines.push(` coverage: {`);
|
|
27
|
-
lines.push(` provider: "v8",`);
|
|
28
|
-
lines.push(` include: ["src/**/*.ts", "src/**/*.tsx"],`);
|
|
29
|
-
lines.push(` exclude: ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts"],`);
|
|
30
|
-
lines.push(` },`);
|
|
31
|
-
lines.push(` },`);
|
|
32
|
-
lines.push(`});`);
|
|
33
|
-
lines.push(``);
|
|
34
|
-
return lines.join("\n");
|
|
35
|
-
}
|
|
36
|
-
function generateJestConfig(report, testDir) {
|
|
37
|
-
const lines = [];
|
|
38
|
-
lines.push(`import type { Config } from "jest";`);
|
|
39
|
-
lines.push(``);
|
|
40
|
-
lines.push(`const config: Config = {`);
|
|
41
|
-
lines.push(` testMatch: ["<rootDir>/${testDir}/**/*.test.ts", "<rootDir>/${testDir}/**/*.test.tsx"],`);
|
|
42
|
-
lines.push(` transform: {`);
|
|
43
|
-
lines.push(` "^.+\\\\.tsx?$": "ts-jest",`);
|
|
44
|
-
lines.push(` },`);
|
|
45
|
-
if (needsJsdom(report)) {
|
|
46
|
-
lines.push(` testEnvironment: "jsdom",`);
|
|
47
|
-
}
|
|
48
|
-
lines.push(`};`);
|
|
49
|
-
lines.push(``);
|
|
50
|
-
lines.push(`export default config;`);
|
|
51
|
-
lines.push(``);
|
|
52
|
-
return lines.join("\n");
|
|
53
|
-
}
|
|
54
|
-
// ---------------------------------------------------------------------------
|
|
55
|
-
// Package.json Updates
|
|
56
|
-
// ---------------------------------------------------------------------------
|
|
57
|
-
function buildPackageJsonUpdates(runner, report) {
|
|
58
|
-
const scripts = {};
|
|
59
|
-
const devDependencies = {};
|
|
60
|
-
if (runner === "vitest") {
|
|
61
|
-
scripts["test"] = "vitest run";
|
|
62
|
-
devDependencies["vitest"] = "^4.0.0";
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
scripts["test"] = "jest";
|
|
66
|
-
devDependencies["jest"] = "^29.0.0";
|
|
67
|
-
devDependencies["ts-jest"] = "^29.0.0";
|
|
68
|
-
devDependencies["@types/jest"] = "^29.0.0";
|
|
69
|
-
}
|
|
70
|
-
const fw = report.framework.appFramework;
|
|
71
|
-
// React frameworks need testing-library
|
|
72
|
-
if (fw === "nextjs-app" || fw === "nextjs-pages" || fw === "react-vite") {
|
|
73
|
-
devDependencies["@testing-library/react"] = "^16.0.0";
|
|
74
|
-
devDependencies["@testing-library/user-event"] = "^14.0.0";
|
|
75
|
-
if (runner === "vitest") {
|
|
76
|
-
devDependencies["jsdom"] = "^25.0.0";
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// Express needs supertest
|
|
80
|
-
if (fw === "express") {
|
|
81
|
-
devDependencies["supertest"] = "^7.0.0";
|
|
82
|
-
devDependencies["@types/supertest"] = "^6.0.0";
|
|
83
|
-
}
|
|
84
|
-
return { scripts, devDependencies };
|
|
85
|
-
}
|
|
86
|
-
// ---------------------------------------------------------------------------
|
|
87
|
-
// Unit Test Stub Generation
|
|
88
|
-
// ---------------------------------------------------------------------------
|
|
89
|
-
function deriveTestFilePath(sourcePath, testDir) {
|
|
90
|
-
// Strip leading source directory prefix to get the relative sub-path
|
|
91
|
-
const srcPrefixes = ["src/", "lib/", "app/", "pages/"];
|
|
92
|
-
let subPath = sourcePath.replace(/\\/g, "/");
|
|
93
|
-
for (const prefix of srcPrefixes) {
|
|
94
|
-
if (subPath.startsWith(prefix)) {
|
|
95
|
-
subPath = subPath.slice(prefix.length);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const dir = dirname(subPath);
|
|
100
|
-
const base = basename(subPath);
|
|
101
|
-
const ext = extname(base);
|
|
102
|
-
const nameWithoutExt = base.replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
103
|
-
const testExt = ext === ".tsx" || ext === ".jsx" ? ext : ".ts";
|
|
104
|
-
const dirPart = dir === "." ? "" : `${dir}/`;
|
|
105
|
-
return `${testDir}/${dirPart}${nameWithoutExt}.test${testExt}`;
|
|
106
|
-
}
|
|
107
|
-
function buildUnitTestStubs(report, testDir, categoryFilter) {
|
|
108
|
-
const results = [];
|
|
109
|
-
const appFramework = report.framework.appFramework;
|
|
110
|
-
for (const category of report.categories) {
|
|
111
|
-
// If a category filter is provided, skip categories not in the list
|
|
112
|
-
if (categoryFilter && categoryFilter.length > 0) {
|
|
113
|
-
if (!categoryFilter.includes(category.name)) {
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
for (const untestedFile of category.untestedFiles) {
|
|
118
|
-
const testPath = deriveTestFilePath(untestedFile, testDir);
|
|
119
|
-
const content = generateTestTemplate(untestedFile, category.name, appFramework);
|
|
120
|
-
results.push({ path: testPath, content });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return results;
|
|
124
|
-
}
|
|
125
|
-
// ---------------------------------------------------------------------------
|
|
126
|
-
// Main
|
|
127
|
-
// ---------------------------------------------------------------------------
|
|
128
|
-
export async function buildScaffoldPlan(report, options) {
|
|
129
|
-
const testDir = options.testDir ?? "tests";
|
|
130
|
-
const runner = options.runner ?? "vitest";
|
|
131
|
-
const structural = options.structural ?? true;
|
|
132
|
-
// Config file
|
|
133
|
-
let configFile = null;
|
|
134
|
-
if (runner === "vitest") {
|
|
135
|
-
configFile = {
|
|
136
|
-
path: "vitest.config.ts",
|
|
137
|
-
content: generateVitestConfig(report, testDir),
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
configFile = {
|
|
142
|
-
path: "jest.config.ts",
|
|
143
|
-
content: generateJestConfig(report, testDir),
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
// Package.json updates
|
|
147
|
-
const packageJsonUpdates = buildPackageJsonUpdates(runner, report);
|
|
148
|
-
// Unit test stubs
|
|
149
|
-
const testFiles = buildUnitTestStubs(report, testDir, options.categories);
|
|
150
|
-
// Structural tests
|
|
151
|
-
let structuralTests = [];
|
|
152
|
-
if (structural) {
|
|
153
|
-
const sourceDir = report.categories.length > 0
|
|
154
|
-
? guessSourceDir(report)
|
|
155
|
-
: "src";
|
|
156
|
-
structuralTests = generateStructuralTests({
|
|
157
|
-
sourceDir,
|
|
158
|
-
testDir,
|
|
159
|
-
entryPoints: options.entryPoints,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
configFile,
|
|
164
|
-
packageJsonUpdates,
|
|
165
|
-
testFiles,
|
|
166
|
-
structuralTests,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
/** Infer the source directory from the report's source file paths. */
|
|
170
|
-
function guessSourceDir(report) {
|
|
171
|
-
for (const cat of report.categories) {
|
|
172
|
-
for (const f of cat.sourceFiles) {
|
|
173
|
-
const normalized = f.replace(/\\/g, "/");
|
|
174
|
-
if (normalized.startsWith("src/"))
|
|
175
|
-
return "src";
|
|
176
|
-
if (normalized.startsWith("lib/"))
|
|
177
|
-
return "lib";
|
|
178
|
-
if (normalized.startsWith("app/"))
|
|
179
|
-
return "app";
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return "src";
|
|
183
|
-
}
|
|
184
|
-
export async function executeScaffoldPlan(plan, projectDir) {
|
|
185
|
-
const filesWritten = [];
|
|
186
|
-
// Write config file
|
|
187
|
-
if (plan.configFile) {
|
|
188
|
-
const fullPath = `${projectDir}/${plan.configFile.path}`;
|
|
189
|
-
await mkdir(dirname(fullPath), { recursive: true });
|
|
190
|
-
await writeFile(fullPath, plan.configFile.content, "utf-8");
|
|
191
|
-
filesWritten.push(plan.configFile.path);
|
|
192
|
-
}
|
|
193
|
-
// Write unit test stubs
|
|
194
|
-
for (const file of plan.testFiles) {
|
|
195
|
-
const fullPath = `${projectDir}/${file.path}`;
|
|
196
|
-
await mkdir(dirname(fullPath), { recursive: true });
|
|
197
|
-
await writeFile(fullPath, file.content, "utf-8");
|
|
198
|
-
filesWritten.push(file.path);
|
|
199
|
-
}
|
|
200
|
-
// Write structural tests
|
|
201
|
-
for (const file of plan.structuralTests) {
|
|
202
|
-
const fullPath = `${projectDir}/${file.path}`;
|
|
203
|
-
await mkdir(dirname(fullPath), { recursive: true });
|
|
204
|
-
await writeFile(fullPath, file.content, "utf-8");
|
|
205
|
-
filesWritten.push(file.path);
|
|
206
|
-
}
|
|
207
|
-
return { filesWritten };
|
|
208
|
-
}
|
|
209
|
-
//# sourceMappingURL=test-scaffold.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-scaffold.js","sourceRoot":"","sources":["../../src/setup/test-scaffold.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,sEAAsE;AACtE,uEAAuE;AACvE,gEAAgE;AAEhE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,M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,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,wBAAwB;IACxB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,GAAG,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjD,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,yBAAyB;IACzB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QACxC,MAAM,QAAQ,GAAG,GAAG,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjD,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compute the relative import path from a test file to its source file.
|
|
3
|
-
* Assumes test files live in __tests__/ adjacent to source, or co-located.
|
|
4
|
-
* Returns a path with no extension (for TS imports).
|
|
5
|
-
*/
|
|
6
|
-
export declare function computeRelativeImport(testFilePath: string, sourceFilePath: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Test stub for Next.js App Router API route handlers.
|
|
9
|
-
* Tests GET/POST/PUT/DELETE handler functions with mocked NextRequest/NextResponse.
|
|
10
|
-
*/
|
|
11
|
-
export declare function nextjsApiRouteTemplate(sourcePath: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* Test stub for React components using React Testing Library patterns.
|
|
14
|
-
* Includes render test and basic interaction test.
|
|
15
|
-
*/
|
|
16
|
-
export declare function reactComponentTemplate(sourcePath: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Test stub for pure utility/helper functions.
|
|
19
|
-
* Input/output pattern with describe blocks.
|
|
20
|
-
*/
|
|
21
|
-
export declare function utilityTemplate(sourcePath: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Test stub for Express routes using supertest patterns.
|
|
24
|
-
* Tests GET and POST endpoints.
|
|
25
|
-
*/
|
|
26
|
-
export declare function expressRouteTemplate(sourcePath: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Select the right template based on the file category and detected app framework.
|
|
29
|
-
*
|
|
30
|
-
* @param sourcePath - Path to the source file being tested
|
|
31
|
-
* @param category - From TestCategory.name: "api-routes", "components", "utils",
|
|
32
|
-
* "middleware", "models", "other"
|
|
33
|
-
* @param appFramework - From TestAnalysisReport.framework.appFramework:
|
|
34
|
-
* "nextjs-app", "nextjs-pages", "react-vite", "express",
|
|
35
|
-
* "plain-ts", "unknown"
|
|
36
|
-
*/
|
|
37
|
-
export declare function generateTestTemplate(sourcePath: string, category: string, appFramework: string): string;
|