forge-workflow 1.4.7 → 1.5.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/.forge/hooks/check-tdd.js +229 -0
- package/.github/PLUGIN_TEMPLATE.json +32 -0
- package/AGENTS.md +142 -81
- package/CLAUDE.md +3 -3
- package/README.md +22 -0
- package/bin/forge-validate.js +303 -0
- package/bin/forge.js +1714 -957
- package/docs/SETUP.md +6 -0
- package/docs/TOOLCHAIN.md +30 -4
- package/docs/VALIDATION.md +363 -0
- package/docs/planning/PROGRESS.md +10 -0
- package/lefthook.yml +30 -0
- package/lib/agents/README.md +202 -0
- package/lib/agents/aider.plugin.json +16 -0
- package/lib/agents/antigravity.plugin.json +25 -0
- package/lib/agents/claude.plugin.json +28 -0
- package/lib/agents/cline.plugin.json +21 -0
- package/lib/agents/continue.plugin.json +21 -0
- package/lib/agents/copilot.plugin.json +23 -0
- package/lib/agents/cursor.plugin.json +24 -0
- package/lib/agents/kilocode.plugin.json +22 -0
- package/lib/agents/opencode.plugin.json +20 -0
- package/lib/agents/roo.plugin.json +22 -0
- package/lib/agents/windsurf.plugin.json +25 -0
- package/lib/plugin-manager.js +115 -0
- package/package.json +20 -2
- package/.claude/skills/forge-workflow/SKILL.md +0 -46
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TDD Enforcement Hook
|
|
5
|
+
*
|
|
6
|
+
* Checks if source code changes have corresponding test files.
|
|
7
|
+
* Offers guided recovery options when violations are found.
|
|
8
|
+
*
|
|
9
|
+
* Security: Uses execFileSync to prevent command injection.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { execFileSync } = require("node:child_process");
|
|
13
|
+
const fs = require("node:fs");
|
|
14
|
+
const path = require("node:path");
|
|
15
|
+
const readline = require("node:readline");
|
|
16
|
+
|
|
17
|
+
// Get staged files using git diff --cached
|
|
18
|
+
function getStagedFiles() {
|
|
19
|
+
try {
|
|
20
|
+
const output = execFileSync(
|
|
21
|
+
"git",
|
|
22
|
+
["diff", "--cached", "--name-only", "--diff-filter=ACM"],
|
|
23
|
+
{
|
|
24
|
+
encoding: "utf8",
|
|
25
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
return output.trim().split("\n").filter(Boolean);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error("Error getting staged files:", error.message);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Check if a file is a source file (not test, not config)
|
|
36
|
+
function isSourceFile(file) {
|
|
37
|
+
const sourceExtensions = [
|
|
38
|
+
".js",
|
|
39
|
+
".ts",
|
|
40
|
+
".jsx",
|
|
41
|
+
".tsx",
|
|
42
|
+
".py",
|
|
43
|
+
".go",
|
|
44
|
+
".java",
|
|
45
|
+
".rb",
|
|
46
|
+
];
|
|
47
|
+
const ext = path.extname(file);
|
|
48
|
+
|
|
49
|
+
if (!sourceExtensions.includes(ext)) return false;
|
|
50
|
+
|
|
51
|
+
// Exclude test files
|
|
52
|
+
if (file.includes(".test.") || file.includes(".spec.")) return false;
|
|
53
|
+
|
|
54
|
+
// Exclude common config files
|
|
55
|
+
const excludePatterns = [
|
|
56
|
+
/^\./, // dot files
|
|
57
|
+
/config\./,
|
|
58
|
+
/\.config\./,
|
|
59
|
+
/setup\./,
|
|
60
|
+
/^test\//,
|
|
61
|
+
/^tests\//,
|
|
62
|
+
/__tests__\//,
|
|
63
|
+
/package\.json/,
|
|
64
|
+
/tsconfig/,
|
|
65
|
+
/jest\.config/,
|
|
66
|
+
/vite\.config/,
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
return !excludePatterns.some((pattern) => pattern.test(file));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Find corresponding test file for a source file
|
|
73
|
+
function hasTestFile(sourceFile, stagedFiles) {
|
|
74
|
+
const dir = path.dirname(sourceFile);
|
|
75
|
+
const basename = path.basename(sourceFile, path.extname(sourceFile));
|
|
76
|
+
const ext = path.extname(sourceFile);
|
|
77
|
+
|
|
78
|
+
// Common test patterns (including nested directories)
|
|
79
|
+
const testPatterns = [
|
|
80
|
+
// Colocated tests
|
|
81
|
+
`${basename}.test${ext}`,
|
|
82
|
+
`${basename}.spec${ext}`,
|
|
83
|
+
`${dir}/${basename}.test${ext}`,
|
|
84
|
+
`${dir}/${basename}.spec${ext}`,
|
|
85
|
+
`${dir}/__tests__/${basename}.test${ext}`,
|
|
86
|
+
`${dir}/__tests__/${basename}.spec${ext}`,
|
|
87
|
+
// Top-level test directories
|
|
88
|
+
`test/${basename}.test${ext}`,
|
|
89
|
+
`test/${basename}.spec${ext}`,
|
|
90
|
+
`tests/${basename}.test${ext}`,
|
|
91
|
+
`tests/${basename}.spec${ext}`,
|
|
92
|
+
`__tests__/${basename}.test${ext}`,
|
|
93
|
+
`__tests__/${basename}.spec${ext}`,
|
|
94
|
+
// Nested test directories (unit/integration)
|
|
95
|
+
`test/unit/${basename}.test${ext}`,
|
|
96
|
+
`test/unit/${basename}.spec${ext}`,
|
|
97
|
+
`test/integration/${basename}.test${ext}`,
|
|
98
|
+
`test/integration/${basename}.spec${ext}`,
|
|
99
|
+
`tests/unit/${basename}.test${ext}`,
|
|
100
|
+
`tests/unit/${basename}.spec${ext}`,
|
|
101
|
+
`tests/integration/${basename}.test${ext}`,
|
|
102
|
+
`tests/integration/${basename}.spec${ext}`,
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
// Check if test file exists in staged files or filesystem
|
|
106
|
+
for (const pattern of testPatterns) {
|
|
107
|
+
if (stagedFiles.includes(pattern)) return true;
|
|
108
|
+
if (fs.existsSync(pattern)) return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Prompt user for action (handles non-TTY environments like CI/CD)
|
|
115
|
+
function promptUser(question, options) {
|
|
116
|
+
return new Promise((resolve) => {
|
|
117
|
+
// In non-interactive environments (CI/CD), auto-abort to enforce TDD
|
|
118
|
+
if (!process.stdin.isTTY) {
|
|
119
|
+
console.log("\n⚠️ Non-interactive environment detected (CI/CD).");
|
|
120
|
+
console.log("Aborting commit - source files must have tests.");
|
|
121
|
+
console.log("💡 Tip: Use --no-verify to skip this check if needed.");
|
|
122
|
+
resolve("abort");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const rl = readline.createInterface({
|
|
127
|
+
input: process.stdin,
|
|
128
|
+
output: process.stdout,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
console.log("\n" + question);
|
|
132
|
+
options.forEach((opt, i) => {
|
|
133
|
+
console.log(` ${i + 1}. ${opt.label}`);
|
|
134
|
+
});
|
|
135
|
+
console.log();
|
|
136
|
+
|
|
137
|
+
rl.question("Your choice (1-" + options.length + "): ", (answer) => {
|
|
138
|
+
rl.close();
|
|
139
|
+
const choice = parseInt(answer, 10) - 1;
|
|
140
|
+
if (choice >= 0 && choice < options.length) {
|
|
141
|
+
resolve(options[choice].value);
|
|
142
|
+
} else {
|
|
143
|
+
console.log("Invalid choice. Aborting commit.");
|
|
144
|
+
resolve("abort");
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Main hook logic
|
|
151
|
+
async function main() {
|
|
152
|
+
console.log("🔍 TDD Check: Verifying test coverage for staged files...\n");
|
|
153
|
+
|
|
154
|
+
const stagedFiles = getStagedFiles();
|
|
155
|
+
|
|
156
|
+
if (stagedFiles.length === 0) {
|
|
157
|
+
console.log("✓ No staged files to check.");
|
|
158
|
+
process.exit(0);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const sourceFiles = stagedFiles.filter(isSourceFile);
|
|
162
|
+
|
|
163
|
+
if (sourceFiles.length === 0) {
|
|
164
|
+
console.log("✓ No source files staged (only tests/config/docs).");
|
|
165
|
+
process.exit(0);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const filesWithoutTests = sourceFiles.filter(
|
|
169
|
+
(file) => !hasTestFile(file, stagedFiles),
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
if (filesWithoutTests.length === 0) {
|
|
173
|
+
console.log("✓ All source files have corresponding tests!");
|
|
174
|
+
process.exit(0);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Found violations
|
|
178
|
+
console.log("⚠️ Looks like you're committing source code without tests:\n");
|
|
179
|
+
filesWithoutTests.forEach((file) => {
|
|
180
|
+
console.log(` - ${file}`);
|
|
181
|
+
});
|
|
182
|
+
console.log();
|
|
183
|
+
|
|
184
|
+
console.log("📋 TDD Reminder:");
|
|
185
|
+
console.log(" Write tests BEFORE implementation (RED-GREEN-REFACTOR)");
|
|
186
|
+
console.log();
|
|
187
|
+
|
|
188
|
+
const action = await promptUser("What would you like to do?", [
|
|
189
|
+
{ label: "Unstage source files (keep tests staged)", value: "unstage" },
|
|
190
|
+
{ label: "Continue anyway (I have a good reason)", value: "continue" },
|
|
191
|
+
{ label: "Abort commit (let me add tests)", value: "abort" },
|
|
192
|
+
]);
|
|
193
|
+
|
|
194
|
+
switch (action) {
|
|
195
|
+
case "unstage":
|
|
196
|
+
console.log("\n📝 Unstaging source files without tests...");
|
|
197
|
+
filesWithoutTests.forEach((file) => {
|
|
198
|
+
try {
|
|
199
|
+
execFileSync("git", ["reset", "HEAD", file], { stdio: "inherit" });
|
|
200
|
+
console.log(` ✓ Unstaged: ${file}`);
|
|
201
|
+
} catch (error) {
|
|
202
|
+
console.error(` ✗ Failed to unstage: ${file}`);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
console.log(
|
|
206
|
+
"\nYou can now commit your tests and add source files later.",
|
|
207
|
+
);
|
|
208
|
+
process.exit(0);
|
|
209
|
+
break;
|
|
210
|
+
|
|
211
|
+
case "continue":
|
|
212
|
+
console.log("\n✓ Continuing with commit...");
|
|
213
|
+
console.log("💡 Tip: Use --no-verify to skip this check in emergencies.");
|
|
214
|
+
process.exit(0);
|
|
215
|
+
break;
|
|
216
|
+
|
|
217
|
+
case "abort":
|
|
218
|
+
default:
|
|
219
|
+
console.log("\n❌ Commit aborted. Add tests and try again!");
|
|
220
|
+
console.log("💡 Tip: Use --no-verify to skip this check if needed.");
|
|
221
|
+
process.exit(1);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Run with error handling
|
|
226
|
+
main().catch((error) => {
|
|
227
|
+
console.error("Error in TDD check hook:", error.message);
|
|
228
|
+
process.exit(1);
|
|
229
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "your-agent",
|
|
3
|
+
"name": "Your Agent Name",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Brief description of your AI coding agent",
|
|
6
|
+
"homepage": "https://your-agent.example.com",
|
|
7
|
+
"capabilities": {
|
|
8
|
+
"commands": true,
|
|
9
|
+
"skills": true,
|
|
10
|
+
"hooks": false
|
|
11
|
+
},
|
|
12
|
+
"directories": {
|
|
13
|
+
"commands": ".your-agent/commands",
|
|
14
|
+
"rules": ".your-agent/rules",
|
|
15
|
+
"skills": ".your-agent/skills/forge-workflow",
|
|
16
|
+
"scripts": ".your-agent/scripts"
|
|
17
|
+
},
|
|
18
|
+
"files": {
|
|
19
|
+
"rootConfig": ".your-agent-rules",
|
|
20
|
+
"skillDefinition": ".your-agent/skills/forge-workflow/SKILL.md"
|
|
21
|
+
},
|
|
22
|
+
"setup": {
|
|
23
|
+
"copyCommands": true,
|
|
24
|
+
"copyRules": true,
|
|
25
|
+
"copyScripts": false,
|
|
26
|
+
"createSkill": true,
|
|
27
|
+
"customSetup": "",
|
|
28
|
+
"needsConversion": false,
|
|
29
|
+
"promptFormat": false,
|
|
30
|
+
"continueFormat": false
|
|
31
|
+
}
|
|
32
|
+
}
|
package/AGENTS.md
CHANGED
|
@@ -1,112 +1,173 @@
|
|
|
1
|
-
# Project Instructions
|
|
1
|
+
# Project Workflow Instructions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 9-Stage TDD-First Workflow
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
This project enforces a **strict TDD-first development workflow** with 9 stages:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| Stage | Command | Purpose | Required For |
|
|
8
|
+
|-------|-------------|----------------------------------------------|--------------|
|
|
9
|
+
| 1 | `/status` | Check current context, active work | All types |
|
|
10
|
+
| 2 | `/research` | Research with web search, document findings | Critical |
|
|
11
|
+
| 3 | `/plan` | Create implementation plan, branch, OpenSpec | Critical, Standard, Refactor |
|
|
12
|
+
| 4 | `/dev` | TDD development (RED-GREEN-REFACTOR) | All types |
|
|
13
|
+
| 5 | `/check` | Validation (type/lint/security/tests) | All types |
|
|
14
|
+
| 6 | `/ship` | Create PR with documentation | All types |
|
|
15
|
+
| 7 | `/review` | Address ALL PR feedback | Critical, Standard |
|
|
16
|
+
| 8 | `/merge` | Update docs, merge PR, cleanup | All types |
|
|
17
|
+
| 9 | `/verify` | Final documentation verification | All types |
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
npm install # Install dependencies
|
|
11
|
-
npm run dev # Start development
|
|
12
|
-
npm run build # Production build
|
|
13
|
-
npm test # Run tests
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
---
|
|
19
|
+
## Automatic Change Classification
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
When the user requests work, **you MUST automatically classify** the change type:
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
### Critical (Full 9-stage workflow)
|
|
24
|
+
**Triggers:** Security, authentication, payments, breaking changes, new architecture, data migrations
|
|
25
|
+
**Example:** "Add OAuth login", "Migrate database schema", "Implement payment gateway"
|
|
26
|
+
**Workflow:** status → research → plan → dev → check → ship → review → merge → verify
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
| 3 | `/plan` | Create implementation plan, branch, OpenSpec |
|
|
27
|
-
| 4 | `/dev` | TDD development (RED-GREEN-REFACTOR) |
|
|
28
|
-
| 5 | `/check` | Validation (type/lint/security/tests) |
|
|
29
|
-
| 6 | `/ship` | Create PR with documentation |
|
|
30
|
-
| 7 | `/review` | Address ALL PR feedback |
|
|
31
|
-
| 8 | `/merge` | Update docs, merge PR, cleanup |
|
|
32
|
-
| 9 | `/verify` | Final documentation verification |
|
|
28
|
+
### Standard (6-stage workflow, research optional)
|
|
29
|
+
**Triggers:** Normal features, enhancements, new components
|
|
30
|
+
**Example:** "Add user profile page", "Create notification system"
|
|
31
|
+
**Workflow:** status → plan → dev → check → ship → merge
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
### Simple (4-stage workflow, skip research/plan)
|
|
34
|
+
**Triggers:** Bug fixes, UI tweaks, small changes, minor refactors
|
|
35
|
+
**Example:** "Fix button color", "Update validation message", "Adjust padding"
|
|
36
|
+
**Workflow:** dev → check → ship → merge
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
### Hotfix (Emergency 3-stage workflow)
|
|
39
|
+
**Triggers:** Production emergencies, critical bugs affecting users
|
|
40
|
+
**Example:** "Production payment processing down", "Security vulnerability fix"
|
|
41
|
+
**Workflow:** dev → check → ship (immediate merge allowed)
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
### Docs (Documentation-only workflow)
|
|
44
|
+
**Triggers:** Documentation updates, README changes, comment improvements
|
|
45
|
+
**Example:** "Update README", "Add API documentation"
|
|
46
|
+
**Workflow:** verify → ship → merge
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
### Refactor (5-stage workflow for safe cleanup)
|
|
49
|
+
**Triggers:** Code cleanup, performance optimization, technical debt reduction
|
|
50
|
+
**Example:** "Refactor auth service", "Extract utility functions"
|
|
51
|
+
**Workflow:** plan → dev → check → ship → merge
|
|
41
52
|
|
|
42
|
-
|
|
43
|
-
- **Research-First**: Understand before building, document decisions
|
|
44
|
-
- **Security Built-In**: OWASP Top 10 analysis for every feature
|
|
45
|
-
- **Documentation Progressive**: Update at each stage, verify at end
|
|
53
|
+
## Enforcement Philosophy
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
**Conversational, not blocking** - Offer solutions when prerequisites are missing:
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
❌ **Don't:** "ERROR: Research required for critical features"
|
|
58
|
+
✅ **Do:** "Before implementation, I should research OAuth best practices. I can:
|
|
59
|
+
1. Auto-research now with parallel-ai (~5 min)
|
|
60
|
+
2. Use your research if you have it
|
|
61
|
+
3. Skip (not recommended for security features)
|
|
50
62
|
|
|
51
|
-
|
|
63
|
+
What would you prefer?"
|
|
52
64
|
|
|
53
|
-
**
|
|
65
|
+
**Create accountability for skips:**
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
"Skipping tests creates technical debt. I'll:
|
|
68
|
+
✓ Allow this commit
|
|
69
|
+
✓ Create follow-up Beads issue for tests
|
|
70
|
+
✓ Document in commit message as [tech-debt]
|
|
57
71
|
|
|
58
|
-
|
|
72
|
+
Proceed?"
|
|
59
73
|
|
|
60
|
-
|
|
74
|
+
## TDD Development (Stage 4: /dev)
|
|
61
75
|
|
|
62
|
-
|
|
63
|
-
- **Cline**: Add MCP servers in VSCode settings (Extensions > Cline > MCP Servers)
|
|
64
|
-
- **Continue**: Add to `.continue/config.json` under `mcpServers`
|
|
65
|
-
- **Cursor**: Check Cursor Settings > MCP for setup
|
|
66
|
-
- **Your agent**: If MCP-capable, configure using the example file
|
|
76
|
+
**Automatic orchestration with parallel Task agents:**
|
|
67
77
|
|
|
68
|
-
**
|
|
78
|
+
1. **Analyze plan** → Identify parallel vs sequential tasks from Beads/OpenSpec
|
|
79
|
+
2. **Launch Task agents** → Spawn specialized agents for independent work
|
|
80
|
+
3. **Enforce RED-GREEN-REFACTOR** → Each agent follows strict TDD cycle:
|
|
81
|
+
- RED: Write failing test first
|
|
82
|
+
- GREEN: Implement minimal code to pass
|
|
83
|
+
- REFACTOR: Clean up while keeping tests green
|
|
84
|
+
4. **Show progress** → Real-time updates on parallel tracks
|
|
85
|
+
5. **Integrate** → Final E2E tests validate everything works together
|
|
69
86
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
**Example execution:**
|
|
88
|
+
```
|
|
89
|
+
User: "Build Stripe payment integration"
|
|
90
|
+
|
|
91
|
+
You analyze plan:
|
|
92
|
+
✓ Identified 3 independent tracks:
|
|
93
|
+
- API endpoints (server-side)
|
|
94
|
+
- Webhook handlers (server-side)
|
|
95
|
+
- Checkout UI (client-side)
|
|
96
|
+
|
|
97
|
+
You launch parallel agents:
|
|
98
|
+
✓ Task(backend-architect, "API endpoints with TDD")
|
|
99
|
+
✓ Task(backend-architect, "Webhook handlers with TDD")
|
|
100
|
+
✓ Task(typescript-pro, "Checkout UI with TDD")
|
|
101
|
+
|
|
102
|
+
You show live progress:
|
|
103
|
+
Track 1 (backend-architect): API endpoints
|
|
104
|
+
✓ RED: Payment validation tests written
|
|
105
|
+
⏳ GREEN: Implementing Stripe API calls
|
|
106
|
+
|
|
107
|
+
Track 2 (backend-architect): Webhook handlers
|
|
108
|
+
✓ RED: Webhook signature tests written
|
|
109
|
+
✓ GREEN: Signature verification implemented
|
|
110
|
+
⏳ REFACTOR: Extracting helper functions
|
|
111
|
+
|
|
112
|
+
Track 3 (typescript-pro): UI components
|
|
113
|
+
✓ RED: Component tests written
|
|
114
|
+
⏳ GREEN: Building CheckoutForm component
|
|
75
115
|
```
|
|
76
116
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
117
|
+
## State Management (Single Source of Truth)
|
|
118
|
+
|
|
119
|
+
**All workflow state stored in Beads metadata** (survives compaction):
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"id": "bd-x7y2",
|
|
124
|
+
"type": "critical",
|
|
125
|
+
"currentStage": "dev",
|
|
126
|
+
"completedStages": ["status", "research", "plan"],
|
|
127
|
+
"skippedStages": [],
|
|
128
|
+
"workflowDecisions": {
|
|
129
|
+
"classification": "critical",
|
|
130
|
+
"reason": "Payment processing, PCI compliance required",
|
|
131
|
+
"userOverride": false
|
|
132
|
+
},
|
|
133
|
+
"parallelTracks": [
|
|
134
|
+
{
|
|
135
|
+
"name": "API endpoints",
|
|
136
|
+
"agent": "backend-architect",
|
|
137
|
+
"status": "in_progress",
|
|
138
|
+
"tddPhase": "GREEN"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
```
|
|
97
143
|
|
|
98
|
-
|
|
144
|
+
## Git Hooks (Automatic Enforcement)
|
|
99
145
|
|
|
100
|
-
|
|
146
|
+
**Pre-commit hook enforces TDD:**
|
|
147
|
+
- Blocks commits if source code modified without test files
|
|
148
|
+
- Offers guided recovery (add tests now, skip with tech debt tracking, emergency override)
|
|
149
|
+
- No AI decision required - automatic validation
|
|
101
150
|
|
|
102
|
-
|
|
151
|
+
**Pre-push hook validates tests:**
|
|
152
|
+
- All tests must pass before push
|
|
153
|
+
- Can skip for hotfixes with documentation
|
|
103
154
|
|
|
104
|
-
|
|
155
|
+
## Documentation Index (Context Pointers)
|
|
105
156
|
|
|
106
|
-
|
|
157
|
+
**Detailed command instructions** are located in:
|
|
158
|
+
- [.claude/commands/status.md](.claude/commands/status.md) - How to check current context
|
|
159
|
+
- [.claude/commands/research.md](.claude/commands/research.md) - How to conduct research with parallel-ai
|
|
160
|
+
- [.claude/commands/plan.md](.claude/commands/plan.md) - How to create implementation plans
|
|
161
|
+
- [.claude/commands/dev.md](.claude/commands/dev.md) - How to execute TDD development
|
|
162
|
+
- [.claude/commands/check.md](.claude/commands/check.md) - How to run validation
|
|
163
|
+
- [.claude/commands/ship.md](.claude/commands/ship.md) - How to create PRs
|
|
164
|
+
- [.claude/commands/review.md](.claude/commands/review.md) - How to address PR feedback
|
|
165
|
+
- [.claude/commands/merge.md](.claude/commands/merge.md) - How to merge and cleanup
|
|
166
|
+
- [.claude/commands/verify.md](.claude/commands/verify.md) - How to verify documentation
|
|
107
167
|
|
|
108
|
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
168
|
+
**Comprehensive workflow guide:**
|
|
169
|
+
- [docs/WORKFLOW.md](docs/WORKFLOW.md) - Complete workflow documentation (150 lines)
|
|
170
|
+
- [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md) - Tool setup and configuration
|
|
171
|
+
- [docs/VALIDATION.md](docs/VALIDATION.md) - Enforcement and validation details
|
|
111
172
|
|
|
112
|
-
|
|
173
|
+
**Load these files when you need detailed instructions for a specific stage.**
|
package/CLAUDE.md
CHANGED
|
@@ -91,11 +91,11 @@ See [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md) for detailed MCP setup instructions.
|
|
|
91
91
|
|
|
92
92
|
## Toolchain
|
|
93
93
|
|
|
94
|
-
- **Beads** (recommended):
|
|
95
|
-
- **OpenSpec** (optional):
|
|
94
|
+
- **Beads** (recommended): Auto-installed during `npx forge setup` - Git-backed issue tracking
|
|
95
|
+
- **OpenSpec** (optional): Auto-installed during `npx forge setup` - Spec-driven development
|
|
96
96
|
- **GitHub CLI**: `gh auth login` - PR workflow
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
Setup prompts for Beads/OpenSpec during interactive installation. Manual install: see [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md).
|
|
99
99
|
|
|
100
100
|
---
|
|
101
101
|
|
package/README.md
CHANGED
|
@@ -143,6 +143,28 @@ One workflow, works with ALL major AI agents:
|
|
|
143
143
|
|
|
144
144
|
Switch agents anytime without changing your workflow.
|
|
145
145
|
|
|
146
|
+
### 4. Built-in TDD Enforcement (v1.5.0)
|
|
147
|
+
Git hooks automatically enforce TDD practices:
|
|
148
|
+
- **Pre-commit**: Blocks source commits without tests
|
|
149
|
+
- **Pre-push**: Runs full test suite before push
|
|
150
|
+
- **Interactive**: Guided recovery when violations occur
|
|
151
|
+
- **CI/CD aware**: Auto-aborts in non-interactive environments
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Validation CLI
|
|
155
|
+
forge-validate status # Check project prerequisites
|
|
156
|
+
forge-validate dev # Validate before /dev stage
|
|
157
|
+
forge-validate ship # Validate before /ship stage
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 5. Plugin Architecture (v1.5.0)
|
|
161
|
+
11 agent plugins with specialized capabilities:
|
|
162
|
+
- Each agent defined by JSON configuration
|
|
163
|
+
- Community contributions welcome
|
|
164
|
+
- Backwards compatible
|
|
165
|
+
|
|
166
|
+
→ [Validation docs](docs/VALIDATION.md) | [Plugin docs](lib/agents/README.md)
|
|
167
|
+
|
|
146
168
|
---
|
|
147
169
|
|
|
148
170
|
## The Toolchain
|