forge-workflow 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.cursorrules +149 -0
  2. package/bin/forge.js +36 -3
  3. package/lib/agents/README.md +46 -1
  4. package/lib/agents/cline.plugin.json +11 -4
  5. package/lib/agents/codex.plugin.json +2 -2
  6. package/lib/agents/copilot.plugin.json +5 -5
  7. package/lib/agents/cursor.plugin.json +1 -1
  8. package/lib/agents/kilocode.plugin.json +1 -1
  9. package/lib/agents/opencode.plugin.json +7 -4
  10. package/lib/agents/roo.plugin.json +10 -3
  11. package/lib/agents-config.js +127 -79
  12. package/lib/codex-skills.js +50 -0
  13. package/lib/commands/_registry.js +40 -1
  14. package/lib/commands/commands-reset.js +147 -0
  15. package/lib/commands/dev.js +26 -0
  16. package/lib/commands/plan.js +18 -0
  17. package/lib/commands/setup.js +4295 -0
  18. package/lib/commands/ship.js +20 -0
  19. package/lib/commands/status.js +210 -44
  20. package/lib/commands/sync.js +17 -1
  21. package/lib/commands/validate.js +13 -0
  22. package/lib/detect-agent.js +38 -8
  23. package/lib/detection-utils.js +405 -0
  24. package/lib/file-utils.js +260 -0
  25. package/lib/forge-context.js +42 -0
  26. package/lib/frontmatter.js +79 -0
  27. package/lib/husky-migration.js +113 -12
  28. package/lib/lefthook-check.js +27 -6
  29. package/lib/plugin-manager.js +225 -72
  30. package/lib/project-discovery.js +39 -5
  31. package/lib/runtime-health.js +305 -0
  32. package/lib/shell-utils.js +50 -0
  33. package/lib/ui-utils.js +43 -0
  34. package/lib/validation-utils.js +163 -0
  35. package/lib/workflow/enforce-stage.js +179 -0
  36. package/lib/workflow/stages.js +201 -0
  37. package/lib/workflow/state.js +332 -0
  38. package/opencode.json +67 -0
  39. package/package.json +15 -5
  40. package/scripts/beads-context.sh +12 -4
  41. package/scripts/check-agents.js +103 -0
  42. package/scripts/pr-coordinator.sh +71 -21
  43. package/scripts/smart-status.sh +21 -11
  44. package/scripts/sync-commands.js +49 -20
  45. package/scripts/test.js +16 -1
package/.cursorrules ADDED
@@ -0,0 +1,149 @@
1
+ # Forge - 7-Stage TDD Workflow
2
+
3
+ A TDD-first workflow for AI coding agents. Ship features with confidence.
4
+
5
+ ## Commands (7 Stages)
6
+
7
+ | Stage | Command | Description |
8
+ |-------|---------|-------------|
9
+ | utility | `/status` | Check current context, active work, recent completions |
10
+ | 1 | `/plan` | Design intent Q&A → research → branch + task list |
11
+ | 2 | `/dev` | Subagent-driven TDD per task (spec + quality review) |
12
+ | 3 | `/validate` | Validation (type/lint/security/tests) |
13
+ | 4 | `/ship` | Create PR with full documentation |
14
+ | 5 | `/review` | Address ALL PR feedback |
15
+ | 6 | `/premerge` | Complete docs on feature branch, hand off PR to user |
16
+ | 7 | `/verify` | Post-merge health check (CI on main) |
17
+
18
+ ## Workflow Flow
19
+
20
+ ```
21
+ /plan → /dev → /validate → /ship → /review → /premerge → /verify
22
+ ```
23
+
24
+ ## Core Principles
25
+
26
+ - **TDD-First**: Write tests BEFORE implementation (RED-GREEN-REFACTOR)
27
+ - **Design-First**: One-question-at-a-time Q&A captures design intent upfront
28
+ - **HARD-GATEs**: Every stage exit has explicit pass criteria — run the commands, show the output
29
+ - **Security Built-In**: OWASP Top 10 analysis for every feature
30
+
31
+ ## Prerequisites
32
+
33
+ - Git, GitHub CLI (`gh`)
34
+ - Beads (recommended): `bun add -g @beads/bd && bd init`
35
+
36
+ ## Quick Start
37
+
38
+ 1. `/status` - Check where you are
39
+ 2. `/plan <feature-slug>` - Design intent → research → branch + task list
40
+ 3. `/dev` - Implement with TDD
41
+ 4. `/validate` - Validate everything
42
+ 5. `/ship` - Create PR
43
+ 6. `/review <pr-number>` - Address all feedback
44
+ 7. `/premerge <pr-number>` - Docs + hand off to user
45
+
46
+ ## Stage Details
47
+
48
+ ### Utility: Status (`/status`)
49
+
50
+ Check current context before starting work:
51
+ - Active issues (via Beads if installed)
52
+ - Recent completions
53
+ - Current branch state
54
+
55
+ ### 1. Plan (`/plan <feature-slug>`)
56
+
57
+ Three phases:
58
+ - **Phase 1**: Design intent Q&A (one-question-at-a-time with user)
59
+ - **Phase 2**: Technical research (web + codebase, OWASP Top 10)
60
+ - **Phase 3**: Create branch + task list (TDD-ordered)
61
+
62
+ ### 2. Development (`/dev`)
63
+
64
+ Subagent-driven TDD per task:
65
+ - Implementer subagent: RED-GREEN-REFACTOR enforced by HARD-GATE
66
+ - Spec compliance reviewer: checks every task
67
+ - Code quality reviewer: checks after spec compliance
68
+ - Decision gate: 7-dimension scoring when spec gap found
69
+
70
+ ### 3. Validate (`/validate`)
71
+
72
+ Validate everything (HARD-GATE exit — fresh output required):
73
+ - Type checking
74
+ - Linting (0 errors, 0 warnings)
75
+ - All tests passing
76
+ - Security scan (OWASP Top 10)
77
+
78
+ ### 4. Ship (`/ship`)
79
+
80
+ Create pull request:
81
+ - Push branch
82
+ - Create PR with design doc reference
83
+ - Link to Beads issue
84
+
85
+ ### 5. Review (`/review <pr-number>`)
86
+
87
+ Address ALL feedback:
88
+ - GitHub Actions failures
89
+ - Greptile inline comments (reply + resolve each)
90
+ - SonarCloud issues
91
+ - Other CI/CD tool feedback
92
+
93
+ ### 6. Premerge (`/premerge <pr-number>`)
94
+
95
+ Complete docs and hand off (NEVER merges):
96
+ - Update CLAUDE.md, AGENTS.md, GEMINI.md, README as needed
97
+ - Commit docs to feature branch
98
+ - Hand off PR URL to user for merge
99
+
100
+ ### 7. Verify (`/verify`)
101
+
102
+ Post-merge health check:
103
+ - CI on main: all checks green
104
+ - Close Beads issue
105
+ - Confirm merge landed
106
+
107
+ ## Directory Structure
108
+
109
+ ```
110
+ your-project/
111
+ ├── AGENTS.md # Universal (Windsurf, Cursor, Kilo, OpenCode, Cline, Roo, Aider)
112
+ ├── CLAUDE.md # Claude Code
113
+ ├── GEMINI.md # Google Antigravity
114
+ ├── .cursorrules # Cursor
115
+
116
+ ├── .claude/commands/ # Claude Code commands
117
+ └── docs/
118
+ ├── plans/
119
+ │ ├── YYYY-MM-DD-<slug>-design.md
120
+ │ └── YYYY-MM-DD-<slug>-tasks.md
121
+ └── TOOLCHAIN.md
122
+ ```
123
+
124
+ ## Supported Agents
125
+
126
+ This workflow works with ALL major AI coding agents:
127
+
128
+ | Agent | Instructions | Commands |
129
+ |-------|-------------|----------|
130
+ | Claude Code | CLAUDE.md | .claude/commands/ |
131
+ | Google Antigravity | GEMINI.md | .agent/workflows/ |
132
+ | Cursor | .cursorrules | .cursor/rules/ |
133
+ | Windsurf | AGENTS.md | .windsurf/workflows/ |
134
+ | Kilo Code | AGENTS.md | .kilocode/workflows/ |
135
+ | OpenCode | AGENTS.md | .opencode/commands/ |
136
+ | Cline | AGENTS.md | - |
137
+ | Roo Code | AGENTS.md | .roo/commands/ |
138
+ | Continue | AGENTS.md | .continue/prompts/ |
139
+ | GitHub Copilot | .github/copilot-instructions.md | .github/prompts/ |
140
+ | Aider | AGENTS.md (via .aider.conf.yml) | In-chat |
141
+ | Codex CLI | AGENTS.md | In-chat |
142
+
143
+ ## License
144
+
145
+ MIT
146
+
147
+ ---
148
+
149
+ See `AGENTS.md` for the complete workflow guide.
package/bin/forge.js CHANGED
@@ -51,7 +51,9 @@ const { scaffoldGithubBeadsSync } = require('../lib/setup');
51
51
  const { copyEssentialDocs } = require('../lib/docs-copy');
52
52
  const { listTopics, getTopicContent } = require('../lib/docs-command');
53
53
  const { resetSoft, resetHard, reinstall } = require('../lib/reset');
54
- const { loadCommands } = require('../lib/commands/_registry');
54
+ const { loadCommands, executeCommand } = require('../lib/commands/_registry');
55
+ const { enforceStageEntry } = require('../lib/workflow/enforce-stage');
56
+ const { normalizeStageId } = require('../lib/workflow/stages');
55
57
 
56
58
  // Load enhanced onboarding modules
57
59
  const contextMerge = require(path.join(packageDir, 'lib', 'context-merge'));
@@ -4159,13 +4161,29 @@ async function main() {
4159
4161
 
4160
4162
  // Registry command dispatch — auto-discovered commands take priority
4161
4163
  if (registry.commands.has(command)) {
4162
- const cmd = registry.commands.get(command);
4163
4164
  try {
4164
- const result = await cmd.handler(args.slice(1), flags, projectRoot);
4165
+ const result = await executeCommand(
4166
+ registry.commands,
4167
+ command,
4168
+ args.slice(1),
4169
+ flags,
4170
+ projectRoot,
4171
+ {
4172
+ enforceStage: (context) => enforceStageEntry({
4173
+ commandName: context.commandName,
4174
+ args: context.args,
4175
+ flags: context.flags,
4176
+ projectRoot: context.projectRoot,
4177
+ }),
4178
+ }
4179
+ );
4165
4180
  if (result && !result.success) {
4166
4181
  console.error(result.error || result.message || 'Command failed');
4167
4182
  process.exit(1);
4168
4183
  }
4184
+ if (result && typeof result.output === 'string' && result.output.length > 0) {
4185
+ process.stdout.write(result.output.endsWith('\n') ? result.output : `${result.output}\n`);
4186
+ }
4169
4187
  } catch (err) {
4170
4188
  console.error(`Error running '${command}':`, err.message);
4171
4189
  process.exit(1);
@@ -4173,6 +4191,21 @@ async function main() {
4173
4191
  return;
4174
4192
  }
4175
4193
 
4194
+ const stageId = normalizeStageId(command);
4195
+ if (stageId) {
4196
+ try {
4197
+ await enforceStageEntry({
4198
+ commandName: stageId,
4199
+ args: args.slice(1),
4200
+ flags,
4201
+ projectRoot,
4202
+ });
4203
+ } catch (err) {
4204
+ console.error(`Error running '${command}':`, err.message);
4205
+ process.exit(1);
4206
+ }
4207
+ }
4208
+
4176
4209
  if (command === 'setup') {
4177
4210
  // Determine agents to install
4178
4211
  let selectedAgents = determineSelectedAgents(flags);
@@ -23,8 +23,21 @@ Each plugin file must follow this structure:
23
23
  "homepage": "https://...", // OPTIONAL: Agent's homepage URL
24
24
  "capabilities": { // OPTIONAL: Agent capabilities
25
25
  "commands": true, // Supports commands
26
+ "rules": true, // Supports rules/instructions
26
27
  "skills": true, // Supports skills
27
- "hooks": false // Supports git hooks
28
+ "mcp": true, // Supports MCP servers
29
+ "contextMode": true, // Supports context isolation/modes
30
+ "hooks": { // Supports hooks and blocking hooks
31
+ "blocking": false
32
+ }
33
+ },
34
+ "support": { // OPTIONAL: Support quality metadata
35
+ "status": "supported", // first-class | supported | compatibility | deprecated | unsupported
36
+ "surface": "cli-first", // cli-first | editor-native | desktop-app | web-app | terminal-native | hybrid
37
+ "install": {
38
+ "required": true, // Requires installation or setup
39
+ "repairRequired": false // Can be repaired in place instead of reinstalled
40
+ }
28
41
  },
29
42
  "directories": { // REQUIRED: Directory structure (at least one)
30
43
  "commands": ".your-agent/commands",
@@ -58,9 +71,27 @@ Each plugin file must follow this structure:
58
71
  - **description**: Short description of the agent
59
72
  - **homepage**: URL to agent's official website
60
73
  - **capabilities**: Object defining what the agent supports
74
+ - **support**: Support tier and enforcement metadata
61
75
  - **files**: Important configuration file paths
62
76
  - **setup**: Installation and setup instructions
63
77
 
78
+ ### Normalized Capability Metadata
79
+
80
+ `PluginManager` exposes a normalized capability block on each loaded plugin at `normalizedCapabilities`:
81
+
82
+ - `nativeSurface`
83
+ - `supportStatus`
84
+ - `commands`
85
+ - `rules`
86
+ - `skills`
87
+ - `mcp`
88
+ - `contextMode`
89
+ - `hooks.blocking`
90
+ - `install.required`
91
+ - `install.repairRequired`
92
+
93
+ Legacy `capabilities.hooks: true/false` values are still accepted and normalized to `hooks.blocking`.
94
+
64
95
  ## Supported Agents
65
96
 
66
97
  Currently supported AI coding agents:
@@ -122,6 +153,8 @@ The PluginManager automatically validates all plugins on load:
122
153
  - **Type checking**: Fields must have correct types
123
154
  - **Unique IDs**: No duplicate plugin IDs allowed
124
155
  - **JSON syntax**: Files must be valid JSON
156
+ - **Support metadata**: `support.status` must be one of `first-class`, `supported`, `compatibility`, `deprecated`, or `unsupported`
157
+ - **Capability metadata**: `capabilities.hooks.blocking`, `capabilities.mcp`, `capabilities.contextMode`, and the other support flags must be booleans when present
125
158
 
126
159
  Run tests to validate your plugin:
127
160
 
@@ -129,6 +162,17 @@ Run tests to validate your plugin:
129
162
  bun test test/plugins/
130
163
  ```
131
164
 
165
+ ### Parity Drift Validation
166
+
167
+ `node scripts/check-agents.js` now validates more than command sync. It also checks parity-critical support claims:
168
+
169
+ - invalid enforcement metadata under `support` and `capabilities`
170
+ - plugins that claim command support without a Forge sync adapter
171
+ - command directory declarations that do not match the sync adapter output path
172
+ - `rules` or `skills` capabilities declared without a scaffold path in `directories`
173
+
174
+ This is the guardrail for keeping agent support honest as vendor integrations evolve.
175
+
132
176
  ## Community Contributions
133
177
 
134
178
  We welcome community contributions for new AI coding agents!
@@ -191,6 +235,7 @@ Common validation errors:
191
235
  - `missing required field "id"`: Add the id field
192
236
  - `"directories" must be an object`: Ensure directories is an object, not array
193
237
  - `"version" must be a string`: Version must be in "x.y.z" format
238
+ - `"support.status" must be one of ...`: Use a supported status value
194
239
  - `Plugin with ID "x" already exists`: Choose a unique ID
195
240
 
196
241
  ## License
@@ -6,17 +6,24 @@
6
6
  "homepage": "https://github.com/cline/cline",
7
7
  "capabilities": {
8
8
  "commands": true,
9
- "skills": true,
9
+ "skills": false,
10
10
  "hooks": false
11
11
  },
12
12
  "directories": {
13
- "workflows": ".cline/workflows",
14
- "skills": ".cline/skills/forge-workflow"
13
+ "workflows": ".cline/workflows"
15
14
  },
16
15
  "files": {
17
16
  "rootConfig": ".clinerules"
18
17
  },
18
+ "support": {
19
+ "status": "deprecated",
20
+ "surface": "editor-native",
21
+ "install": {
22
+ "required": false,
23
+ "repairRequired": false
24
+ }
25
+ },
19
26
  "setup": {
20
- "createSkill": true
27
+ "copyCommands": true
21
28
  }
22
29
  }
@@ -6,7 +6,7 @@
6
6
  "homepage": "https://github.com/openai/codex",
7
7
  "capabilities": {
8
8
  "commands": true,
9
- "skills": false,
9
+ "skills": true,
10
10
  "hooks": false
11
11
  },
12
12
  "directories": {
@@ -14,6 +14,6 @@
14
14
  },
15
15
  "setup": {
16
16
  "copyRules": false,
17
- "createSkill": false
17
+ "createSkill": true
18
18
  }
19
19
  }
@@ -2,23 +2,23 @@
2
2
  "id": "copilot",
3
3
  "name": "GitHub Copilot",
4
4
  "version": "1.0.0",
5
- "description": "GitHub's AI assistant",
5
+ "description": "GitHub's AI assistant with native instructions and prompts",
6
6
  "homepage": "https://github.com/features/copilot",
7
7
  "capabilities": {
8
8
  "commands": true,
9
- "skills": true,
9
+ "skills": false,
10
10
  "hooks": false
11
11
  },
12
12
  "directories": {
13
13
  "prompts": ".github/prompts",
14
- "instructions": ".github/instructions",
15
- "skills": ".github/skills/forge-workflow"
14
+ "instructions": ".github/instructions"
16
15
  },
17
16
  "files": {
18
17
  "rootConfig": ".github/copilot-instructions.md"
19
18
  },
20
19
  "setup": {
21
20
  "needsConversion": true,
22
- "promptFormat": true
21
+ "promptFormat": true,
22
+ "customSetup": "copilot"
23
23
  }
24
24
  }
@@ -2,7 +2,7 @@
2
2
  "id": "cursor",
3
3
  "name": "Cursor",
4
4
  "version": "1.0.0",
5
- "description": "AI-first code editor",
5
+ "description": "AI-first code editor with native rules and skills",
6
6
  "homepage": "https://cursor.sh",
7
7
  "capabilities": {
8
8
  "commands": true,
@@ -2,7 +2,7 @@
2
2
  "id": "kilocode",
3
3
  "name": "Kilo Code",
4
4
  "version": "1.0.0",
5
- "description": "VS Code extension",
5
+ "description": "VS Code extension with native workflows, rules, and skills",
6
6
  "homepage": "https://marketplace.visualstudio.com/items?itemName=kilo-code",
7
7
  "capabilities": {
8
8
  "commands": true,
@@ -2,19 +2,22 @@
2
2
  "id": "opencode",
3
3
  "name": "OpenCode",
4
4
  "version": "1.0.0",
5
- "description": "Open-source agent",
5
+ "description": "Open-source agent with native config and agent definitions",
6
6
  "homepage": "https://opencode.ai",
7
7
  "capabilities": {
8
8
  "commands": true,
9
- "skills": true,
9
+ "skills": false,
10
10
  "hooks": false
11
11
  },
12
12
  "directories": {
13
13
  "commands": ".opencode/commands",
14
- "skills": ".opencode/skills/forge-workflow"
14
+ "agents": ".opencode/agents"
15
+ },
16
+ "files": {
17
+ "rootConfig": "opencode.json"
15
18
  },
16
19
  "setup": {
17
20
  "copyCommands": true,
18
- "createSkill": true
21
+ "customSetup": "opencode"
19
22
  }
20
23
  }
@@ -6,16 +6,23 @@
6
6
  "homepage": "https://github.com/roocode/roo",
7
7
  "capabilities": {
8
8
  "commands": true,
9
- "skills": true,
9
+ "skills": false,
10
10
  "hooks": false
11
11
  },
12
12
  "directories": {
13
- "commands": ".roo/commands",
14
- "skills": ".roo/skills/forge-workflow"
13
+ "commands": ".roo/commands"
15
14
  },
16
15
  "files": {
17
16
  "rootConfig": ".roorules"
18
17
  },
18
+ "support": {
19
+ "status": "deprecated",
20
+ "surface": "editor-native",
21
+ "install": {
22
+ "required": false,
23
+ "repairRequired": false
24
+ }
25
+ },
19
26
  "setup": {
20
27
  "copyCommands": true,
21
28
  "needsConversion": true