forge-workflow 0.0.1
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/.claude/commands/dev.md +314 -0
- package/.claude/commands/plan.md +389 -0
- package/.claude/commands/premerge.md +179 -0
- package/.claude/commands/research.md +42 -0
- package/.claude/commands/review.md +442 -0
- package/.claude/commands/rollback.md +721 -0
- package/.claude/commands/ship.md +134 -0
- package/.claude/commands/sonarcloud.md +152 -0
- package/.claude/commands/status.md +77 -0
- package/.claude/commands/validate.md +237 -0
- package/.claude/commands/verify.md +221 -0
- package/.claude/rules/greptile-review-process.md +285 -0
- package/.claude/rules/workflow.md +105 -0
- package/.claude/scripts/greptile-resolve.sh +526 -0
- package/.claude/scripts/load-env.sh +32 -0
- package/.forge/hooks/check-tdd.js +240 -0
- package/.github/PLUGIN_TEMPLATE.json +32 -0
- package/.mcp.json.example +12 -0
- package/AGENTS.md +169 -0
- package/CLAUDE.md +99 -0
- package/LICENSE +21 -0
- package/README.md +414 -0
- package/bin/forge-cmd.js +313 -0
- package/bin/forge-validate.js +303 -0
- package/bin/forge.js +4228 -0
- package/docs/AGENT_INSTALL_PROMPT.md +342 -0
- package/docs/ENHANCED_ONBOARDING.md +602 -0
- package/docs/EXAMPLES.md +482 -0
- package/docs/GREPTILE_SETUP.md +400 -0
- package/docs/MANUAL_REVIEW_GUIDE.md +106 -0
- package/docs/ROADMAP.md +359 -0
- package/docs/SETUP.md +632 -0
- package/docs/TOOLCHAIN.md +849 -0
- package/docs/VALIDATION.md +363 -0
- package/docs/WORKFLOW.md +400 -0
- package/docs/planning/PROGRESS.md +396 -0
- package/docs/plans/.gitkeep +0 -0
- package/docs/plans/2026-02-27-forge-test-suite-v2-decisions.md +21 -0
- package/docs/plans/2026-02-27-forge-test-suite-v2-design.md +362 -0
- package/docs/plans/2026-02-27-forge-test-suite-v2-tasks.md +343 -0
- package/docs/plans/2026-03-02-superpowers-gaps-decisions.md +26 -0
- package/docs/plans/2026-03-02-superpowers-gaps-design.md +239 -0
- package/docs/plans/2026-03-02-superpowers-gaps-tasks.md +260 -0
- package/docs/plans/2026-03-04-agent-command-parity-design.md +163 -0
- package/docs/plans/2026-03-04-verify-worktree-cleanup-decisions.md +7 -0
- package/docs/plans/2026-03-04-verify-worktree-cleanup-design.md +165 -0
- package/docs/plans/2026-03-05-forge-uto-decisions.md +6 -0
- package/docs/plans/2026-03-05-forge-uto-design.md +116 -0
- package/docs/plans/2026-03-05-forge-uto-tasks.md +244 -0
- package/docs/plans/2026-03-10-command-creator-and-eval-decisions.md +52 -0
- package/docs/plans/2026-03-10-command-creator-and-eval-design.md +350 -0
- package/docs/plans/2026-03-10-command-creator-and-eval-tasks.md +426 -0
- package/docs/plans/2026-03-10-stale-workflow-refs-decisions.md +8 -0
- package/docs/plans/2026-03-10-stale-workflow-refs-design.md +80 -0
- package/docs/plans/2026-03-10-stale-workflow-refs-tasks.md +90 -0
- package/docs/plans/2026-03-14-beads-plan-context-decisions.md +9 -0
- package/docs/plans/2026-03-14-beads-plan-context-design.md +171 -0
- package/docs/plans/2026-03-14-beads-plan-context-tasks.md +160 -0
- package/docs/plans/2026-03-14-skill-eval-loop-decisions.md +33 -0
- package/docs/plans/2026-03-14-skill-eval-loop-design.md +118 -0
- package/docs/plans/2026-03-14-skill-eval-loop-results.md +78 -0
- package/docs/plans/2026-03-14-skill-eval-loop-tasks.md +160 -0
- package/docs/plans/2026-03-15-agent-command-parity-v2-decisions.md +11 -0
- package/docs/plans/2026-03-15-agent-command-parity-v2-design.md +145 -0
- package/docs/plans/2026-03-15-agent-command-parity-v2-tasks.md +211 -0
- package/docs/research/TEMPLATE.md +292 -0
- package/docs/research/advanced-testing.md +297 -0
- package/docs/research/agent-permissions.md +167 -0
- package/docs/research/dependency-chain.md +328 -0
- package/docs/research/forge-workflow-v2.md +550 -0
- package/docs/research/plugin-architecture.md +772 -0
- package/docs/research/pr4-cli-automation.md +326 -0
- package/docs/research/premerge-verify-restructure.md +205 -0
- package/docs/research/skills-restructure.md +508 -0
- package/docs/research/sonarcloud-perfection-plan.md +166 -0
- package/docs/research/sonarcloud-quality-gate.md +184 -0
- package/docs/research/superpowers-integration.md +403 -0
- package/docs/research/superpowers.md +319 -0
- package/docs/research/test-environment.md +519 -0
- package/install.sh +1062 -0
- package/lefthook.yml +39 -0
- package/lib/agents/README.md +198 -0
- package/lib/agents/claude.plugin.json +28 -0
- package/lib/agents/cline.plugin.json +22 -0
- package/lib/agents/codex.plugin.json +19 -0
- package/lib/agents/copilot.plugin.json +24 -0
- package/lib/agents/cursor.plugin.json +25 -0
- package/lib/agents/kilocode.plugin.json +22 -0
- package/lib/agents/opencode.plugin.json +20 -0
- package/lib/agents/roo.plugin.json +23 -0
- package/lib/agents-config.js +2112 -0
- package/lib/commands/dev.js +513 -0
- package/lib/commands/plan.js +696 -0
- package/lib/commands/recommend.js +119 -0
- package/lib/commands/ship.js +377 -0
- package/lib/commands/status.js +378 -0
- package/lib/commands/validate.js +602 -0
- package/lib/context-merge.js +359 -0
- package/lib/plugin-catalog.js +360 -0
- package/lib/plugin-manager.js +166 -0
- package/lib/plugin-recommender.js +141 -0
- package/lib/project-discovery.js +491 -0
- package/lib/setup.js +118 -0
- package/lib/workflow-profiles.js +203 -0
- package/package.json +115 -0
|
@@ -0,0 +1,240 @@
|
|
|
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
|
+
/^scripts\//, // build/utility scripts (benchmarks, CI tools)
|
|
64
|
+
/package\.json/,
|
|
65
|
+
/tsconfig/,
|
|
66
|
+
/jest\.config/,
|
|
67
|
+
/vite\.config/,
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
return !excludePatterns.some((pattern) => pattern.test(file));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Find corresponding test file for a source file
|
|
74
|
+
function hasTestFile(sourceFile, stagedFiles) {
|
|
75
|
+
const dir = path.dirname(sourceFile);
|
|
76
|
+
const basename = path.basename(sourceFile, path.extname(sourceFile));
|
|
77
|
+
const ext = path.extname(sourceFile);
|
|
78
|
+
|
|
79
|
+
// Common test patterns (including nested directories)
|
|
80
|
+
const testPatterns = [
|
|
81
|
+
// Colocated tests
|
|
82
|
+
`${basename}.test${ext}`,
|
|
83
|
+
`${basename}.spec${ext}`,
|
|
84
|
+
`${dir}/${basename}.test${ext}`,
|
|
85
|
+
`${dir}/${basename}.spec${ext}`,
|
|
86
|
+
`${dir}/__tests__/${basename}.test${ext}`,
|
|
87
|
+
`${dir}/__tests__/${basename}.spec${ext}`,
|
|
88
|
+
// Top-level test directories
|
|
89
|
+
`test/${basename}.test${ext}`,
|
|
90
|
+
`test/${basename}.spec${ext}`,
|
|
91
|
+
`tests/${basename}.test${ext}`,
|
|
92
|
+
`tests/${basename}.spec${ext}`,
|
|
93
|
+
`__tests__/${basename}.test${ext}`,
|
|
94
|
+
`__tests__/${basename}.spec${ext}`,
|
|
95
|
+
// Nested test directories (unit/integration)
|
|
96
|
+
`test/unit/${basename}.test${ext}`,
|
|
97
|
+
`test/unit/${basename}.spec${ext}`,
|
|
98
|
+
`test/integration/${basename}.test${ext}`,
|
|
99
|
+
`test/integration/${basename}.spec${ext}`,
|
|
100
|
+
`tests/unit/${basename}.test${ext}`,
|
|
101
|
+
`tests/unit/${basename}.spec${ext}`,
|
|
102
|
+
`tests/integration/${basename}.test${ext}`,
|
|
103
|
+
`tests/integration/${basename}.spec${ext}`,
|
|
104
|
+
// Mirror source directory structure (lib/commands/foo.js → test/commands/foo.test.js)
|
|
105
|
+
sourceFile.replace(/^(lib|src)\//, 'test/').replace(ext, `.test${ext}`),
|
|
106
|
+
sourceFile.replace(/^(lib|src)\//, 'test/').replace(ext, `.spec${ext}`),
|
|
107
|
+
sourceFile.replace(/^(lib|src)\//, 'tests/').replace(ext, `.test${ext}`),
|
|
108
|
+
sourceFile.replace(/^(lib|src)\//, 'tests/').replace(ext, `.spec${ext}`),
|
|
109
|
+
// bin/ directory (bin/forge-cmd.js → test/cli/forge-cmd.test.js)
|
|
110
|
+
sourceFile.replace(/^bin\//, 'test/cli/').replace(ext, `.test${ext}`),
|
|
111
|
+
sourceFile.replace(/^bin\//, 'test/cli/').replace(ext, `.spec${ext}`),
|
|
112
|
+
sourceFile.replace(/^bin\//, 'test/bin/').replace(ext, `.test${ext}`),
|
|
113
|
+
sourceFile.replace(/^bin\//, 'test/bin/').replace(ext, `.spec${ext}`),
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
// Check if test file exists in staged files or filesystem
|
|
117
|
+
for (const pattern of testPatterns) {
|
|
118
|
+
if (stagedFiles.includes(pattern)) return true;
|
|
119
|
+
if (fs.existsSync(pattern)) return true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Prompt user for action (handles non-TTY environments like CI/CD)
|
|
126
|
+
function promptUser(question, options) {
|
|
127
|
+
return new Promise((resolve) => {
|
|
128
|
+
// In non-interactive environments (CI/CD), auto-abort to enforce TDD
|
|
129
|
+
if (!process.stdin.isTTY) {
|
|
130
|
+
console.log("\n⚠️ Non-interactive environment detected (CI/CD).");
|
|
131
|
+
console.log("Aborting commit - source files must have tests.");
|
|
132
|
+
console.log("💡 Tip: Use --no-verify to skip this check if needed.");
|
|
133
|
+
resolve("abort");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const rl = readline.createInterface({
|
|
138
|
+
input: process.stdin,
|
|
139
|
+
output: process.stdout,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
console.log("\n" + question);
|
|
143
|
+
options.forEach((opt, i) => {
|
|
144
|
+
console.log(` ${i + 1}. ${opt.label}`);
|
|
145
|
+
});
|
|
146
|
+
console.log();
|
|
147
|
+
|
|
148
|
+
rl.question("Your choice (1-" + options.length + "): ", (answer) => {
|
|
149
|
+
rl.close();
|
|
150
|
+
const choice = parseInt(answer, 10) - 1;
|
|
151
|
+
if (choice >= 0 && choice < options.length) {
|
|
152
|
+
resolve(options[choice].value);
|
|
153
|
+
} else {
|
|
154
|
+
console.log("Invalid choice. Aborting commit.");
|
|
155
|
+
resolve("abort");
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Main hook logic
|
|
162
|
+
async function main() {
|
|
163
|
+
console.log("🔍 TDD Check: Verifying test coverage for staged files...\n");
|
|
164
|
+
|
|
165
|
+
const stagedFiles = getStagedFiles();
|
|
166
|
+
|
|
167
|
+
if (stagedFiles.length === 0) {
|
|
168
|
+
console.log("✓ No staged files to check.");
|
|
169
|
+
process.exit(0);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const sourceFiles = stagedFiles.filter(isSourceFile);
|
|
173
|
+
|
|
174
|
+
if (sourceFiles.length === 0) {
|
|
175
|
+
console.log("✓ No source files staged (only tests/config/docs).");
|
|
176
|
+
process.exit(0);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const filesWithoutTests = sourceFiles.filter(
|
|
180
|
+
(file) => !hasTestFile(file, stagedFiles),
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
if (filesWithoutTests.length === 0) {
|
|
184
|
+
console.log("✓ All source files have corresponding tests!");
|
|
185
|
+
process.exit(0);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Found violations
|
|
189
|
+
console.log("⚠️ Looks like you're committing source code without tests:\n");
|
|
190
|
+
filesWithoutTests.forEach((file) => {
|
|
191
|
+
console.log(` - ${file}`);
|
|
192
|
+
});
|
|
193
|
+
console.log();
|
|
194
|
+
|
|
195
|
+
console.log("📋 TDD Reminder:");
|
|
196
|
+
console.log(" Write tests BEFORE implementation (RED-GREEN-REFACTOR)");
|
|
197
|
+
console.log();
|
|
198
|
+
|
|
199
|
+
const action = await promptUser("What would you like to do?", [
|
|
200
|
+
{ label: "Unstage source files (keep tests staged)", value: "unstage" },
|
|
201
|
+
{ label: "Continue anyway (I have a good reason)", value: "continue" },
|
|
202
|
+
{ label: "Abort commit (let me add tests)", value: "abort" },
|
|
203
|
+
]);
|
|
204
|
+
|
|
205
|
+
switch (action) {
|
|
206
|
+
case "unstage":
|
|
207
|
+
console.log("\n📝 Unstaging source files without tests...");
|
|
208
|
+
filesWithoutTests.forEach((file) => {
|
|
209
|
+
try {
|
|
210
|
+
execFileSync("git", ["reset", "HEAD", file], { stdio: "inherit" });
|
|
211
|
+
console.log(` ✓ Unstaged: ${file}`);
|
|
212
|
+
} catch (_error) {
|
|
213
|
+
console.error(` ✗ Failed to unstage: ${file}`);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
console.log(
|
|
217
|
+
"\nYou can now commit your tests and add source files later.",
|
|
218
|
+
);
|
|
219
|
+
process.exit(0);
|
|
220
|
+
break;
|
|
221
|
+
|
|
222
|
+
case "continue":
|
|
223
|
+
console.log("\n✓ Continuing with commit...");
|
|
224
|
+
console.log("💡 Tip: Use --no-verify to skip this check in emergencies.");
|
|
225
|
+
process.exit(0);
|
|
226
|
+
break;
|
|
227
|
+
|
|
228
|
+
case "abort":
|
|
229
|
+
default:
|
|
230
|
+
console.log("\n❌ Commit aborted. Add tests and try again!");
|
|
231
|
+
console.log("💡 Tip: Use --no-verify to skip this check if needed.");
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Run with error handling
|
|
237
|
+
main().catch((error) => {
|
|
238
|
+
console.error("Error in TDD check hook:", error.message);
|
|
239
|
+
process.exit(1);
|
|
240
|
+
});
|
|
@@ -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
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Project Workflow Instructions
|
|
2
|
+
|
|
3
|
+
## 7-Stage TDD-First Workflow
|
|
4
|
+
|
|
5
|
+
This project enforces a **strict TDD-first development workflow** with 7 stages:
|
|
6
|
+
|
|
7
|
+
| Stage | Command | Purpose | Required For |
|
|
8
|
+
|-------|-------------|-----------------------------------------------------------|--------------|
|
|
9
|
+
| 1 | `/plan` | Design intent → research → branch + worktree + task list | Critical, Standard, Refactor |
|
|
10
|
+
| 2 | `/dev` | Subagent-driven TDD per task (spec + quality review) | All types |
|
|
11
|
+
| 3 | `/validate` | Validate + 4-phase debug mode on failure | All types |
|
|
12
|
+
| 4 | `/ship` | Create PR with documentation | All types |
|
|
13
|
+
| 5 | `/review` | Address ALL PR feedback | Critical, Standard |
|
|
14
|
+
| 6 | `/premerge` | Complete docs on feature branch, hand off PR | All types |
|
|
15
|
+
| 7 | `/verify` | Post-merge health check (CI, deployments) | All types |
|
|
16
|
+
|
|
17
|
+
**Utility**: `/status` — Context check before starting work (not a numbered stage)
|
|
18
|
+
|
|
19
|
+
## Automatic Change Classification
|
|
20
|
+
|
|
21
|
+
When the user requests work, **you MUST automatically classify** the change type:
|
|
22
|
+
|
|
23
|
+
### Critical (Full 7-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:** plan → dev → validate → ship → review → premerge → verify
|
|
27
|
+
|
|
28
|
+
### Standard (6-stage workflow)
|
|
29
|
+
**Triggers:** Normal features, enhancements, new components
|
|
30
|
+
**Example:** "Add user profile page", "Create notification system"
|
|
31
|
+
**Workflow:** plan → dev → validate → ship → review → premerge
|
|
32
|
+
|
|
33
|
+
### Simple (3-stage workflow, skip plan)
|
|
34
|
+
**Triggers:** Bug fixes, UI tweaks, small changes, minor refactors
|
|
35
|
+
**Example:** "Fix button color", "Update validation message", "Adjust padding"
|
|
36
|
+
**Workflow:** dev → validate → ship
|
|
37
|
+
|
|
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 → validate → ship (immediate merge allowed)
|
|
42
|
+
|
|
43
|
+
### Docs (Documentation-only workflow)
|
|
44
|
+
**Triggers:** Documentation updates, README changes, comment improvements
|
|
45
|
+
**Example:** "Update README", "Add API documentation"
|
|
46
|
+
**Workflow:** verify → ship
|
|
47
|
+
|
|
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 → validate → ship → premerge
|
|
52
|
+
|
|
53
|
+
## Enforcement Philosophy
|
|
54
|
+
|
|
55
|
+
**Conversational, not blocking** - Offer solutions when prerequisites are missing:
|
|
56
|
+
|
|
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-deep-research (~5 min)
|
|
60
|
+
2. Use your research if you have it
|
|
61
|
+
3. Skip (not recommended for security features)
|
|
62
|
+
|
|
63
|
+
What would you prefer?"
|
|
64
|
+
|
|
65
|
+
**Create accountability for skips:**
|
|
66
|
+
|
|
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]
|
|
71
|
+
|
|
72
|
+
Proceed?"
|
|
73
|
+
|
|
74
|
+
## TDD Development (Stage 2: /dev)
|
|
75
|
+
|
|
76
|
+
**Subagent-driven per-task implementation loop:**
|
|
77
|
+
|
|
78
|
+
1. **Read task list** → Pre-made task list from `/plan` Phase 3 at `docs/plans/YYYY-MM-DD-<slug>-tasks.md`
|
|
79
|
+
2. **Dispatch implementer subagent per task** → Fresh context, complete task text, relevant design doc sections
|
|
80
|
+
3. **TDD inside implementer** → RED-GREEN-REFACTOR enforced by HARD-GATE:
|
|
81
|
+
- RED: Write failing test first (must run test and show failing output)
|
|
82
|
+
- GREEN: Implement minimal code to pass (must show passing output)
|
|
83
|
+
- REFACTOR: Clean up while keeping tests green
|
|
84
|
+
4. **Spec compliance review** → Spec reviewer checks every task before quality review
|
|
85
|
+
5. **Code quality review** → Quality reviewer checks after spec compliance ✅
|
|
86
|
+
6. **Decision gate** → 7-dimension impact scoring when spec gap found; score routes to PROCEED/SPEC-REVIEWER/BLOCKED
|
|
87
|
+
|
|
88
|
+
**Example execution:**
|
|
89
|
+
```
|
|
90
|
+
/dev starts:
|
|
91
|
+
✓ Read task list: docs/plans/2026-02-26-stripe-billing-tasks.md (8 tasks)
|
|
92
|
+
✓ Created decisions log: docs/plans/2026-02-26-stripe-billing-decisions.md
|
|
93
|
+
|
|
94
|
+
Task 1: Types and interfaces
|
|
95
|
+
✓ Implementer: test written → failing → implementation → passing → committed
|
|
96
|
+
✓ Spec review: ✅
|
|
97
|
+
✓ Quality review: ✅
|
|
98
|
+
Decision gates: 0
|
|
99
|
+
|
|
100
|
+
Task 2: Validation logic
|
|
101
|
+
✓ Implementer: test written → failing → implementation → passing
|
|
102
|
+
⚠️ Decision gate fired (score: 2/14 — PROCEED)
|
|
103
|
+
Gap: Error message format not specified in design doc
|
|
104
|
+
Choice: Use { code, message } object (conservative, documented)
|
|
105
|
+
✓ Spec review: ✅
|
|
106
|
+
✓ Quality review: ✅
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## State Management (Single Source of Truth)
|
|
110
|
+
|
|
111
|
+
**All workflow state stored in Beads metadata** (survives compaction):
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"id": "bd-x7y2",
|
|
116
|
+
"type": "critical",
|
|
117
|
+
"currentStage": "dev",
|
|
118
|
+
"completedStages": ["plan"],
|
|
119
|
+
"skippedStages": [],
|
|
120
|
+
"workflowDecisions": {
|
|
121
|
+
"classification": "critical",
|
|
122
|
+
"reason": "Payment processing, PCI compliance required",
|
|
123
|
+
"userOverride": false
|
|
124
|
+
},
|
|
125
|
+
"parallelTracks": [
|
|
126
|
+
{
|
|
127
|
+
"name": "API endpoints",
|
|
128
|
+
"agent": "backend-architect",
|
|
129
|
+
"status": "in_progress",
|
|
130
|
+
"tddPhase": "GREEN"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Git Hooks (Automatic Enforcement)
|
|
137
|
+
|
|
138
|
+
**Pre-commit hook enforces TDD:**
|
|
139
|
+
- Blocks commits if source code modified without test files
|
|
140
|
+
- Offers guided recovery (add tests now, skip with tech debt tracking, emergency override)
|
|
141
|
+
- No AI decision required - automatic validation
|
|
142
|
+
|
|
143
|
+
**Pre-push hook validates tests:**
|
|
144
|
+
- All tests must pass before push
|
|
145
|
+
- Can skip for hotfixes with documentation
|
|
146
|
+
|
|
147
|
+
## Documentation Index (Context Pointers)
|
|
148
|
+
|
|
149
|
+
**Detailed command instructions** are located in:
|
|
150
|
+
- [.claude/commands/status.md](.claude/commands/status.md) - How to check current context (utility)
|
|
151
|
+
- [.claude/commands/plan.md](.claude/commands/plan.md) - How to plan features (3 phases: design intent + research + branch/worktree/tasks)
|
|
152
|
+
- [.claude/commands/dev.md](.claude/commands/dev.md) - How to implement with subagent-driven TDD and decision gate
|
|
153
|
+
- [.claude/commands/validate.md](.claude/commands/validate.md) - How to run validation (with HARD-GATE exit)
|
|
154
|
+
- [.claude/commands/ship.md](.claude/commands/ship.md) - How to create PRs
|
|
155
|
+
- [.claude/commands/review.md](.claude/commands/review.md) - How to address PR feedback (with HARD-GATE exit)
|
|
156
|
+
- [.claude/commands/premerge.md](.claude/commands/premerge.md) - How to complete docs and hand off PR for merge
|
|
157
|
+
- [.claude/commands/verify.md](.claude/commands/verify.md) - How to verify post-merge health
|
|
158
|
+
|
|
159
|
+
**Planning documents** (created by `/plan`, consumed by `/dev`):
|
|
160
|
+
- `docs/plans/YYYY-MM-DD-<slug>-design.md` - Design intent + technical research
|
|
161
|
+
- `docs/plans/YYYY-MM-DD-<slug>-tasks.md` - Task list with TDD steps
|
|
162
|
+
- `docs/plans/YYYY-MM-DD-<slug>-decisions.md` - Decisions log from /dev
|
|
163
|
+
|
|
164
|
+
**Comprehensive workflow guide:**
|
|
165
|
+
- [docs/WORKFLOW.md](docs/WORKFLOW.md) - Complete workflow documentation (150 lines)
|
|
166
|
+
- [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md) - Tool setup and configuration
|
|
167
|
+
- [docs/VALIDATION.md](docs/VALIDATION.md) - Enforcement and validation details
|
|
168
|
+
|
|
169
|
+
**Load these files when you need detailed instructions for a specific stage.**
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Project Instructions
|
|
2
|
+
|
|
3
|
+
This is a [describe what this project does in one sentence].
|
|
4
|
+
|
|
5
|
+
**Package manager**: Bun (preferred for performance)
|
|
6
|
+
|
|
7
|
+
**Build commands**:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun install # Install dependencies
|
|
11
|
+
bun run dev # Start development
|
|
12
|
+
bun run build # Production build
|
|
13
|
+
bun test # Run tests
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
> **IMPORTANT**: Read [AGENTS.md](AGENTS.md) using the Read tool at the start of every session to load the complete Forge 7-stage workflow, change classification, and detailed stage instructions. AGENTS.md is the single source of truth for the workflow.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## MCP Servers (Enhanced Capabilities)
|
|
25
|
+
|
|
26
|
+
This project uses MCP (Model Context Protocol) servers for enhanced capabilities. If your AI agent supports MCP, set up these servers:
|
|
27
|
+
|
|
28
|
+
**Available MCP servers:**
|
|
29
|
+
|
|
30
|
+
- **Context7**: Up-to-date library documentation and API reference
|
|
31
|
+
- **grep.app**: Search 1M+ GitHub repos for real-world code examples
|
|
32
|
+
|
|
33
|
+
**Setup for your agent:**
|
|
34
|
+
|
|
35
|
+
See [.mcp.json.example](.mcp.json.example) for configuration. Setup varies by agent:
|
|
36
|
+
|
|
37
|
+
- **Claude Code**: Copy `.mcp.json.example` to `.mcp.json` in project root
|
|
38
|
+
- **Cline**: Add MCP servers in VSCode settings (Extensions > Cline > MCP Servers)
|
|
39
|
+
- **Cursor**: Check Cursor Settings > MCP for setup
|
|
40
|
+
- **Your agent**: If MCP-capable, configure using the example file
|
|
41
|
+
|
|
42
|
+
See [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md) for detailed MCP setup instructions.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Toolchain
|
|
47
|
+
|
|
48
|
+
- **Beads** (recommended): Auto-installed during `bunx forge setup` - Git-backed issue tracking
|
|
49
|
+
- **GitHub CLI**: `gh auth login` - PR workflow
|
|
50
|
+
|
|
51
|
+
Setup prompts for Beads during interactive installation. Manual install: see [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Git Workflow
|
|
56
|
+
|
|
57
|
+
This project uses the **Professional Git Workflow** with Lefthook for automated quality gates:
|
|
58
|
+
|
|
59
|
+
**Pre-commit hooks** (automatic):
|
|
60
|
+
- TDD enforcement: Source files must have corresponding tests
|
|
61
|
+
- Interactive prompts: Option to unstage, continue, or abort
|
|
62
|
+
|
|
63
|
+
**Pre-push hooks** (automatic):
|
|
64
|
+
- Branch protection: Blocks direct push to main/master
|
|
65
|
+
- ESLint check: Blocks on errors and warnings (strict mode, `--max-warnings 0`)
|
|
66
|
+
- Test suite: All tests must pass
|
|
67
|
+
|
|
68
|
+
**Pull Request workflow**:
|
|
69
|
+
- PR template auto-fills with standardized format
|
|
70
|
+
- Self-review checklist catches 80% of bugs before review
|
|
71
|
+
- Beads integration: Reference issues with `Closes beads-xxx`
|
|
72
|
+
- **All review comments must be resolved** before merge
|
|
73
|
+
- Squash-only merging: Clean, linear git history
|
|
74
|
+
|
|
75
|
+
**Emergency bypass**:
|
|
76
|
+
```bash
|
|
77
|
+
LEFTHOOK=0 git push # Skip all pre-push hooks
|
|
78
|
+
git commit --no-verify # Skip pre-commit hooks
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**⚠️ Only use bypasses for emergencies.** Document reason in PR description.
|
|
82
|
+
|
|
83
|
+
See [.github/pull_request_template.md](.github/pull_request_template.md) for PR guidelines.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
<!-- USER:START - Add project-specific learnings here as you work -->
|
|
88
|
+
|
|
89
|
+
💡 **Keep this section focused** - Add patterns you discover while working.
|
|
90
|
+
|
|
91
|
+
As you work, when you give the same instruction twice, add it here:
|
|
92
|
+
|
|
93
|
+
- **Scope discipline**: Do ONLY what was explicitly asked. Answer a question → stop. Check something → stop. Never auto-continue to next steps or pending work unless told to.
|
|
94
|
+
- **Stage names**: The validation stage is `/validate` (not `/check`) — renamed in PR #50.
|
|
95
|
+
- **Unused params**: Prefix with `_` (e.g., `_searchTerm`) — ESLint `no-unused-vars` enforced with `--max-warnings 0`.
|
|
96
|
+
- **Pre-push test env**: `test-env/` fixture tests can fail during actual `git push` due to git mid-push state; `LEFTHOOK=0 git push` is the bypass when manual `bun test` confirms 0 fail.
|
|
97
|
+
- **Command sync**: After editing `.claude/commands/*.md`, run `node scripts/sync-commands.js` to update all 7 agent directories. Use `--check` in CI to detect drift. Use `--dry-run` to preview.
|
|
98
|
+
|
|
99
|
+
<!-- USER:END -->
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Harsha Nandak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|