@jadeit/forge-ai 0.0.0 → 1.2.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.
Files changed (49) hide show
  1. package/agents/build-agent.md +221 -0
  2. package/agents/deploy-agent.md +256 -0
  3. package/agents/design-agent.md +221 -0
  4. package/agents/feature-dev/approach.md +169 -0
  5. package/agents/feature-dev/clarify.md +131 -0
  6. package/agents/feature-dev/discover.md +113 -0
  7. package/agents/feature-dev/explore.md +124 -0
  8. package/agents/feature-dev/implement.md +200 -0
  9. package/agents/feature-dev/review.md +205 -0
  10. package/agents/feature-dev/summarise.md +187 -0
  11. package/agents/feature-dev/validate.md +211 -0
  12. package/agents/forge-orchestrator.md +188 -0
  13. package/agents/maintain-agent.md +251 -0
  14. package/agents/plan-agent.md +181 -0
  15. package/agents/test-agent.md +215 -0
  16. package/commands/forge-1-plan.md +48 -0
  17. package/commands/forge-2-design.md +51 -0
  18. package/commands/forge-3-build-1-discover.md +34 -0
  19. package/commands/forge-3-build-2-explore.md +30 -0
  20. package/commands/forge-3-build-3-clarify.md +39 -0
  21. package/commands/forge-3-build-4-approach.md +38 -0
  22. package/commands/forge-3-build-5-implement.md +38 -0
  23. package/commands/forge-3-build-6-review.md +50 -0
  24. package/commands/forge-3-build-7-validate.md +49 -0
  25. package/commands/forge-3-build-8-summarise.md +49 -0
  26. package/commands/forge-3-build.md +54 -0
  27. package/commands/forge-4-test.md +45 -0
  28. package/commands/forge-5-deploy.md +50 -0
  29. package/commands/forge-6-maintain.md +66 -0
  30. package/commands/forge-init.md +111 -0
  31. package/commands/forge-status.md +94 -0
  32. package/commands/forge.md +77 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +168 -2
  35. package/dist/index.js.map +1 -1
  36. package/package.json +7 -3
  37. package/skills/forge-context-loader/SKILL.md +99 -0
  38. package/skills/forge-quality-checker/SKILL.md +227 -0
  39. package/skills/forge-state-manager/SKILL.md +235 -0
  40. package/skills/forge-template-loader/SKILL.md +162 -0
  41. package/templates/defects/DEFECT_TEMPLATE.md +96 -0
  42. package/templates/design/design-decisions.md +64 -0
  43. package/templates/design/task-list.md +56 -0
  44. package/templates/design/tasks/TASK_TEMPLATE.md +87 -0
  45. package/templates/planning/implementation-plan.md +59 -0
  46. package/templates/planning/project-scope.md +53 -0
  47. package/templates/planning/technology-and-architecture.md +80 -0
  48. package/templates/planning/user-stories.md +48 -0
  49. package/templates/testing/uat-results.md +68 -0
package/dist/index.js CHANGED
@@ -1,5 +1,171 @@
1
- export const ForgeAI = async () => {
2
- return {};
1
+ import { readFileSync, existsSync } from "fs";
2
+ import { join } from "path";
3
+ const FORGE_OVERVIEW = `# Forge AI - Structured AI-Augmented Coding
4
+
5
+ Forge AI is a structured methodology for AI-augmented coding built on 6 project phases.
6
+
7
+ ## Phase Commands
8
+
9
+ | Command | Description |
10
+ |---------|-------------|
11
+ | /forge-1-plan | Phase 1: Planning |
12
+ | /forge-2-design | Phase 2: Design |
13
+ | /forge-3-build | Phase 3: Development |
14
+ | /forge-4-test | Phase 4: Testing |
15
+ | /forge-5-deploy | Phase 5: Deployment |
16
+ | /forge-6-maintain | Phase 6: Maintenance |
17
+
18
+ ## Feature Dev Sub-Commands (Phase 3)
19
+
20
+ | Command | Description |
21
+ |---------|-------------|
22
+ | /forge-3-build-1-discover | Understand what needs to be built |
23
+ | /forge-3-build-2-explore | Explore relevant existing code |
24
+ | /forge-3-build-3-clarify | Resolve ambiguities |
25
+ | /forge-3-build-4-approach | Design/validate approach |
26
+ | /forge-3-build-5-implement | Build the feature |
27
+ | /forge-3-build-6-review | Quality review |
28
+ | /forge-3-build-7-validate | Test validation |
29
+ | /forge-3-build-8-summarise | Document accomplishments |
30
+
31
+ ## Utility Commands
32
+
33
+ | Command | Description |
34
+ |---------|-------------|
35
+ | /forge-init | Initialize Forge in a new project |
36
+ | /forge-status | Diagnose and recover from state inconsistencies |
37
+
38
+ To use a command, invoke the corresponding tool below (e.g., \`forge_plan\`).
39
+ `;
40
+ function getPackageDir() {
41
+ return join(import.meta.dirname || "", "..");
42
+ }
43
+ function readCommandFile(filename) {
44
+ const packageDir = getPackageDir();
45
+ const filePath = join(packageDir, "commands", filename);
46
+ if (existsSync(filePath)) {
47
+ return readFileSync(filePath, "utf-8");
48
+ }
49
+ return null;
50
+ }
51
+ function readAgentFile(agentName) {
52
+ const packageDir = getPackageDir();
53
+ const filePath = join(packageDir, "agents", `${agentName}.md`);
54
+ if (existsSync(filePath)) {
55
+ return readFileSync(filePath, "utf-8");
56
+ }
57
+ return null;
58
+ }
59
+ function stripFrontmatter(content) {
60
+ if (content.startsWith("---")) {
61
+ const endIndex = content.indexOf("---", 3);
62
+ if (endIndex !== -1) {
63
+ return content.slice(endIndex + 3).trim();
64
+ }
65
+ }
66
+ return content;
67
+ }
68
+ export const ForgeAI = async ({ client }) => {
69
+ const injectForgeOverview = async () => {
70
+ try {
71
+ const sessionId = (await client.session.list())?.data?.[0]?.id;
72
+ if (sessionId) {
73
+ await client.session.prompt({
74
+ path: { id: sessionId },
75
+ body: { parts: [{ type: "text", text: FORGE_OVERVIEW }] },
76
+ });
77
+ }
78
+ }
79
+ catch {
80
+ }
81
+ };
82
+ const forgeTool = (name, commandFile, agentFile) => ({
83
+ description: `Invoke Forge ${name} - Use this to start or continue Phase ${name}`,
84
+ args: {},
85
+ async execute(_args, context) {
86
+ const commandContent = readCommandFile(commandFile);
87
+ const agentContent = readAgentFile(agentFile);
88
+ const content = [
89
+ commandContent ? `## Command\n\n${stripFrontmatter(commandContent)}` : "",
90
+ agentContent ? `## Agent Instructions\n\n${stripFrontmatter(agentContent)}` : "",
91
+ ].filter(Boolean).join("\n\n");
92
+ return content || `Forge ${name} activated. No content found.`;
93
+ },
94
+ });
95
+ const forgeSubTool = (name, commandFile, description) => ({
96
+ description,
97
+ args: {},
98
+ async execute() {
99
+ const commandContent = readCommandFile(commandFile);
100
+ if (commandContent) {
101
+ return stripFrontmatter(commandContent);
102
+ }
103
+ return `Forge ${name} activated. No content found.`;
104
+ },
105
+ });
106
+ return {
107
+ "session.created": injectForgeOverview,
108
+ "session.compacted": injectForgeOverview,
109
+ tool: {
110
+ forge_plan: forgeTool("Plan", "forge-1-plan.md", "plan-agent.md"),
111
+ forge_design: forgeTool("Design", "forge-2-design.md", "design-agent.md"),
112
+ forge_build: forgeTool("Build", "forge-3-build.md", "build-agent.md"),
113
+ forge_test: forgeTool("Test", "forge-4-test.md", "test-agent.md"),
114
+ forge_deploy: forgeTool("Deploy", "forge-5-deploy.md", "deploy-agent.md"),
115
+ forge_maintain: forgeTool("Maintain", "forge-6-maintain.md", "maintain-agent.md"),
116
+ forge_init: {
117
+ description: "Initialize Forge in current project - Creates .forge directory and state file",
118
+ args: {},
119
+ async execute(_args, context) {
120
+ const { worktree, directory } = context;
121
+ const targetDir = worktree || directory;
122
+ const forgeDir = join(targetDir, ".forge");
123
+ const stateFile = join(forgeDir, "state.yaml");
124
+ const initContent = `# Forge State
125
+ phase: planning
126
+ phaseStatus: not_started
127
+ features: []
128
+ lastUpdated: ${new Date().toISOString()}
129
+ `;
130
+ try {
131
+ await Bun.$ `mkdir -p ${forgeDir}`.quiet();
132
+ await Bun.$ `cat > ${stateFile} ${initContent}`.quiet();
133
+ }
134
+ catch {
135
+ return "Failed to initialize Forge. Ensure you have write permissions.";
136
+ }
137
+ return `Forge initialized at ${targetDir}`;
138
+ },
139
+ },
140
+ forge_status: {
141
+ description: "Show current Forge status - phase, features, and progress",
142
+ args: {},
143
+ async execute(_args, context) {
144
+ const { worktree, directory } = context;
145
+ const targetDir = worktree || directory;
146
+ const stateFile = join(targetDir, ".forge", "state.yaml");
147
+ if (!existsSync(stateFile)) {
148
+ return "Forge not initialized. Run /forge-init or use forge_init tool first.";
149
+ }
150
+ try {
151
+ const content = readFileSync(stateFile, "utf-8");
152
+ return `## Forge Status\n\n${content}`;
153
+ }
154
+ catch {
155
+ return "Failed to read Forge state.";
156
+ }
157
+ },
158
+ },
159
+ forge_3_build_1_discover: forgeSubTool("Build-1-Discover", "forge-3-build-1-discover.md", "Phase 3 Step 1: Understand what needs to be built"),
160
+ forge_3_build_2_explore: forgeSubTool("Build-2-Explore", "forge-3-build-2-explore.md", "Phase 3 Step 2: Explore relevant existing code"),
161
+ forge_3_build_3_clarify: forgeSubTool("Build-3-Clarify", "forge-3-build-3-clarify.md", "Phase 3 Step 3: Resolve ambiguities"),
162
+ forge_3_build_4_approach: forgeSubTool("Build-4-Approach", "forge-3-build-4-approach.md", "Phase 3 Step 4: Design/validate approach"),
163
+ forge_3_build_5_implement: forgeSubTool("Build-5-Implement", "forge-3-build-5-implement.md", "Phase 3 Step 5: Build the feature"),
164
+ forge_3_build_6_review: forgeSubTool("Build-6-Review", "forge-3-build-6-review.md", "Phase 3 Step 6: Quality review"),
165
+ forge_3_build_7_validate: forgeSubTool("Build-7-Validate", "forge-3-build-7-validate.md", "Phase 3 Step 7: Test validation"),
166
+ forge_3_build_8_summarise: forgeSubTool("Build-8-Summarise", "forge-3-build-8-summarise.md", "Phase 3 Step 8: Document accomplishments"),
167
+ },
168
+ };
3
169
  };
4
170
  export default ForgeAI;
5
171
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAW,KAAK,IAAI,EAAE;IACxC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCtB,CAAC;AAEF,SAAS,aAAa;IACpB,OAAO,I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CAA0C,CAAC;YACrI,yBAAyB,EAAE,YAAY,CAAC,mBAAmB,EAAE,8BAA8B,EAAE,mCAAmC,CAAC;YACjI,sBAAsB,EAAE,YAAY,CAAC,gBAAgB,EAAE,2BAA2B,EAAE,gCAAgC,CAAC;YACrH,wBAAwB,EAAE,YAAY,CAAC,kBAAkB,EAAE,6BAA6B,EAAE,iCAAiC,CAAC;YAC5H,yBAAyB,EAAE,YAAY,CAAC,mBAAmB,EAAE,8BAA8B,EAAE,0CAA0C,CAAC;SACzI;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jadeit/forge-ai",
3
- "version": "0.0.0",
3
+ "version": "1.2.1",
4
4
  "description": "Forge AI - Structured AI-augmented coding methodology for OpenCode",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -8,7 +8,11 @@
8
8
  ".": "./dist/index.js"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "dist",
12
+ "agents",
13
+ "commands",
14
+ "skills",
15
+ "templates"
12
16
  ],
13
17
  "scripts": {
14
18
  "build": "bun run build.ts",
@@ -32,7 +36,7 @@
32
36
  "license": "MIT",
33
37
  "repository": {
34
38
  "type": "git",
35
- "url": "https://github.com/jadeit/forge-ai.git"
39
+ "url": "git+https://github.com/jadeit/forge-ai.git"
36
40
  },
37
41
  "publishConfig": {
38
42
  "access": "public"
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: forge-context-loader
3
+ description: Load minimum necessary context for Forge operations based on current phase
4
+ license: MIT
5
+ compatibility: opencode
6
+ metadata:
7
+ audience: forge-users
8
+ workflow: phase-execution
9
+ ---
10
+
11
+ # Forge Context Loader
12
+
13
+ Load the **minimum context needed** for the current Forge operation, not everything the project has ever produced.
14
+
15
+ ## Context Loading Rules
16
+
17
+ | Phase | Load These |
18
+ |-------|-----------|
19
+ | `forge 1:plan` | User input, existing README or project brief |
20
+ | `forge 2:design` | All Phase 1 outputs. Existing codebase structure if applicable |
21
+ | `forge 3:build` | Specific task doc, technology & architecture doc, relevant source files |
22
+ | `forge 4:test` | User stories, task docs for implemented features, test results |
23
+ | `forge 5:deploy` | Technology & architecture doc, infrastructure-related task docs |
24
+ | `forge 6:maintain` | Specific error/incident context, relevant source files, defect history |
25
+
26
+ ## Context by Sub-Phase
27
+
28
+ | Sub-Phase | Additional Context |
29
+ |-----------|-------------------|
30
+ | `3:build 1:discover` | Task document, state file |
31
+ | `3:build 2:explore` | Affected modules from task, existing codebase |
32
+ | `3:build 3:clarify` | Discovery findings, exploration notes |
33
+ | `3:build 4:approach` | Task document, design decisions |
34
+ | `3:build 5:implement` | Task document, approach plan |
35
+ | `3:build 6:review` | Implementation, test files, lint config |
36
+ | `3:build 7:validate` | Task document, test files, coverage reports |
37
+ | `3:build 8:summarise` | All phase artifacts |
38
+
39
+ ## Usage
40
+
41
+ ### Loading Context for Phase 1
42
+ ```
43
+ Read: README.md, PROJECT_SCOPE.md (if exists)
44
+ ```
45
+
46
+ ### Loading Context for Phase 2
47
+ ```
48
+ Read: docs/planning/project-scope.md
49
+ Read: docs/planning/user-stories.md
50
+ Read: docs/planning/implementation-plan.md
51
+ Read: docs/planning/technology-and-architecture.md
52
+ Glob: src/**/* (codebase structure)
53
+ ```
54
+
55
+ ### Loading Context for Feature Dev
56
+ ```
57
+ Read: .forge/state.yaml
58
+ Read: docs/planning/technology-and-architecture.md
59
+ Read: docs/design/tasks/{task-slug}.md
60
+ Glob: {affected_modules} (from task frontmatter)
61
+ ```
62
+
63
+ ## Context Budget
64
+
65
+ Read `.forge/config.yaml` for context_budget settings:
66
+ ```yaml
67
+ context_budget:
68
+ warning_threshold: 150000 # Warn if exceeded
69
+ max_threshold: 180000 # Hard limit
70
+ ```
71
+
72
+ ### If Context Exceeds Threshold
73
+
74
+ 1. **Warn the user** about the exceeded context budget
75
+ 2. **Suggest trimming strategies:**
76
+ - Focus on most recent changes
77
+ - Remove boilerplate and generated files
78
+ - Exclude node_modules, vendor, etc.
79
+ 3. **Prioritise:**
80
+ - Task document over other documents
81
+ - Core business logic over infrastructure
82
+ - Tests for the specific feature over full test suite
83
+
84
+ ## Implementation
85
+
86
+ Use Glob and Grep to identify relevant files:
87
+
88
+ ```bash
89
+ # Get affected modules from task frontmatter
90
+ # Glob those directories
91
+ # Grep for key patterns if needed
92
+ ```
93
+
94
+ ## Principles
95
+
96
+ 1. **Minimum Viable Context** - Only load what is necessary
97
+ 2. **Lazy Loading** - Load files when needed, not upfront
98
+ 3. **Incremental** - Context grows as you progress through sub-phases
99
+ 4. **Clean State** - Reset context when starting new phases/tasks
@@ -0,0 +1,227 @@
1
+ ---
2
+ name: forge-quality-checker
3
+ description: Run quality gates for Forge Phase 3 - linting, type checking, security, coverage
4
+ license: MIT
5
+ compatibility: opencode
6
+ metadata:
7
+ audience: forge-users
8
+ workflow: build-phase
9
+ ---
10
+
11
+ # Forge Quality Checker
12
+
13
+ Run quality gates for Feature Development (Phase 3).
14
+
15
+ ## Quality Thresholds
16
+
17
+ Read from `.forge/config.yaml`:
18
+ ```yaml
19
+ quality:
20
+ test_coverage_minimum: 80
21
+ lint_must_pass: true
22
+ type_check_must_pass: true
23
+ security_audit_must_pass: true
24
+ ```
25
+
26
+ ## Quality Gate Sequence
27
+
28
+ Run in this order - fail fast:
29
+
30
+ ```
31
+ 1. Lint Check
32
+ ↓ (if pass)
33
+ 2. Type Check
34
+ ↓ (if pass)
35
+ 3. Security Audit
36
+ ↓ (if pass)
37
+ 4. Tests
38
+ ↓ (if pass)
39
+ 5. Coverage Check
40
+ ↓ (if pass)
41
+ 6. AI Code Review
42
+ ```
43
+
44
+ ## Gate Definitions
45
+
46
+ ### 1. Lint Check
47
+
48
+ Run the project's linter:
49
+ ```bash
50
+ # Python
51
+ npm run lint # or ruff, pylint, etc.
52
+
53
+ # JavaScript/TypeScript
54
+ npm run lint
55
+
56
+ # Multiple
57
+ npm run lint && npm run lint:style
58
+ ```
59
+
60
+ **Gate:** Must pass (exit code 0)
61
+
62
+ ### 2. Type Check
63
+
64
+ Run the project's type checker:
65
+ ```bash
66
+ # TypeScript
67
+ npx tsc --noEmit
68
+
69
+ # Python
70
+ npm run typecheck # or mypy, pyright
71
+ ```
72
+
73
+ **Gate:** Must pass (exit code 0)
74
+
75
+ ### 3. Security Audit
76
+
77
+ Run security checks:
78
+ ```bash
79
+ # npm
80
+ npm audit
81
+
82
+ # pip
83
+ pip-audit
84
+
85
+ # Docker
86
+ trivy image [image-name]
87
+ ```
88
+
89
+ **Gate:** Must pass (no critical/high vulnerabilities, or all acknowledged)
90
+
91
+ ### 4. Tests
92
+
93
+ Run the test suite:
94
+ ```bash
95
+ npm test
96
+ # or
97
+ pytest
98
+ ```
99
+
100
+ **Gate:** All tests must pass (no failures)
101
+
102
+ ### 5. Coverage Check
103
+
104
+ Run tests with coverage:
105
+ ```bash
106
+ # Jest
107
+ npm run test:coverage
108
+
109
+ # pytest
110
+ pytest --cov=. --cov-report=term-missing
111
+ ```
112
+
113
+ **Gate:** Coverage >= configured minimum (default 80%)
114
+
115
+ ## Tool Detection
116
+
117
+ Detect available tools automatically:
118
+
119
+ | File | Tool |
120
+ |------|------|
121
+ | `package.json` | npm, jest, eslint, tsc |
122
+ | `pyproject.toml` | pytest, ruff, mypy |
123
+ | `Dockerfile` | hadolint, trivy |
124
+ | `Makefile` | make targets |
125
+
126
+ ## Language-Specific Guidelines
127
+
128
+ ### Python
129
+
130
+ - Use `ruff` for linting and formatting
131
+ - Use `mypy` or `pyright` for type checking
132
+ - Use `pytest` for testing
133
+ - Use `bandit` for security
134
+
135
+ ### JavaScript/TypeScript
136
+
137
+ - Use `eslint` for linting
138
+ - Use `typescript` (tsc) for type checking
139
+ - Use `jest` or `vitest` for testing
140
+ - Use `npm audit` for security
141
+
142
+ ### Multi-language Projects
143
+
144
+ Run all applicable tools:
145
+ ```bash
146
+ # Run all checks
147
+ npm run lint && npm run typecheck && npm test
148
+ ruff check .
149
+ mypy src/
150
+ ```
151
+
152
+ ## AI Code Review
153
+
154
+ After automated checks pass, perform AI review:
155
+
156
+ ### SOLID Principles Check
157
+
158
+ - **S**ingle Responsibility: Does each module do one thing?
159
+ - **O**pen/Closed: Open for extension, closed for modification?
160
+ - **L**iskov Substitution: Can subtypes replace base types?
161
+ - **I**nterface Segregation: Are interfaces small and focused?
162
+ - **D**ependency Inversion: Depend on abstractions?
163
+
164
+ ### Design Patterns Check
165
+
166
+ Are established patterns used appropriately?
167
+ - Factory, Builder, Singleton
168
+ - Repository, Unit of Work
169
+ - Observer, Strategy
170
+
171
+ ### Error Handling Check
172
+
173
+ - Are errors caught and handled appropriately?
174
+ - Are exceptions used for exceptional cases only?
175
+ - Is error context preserved?
176
+
177
+ ### Security Check (Manual)
178
+
179
+ - Input validation on all user inputs
180
+ - Authentication/authorization properly enforced
181
+ - Secrets not logged or exposed
182
+ - SQL injection, XSS, CSRF addressed
183
+
184
+ ## Reporting
185
+
186
+ ### Pass Report
187
+
188
+ ```
189
+ Quality Gates: PASSED
190
+
191
+ ✓ Lint Check - No issues
192
+ ✓ Type Check - No errors
193
+ ✓ Security Audit - No vulnerabilities
194
+ ✓ Tests - 42 passed, 0 failed
195
+ ✓ Coverage - 87% (threshold: 80%)
196
+
197
+ AI Code Review: PASSED
198
+ - SOLID compliance: ✓
199
+ - Design patterns: ✓
200
+ - Error handling: ✓
201
+ - Security: ✓
202
+
203
+ Ready to proceed.
204
+ ```
205
+
206
+ ### Fail Report
207
+
208
+ ```
209
+ Quality Gates: FAILED
210
+
211
+ ✗ Lint Check - 3 issues found
212
+ - src/auth.ts:45 - Unused variable 'temp'
213
+ - src/utils.ts:12 - Line too long (85 > 80)
214
+ - src/api.ts:78 - Missing semicolon
215
+
216
+ Fix required before proceeding.
217
+ ```
218
+
219
+ ## Rework Routing
220
+
221
+ | Issue Type | Route To |
222
+ |------------|----------|
223
+ | Lint/type errors | `forge 3:build 5:implement` |
224
+ | Test failures | `forge 3:build 5:implement` |
225
+ | Coverage below threshold | `forge 3:build 5:implement` |
226
+ | Design flaw | `forge 3:build 4:approach` |
227
+ | Security vulnerability | `forge 3:build 5:implement` (critical) or `forge 3:build 4:approach` |