@jadeit/forge-ai 0.0.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/README.md +57 -0
- package/dist/agents/build-agent.md +221 -0
- package/dist/agents/deploy-agent.md +256 -0
- package/dist/agents/design-agent.md +221 -0
- package/dist/agents/feature-dev/approach.md +169 -0
- package/dist/agents/feature-dev/clarify.md +131 -0
- package/dist/agents/feature-dev/discover.md +113 -0
- package/dist/agents/feature-dev/explore.md +124 -0
- package/dist/agents/feature-dev/implement.md +200 -0
- package/dist/agents/feature-dev/review.md +205 -0
- package/dist/agents/feature-dev/summarise.md +187 -0
- package/dist/agents/feature-dev/validate.md +211 -0
- package/dist/agents/forge-orchestrator.md +188 -0
- package/dist/agents/maintain-agent.md +251 -0
- package/dist/agents/plan-agent.md +181 -0
- package/dist/agents/test-agent.md +215 -0
- package/dist/commands/forge-1-plan.md +48 -0
- package/dist/commands/forge-2-design.md +51 -0
- package/dist/commands/forge-3-build-1-discover.md +34 -0
- package/dist/commands/forge-3-build-2-explore.md +30 -0
- package/dist/commands/forge-3-build-3-clarify.md +39 -0
- package/dist/commands/forge-3-build-4-approach.md +38 -0
- package/dist/commands/forge-3-build-5-implement.md +38 -0
- package/dist/commands/forge-3-build-6-review.md +50 -0
- package/dist/commands/forge-3-build-7-validate.md +49 -0
- package/dist/commands/forge-3-build-8-summarise.md +49 -0
- package/dist/commands/forge-3-build.md +54 -0
- package/dist/commands/forge-4-test.md +45 -0
- package/dist/commands/forge-5-deploy.md +50 -0
- package/dist/commands/forge-6-maintain.md +66 -0
- package/dist/commands/forge-init.md +111 -0
- package/dist/commands/forge-status.md +94 -0
- package/dist/commands/forge.md +77 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/skills/forge-context-loader/SKILL.md +99 -0
- package/dist/skills/forge-quality-checker/SKILL.md +227 -0
- package/dist/skills/forge-state-manager/SKILL.md +235 -0
- package/dist/skills/forge-template-loader/SKILL.md +162 -0
- package/dist/templates/defects/DEFECT_TEMPLATE.md +96 -0
- package/dist/templates/design/design-decisions.md +64 -0
- package/dist/templates/design/task-list.md +56 -0
- package/dist/templates/design/tasks/TASK_TEMPLATE.md +87 -0
- package/dist/templates/planning/implementation-plan.md +59 -0
- package/dist/templates/planning/project-scope.md +53 -0
- package/dist/templates/planning/technology-and-architecture.md +80 -0
- package/dist/templates/planning/user-stories.md +48 -0
- package/dist/templates/testing/uat-results.md +68 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +40 -0
|
@@ -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` |
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: forge-state-manager
|
|
3
|
+
description: Manage Forge state transitions, phase tracking, feature status, and git hooks
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
audience: forge-users
|
|
8
|
+
workflow: phase-execution
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Forge State Manager
|
|
12
|
+
|
|
13
|
+
Manage Forge state transitions, phase tracking, feature status, and git commit hooks.
|
|
14
|
+
|
|
15
|
+
## State File Location
|
|
16
|
+
|
|
17
|
+
`.forge/state.yaml`
|
|
18
|
+
|
|
19
|
+
## State Structure
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
project_phase: 1
|
|
23
|
+
phase_history:
|
|
24
|
+
- phase: 1
|
|
25
|
+
status: complete
|
|
26
|
+
started: 2026-03-20T10:00:00Z
|
|
27
|
+
completed: 2026-03-22T14:00:00Z
|
|
28
|
+
|
|
29
|
+
features:
|
|
30
|
+
auth-system:
|
|
31
|
+
phase: 3
|
|
32
|
+
mode: brownfield
|
|
33
|
+
started: 2026-03-22T14:00:00Z
|
|
34
|
+
current_sub_phase: 5_implement
|
|
35
|
+
rework_tracking:
|
|
36
|
+
implement_loops: 0
|
|
37
|
+
approach_loops: 0
|
|
38
|
+
history: []
|
|
39
|
+
commits: []
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Operations
|
|
43
|
+
|
|
44
|
+
### 1. Read Current State
|
|
45
|
+
|
|
46
|
+
Read `.forge/state.yaml` to understand:
|
|
47
|
+
- Current project phase
|
|
48
|
+
- Phase history and completion status
|
|
49
|
+
- Active features and their sub-phase
|
|
50
|
+
|
|
51
|
+
### 2. Update Phase Status
|
|
52
|
+
|
|
53
|
+
When completing a phase:
|
|
54
|
+
```yaml
|
|
55
|
+
phase_history:
|
|
56
|
+
- phase: 1
|
|
57
|
+
status: complete
|
|
58
|
+
started: 2026-03-20T10:00:00Z
|
|
59
|
+
completed: 2026-03-22T14:00:00Z
|
|
60
|
+
- phase: 2
|
|
61
|
+
status: in-progress
|
|
62
|
+
started: 2026-03-22T14:00:00Z
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 3. Update Feature Status
|
|
66
|
+
|
|
67
|
+
When working on a feature:
|
|
68
|
+
```yaml
|
|
69
|
+
features:
|
|
70
|
+
feature-slug:
|
|
71
|
+
phase: 3
|
|
72
|
+
mode: brownfield
|
|
73
|
+
started: 2026-03-22T14:00:00Z
|
|
74
|
+
current_sub_phase: 5_implement
|
|
75
|
+
task_document: docs/design/tasks/feature-slug.md
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 4. Update Task Status
|
|
79
|
+
|
|
80
|
+
In task document frontmatter:
|
|
81
|
+
```yaml
|
|
82
|
+
status: in-progress:approach # When in approach phase
|
|
83
|
+
status: complete # When done
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Phase Transition Process
|
|
87
|
+
|
|
88
|
+
### Before Transition
|
|
89
|
+
|
|
90
|
+
1. **Check artifact completeness** for current phase:
|
|
91
|
+
- Phase 1: project-scope.md, user-stories.md, implementation-plan.md, technology-and-architecture.md
|
|
92
|
+
- Phase 2: design-decisions.md, task-list.md, all task documents with required frontmatter
|
|
93
|
+
- Phase 3: Task implementation complete, review passes, validation passes
|
|
94
|
+
- Phase 4: UAT results documented, user sign-off obtained
|
|
95
|
+
- Phase 5: Deployment verified
|
|
96
|
+
- Phase 6: Monitoring active
|
|
97
|
+
|
|
98
|
+
2. **Propose transition** to user:
|
|
99
|
+
```
|
|
100
|
+
Phase 1 complete — all required artifacts found:
|
|
101
|
+
- ✓ docs/planning/project-scope.md
|
|
102
|
+
- ✓ docs/planning/user-stories.md
|
|
103
|
+
- ✓ docs/planning/implementation-plan.md
|
|
104
|
+
- ✓ docs/planning/technology-and-architecture.md
|
|
105
|
+
|
|
106
|
+
Confirm transition to Phase 2: Design?
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
3. **Wait for confirmation** before updating state
|
|
110
|
+
|
|
111
|
+
### After Confirmation
|
|
112
|
+
|
|
113
|
+
Update `.forge/state.yaml` with new phase and history entry
|
|
114
|
+
|
|
115
|
+
## Prerequisite Checking
|
|
116
|
+
|
|
117
|
+
### Check Function
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
function check_prerequisites(current_phase: int, target_phase: int) -> tuple[bool, list[str]]:
|
|
121
|
+
missing = []
|
|
122
|
+
if target_phase > 1 and current_phase < 1:
|
|
123
|
+
missing.append("Phase 1 (Planning) must be complete")
|
|
124
|
+
if target_phase > 2 and current_phase < 2:
|
|
125
|
+
missing.append("Phase 2 (Design) must be complete")
|
|
126
|
+
# ... etc
|
|
127
|
+
return (len(missing) == 0, missing)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Gate Behaviour
|
|
131
|
+
|
|
132
|
+
From `.forge/config.yaml`:
|
|
133
|
+
```yaml
|
|
134
|
+
gates:
|
|
135
|
+
warn_on_prerequisite_failure: true
|
|
136
|
+
allow_override: true
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
If prerequisites not met:
|
|
140
|
+
1. **Warn** the user about missing prerequisites
|
|
141
|
+
2. **List** what's missing
|
|
142
|
+
3. **Allow override** if user confirms to proceed anyway
|
|
143
|
+
|
|
144
|
+
## Feature Dev Sub-Phase Tracking
|
|
145
|
+
|
|
146
|
+
Track progress through Feature Dev sub-phases in state:
|
|
147
|
+
```yaml
|
|
148
|
+
features:
|
|
149
|
+
feature-slug:
|
|
150
|
+
current_sub_phase: 5_implement
|
|
151
|
+
sub_phase_history:
|
|
152
|
+
- sub_phase: 1_discover
|
|
153
|
+
status: complete
|
|
154
|
+
completed: 2026-03-22T14:30:00Z
|
|
155
|
+
- sub_phase: 2_explore
|
|
156
|
+
status: complete
|
|
157
|
+
completed: 2026-03-22T15:00:00Z
|
|
158
|
+
- sub_phase: 3_clarify
|
|
159
|
+
status: complete
|
|
160
|
+
completed: 2026-03-22T15:30:00Z
|
|
161
|
+
- sub_phase: 4_approach
|
|
162
|
+
status: complete
|
|
163
|
+
completed: 2026-03-22T16:00:00Z
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Rework Loop Detection
|
|
167
|
+
|
|
168
|
+
Track iterations when rework occurs.
|
|
169
|
+
|
|
170
|
+
### Tracking
|
|
171
|
+
|
|
172
|
+
Increment counters when rework happens:
|
|
173
|
+
|
|
174
|
+
| Action | Counter to Increment |
|
|
175
|
+
|--------|---------------------|
|
|
176
|
+
| Review → Implement (minor fixes) | `implement_loops` |
|
|
177
|
+
| Review → Approach (fundamental issues) | `approach_loops` |
|
|
178
|
+
|
|
179
|
+
### State Update
|
|
180
|
+
|
|
181
|
+
```yaml
|
|
182
|
+
features:
|
|
183
|
+
feature-slug:
|
|
184
|
+
rework_tracking:
|
|
185
|
+
implement_loops: 1
|
|
186
|
+
approach_loops: 0
|
|
187
|
+
history:
|
|
188
|
+
- action: rework_implement
|
|
189
|
+
timestamp: 2026-03-22T16:00:00Z
|
|
190
|
+
reason: "Type check failures"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Thresholds
|
|
194
|
+
|
|
195
|
+
Default thresholds (from `.forge/config.yaml`):
|
|
196
|
+
```yaml
|
|
197
|
+
rework:
|
|
198
|
+
max_implement_loops: 3
|
|
199
|
+
max_approach_loops: 2
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Warning Format
|
|
203
|
+
|
|
204
|
+
When threshold exceeded:
|
|
205
|
+
```
|
|
206
|
+
⚠️ Rework Alert: auth-system
|
|
207
|
+
- Implement loops: 3/3 (MAX)
|
|
208
|
+
- Approach loops: 1/2
|
|
209
|
+
|
|
210
|
+
Consider:
|
|
211
|
+
1. Pausing implementation
|
|
212
|
+
2. Re-evaluating approach
|
|
213
|
+
3. Requesting human review
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Reset on Success
|
|
217
|
+
|
|
218
|
+
Reset counters when sub-phase completes successfully:
|
|
219
|
+
```yaml
|
|
220
|
+
rework_tracking:
|
|
221
|
+
implement_loops: 0
|
|
222
|
+
approach_loops: 0
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Rework State Management
|
|
226
|
+
|
|
227
|
+
### Minor Issues (Loop to Implement)
|
|
228
|
+
- Stay in current feature
|
|
229
|
+
- Track iteration count in `rework_tracking.implement_loops`
|
|
230
|
+
- Don't create new sub-phase entries
|
|
231
|
+
|
|
232
|
+
### Approach Issues (Loop to Approach)
|
|
233
|
+
- Move current_sub_phase back to "4_approach"
|
|
234
|
+
- Track in `rework_tracking.approach_loops`
|
|
235
|
+
- Note what changed in approach
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: forge-template-loader
|
|
3
|
+
description: Load and apply Forge document templates for all phases and artifacts
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
audience: forge-users
|
|
8
|
+
workflow: document-creation
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Forge Template Loader
|
|
12
|
+
|
|
13
|
+
Load and apply Forge document templates for all phases and artifacts.
|
|
14
|
+
|
|
15
|
+
## Template Locations
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
.forge/templates/
|
|
19
|
+
├── planning/
|
|
20
|
+
│ ├── project-scope.md
|
|
21
|
+
│ ├── user-stories.md
|
|
22
|
+
│ ├── implementation-plan.md
|
|
23
|
+
│ └── technology-and-architecture.md
|
|
24
|
+
├── design/
|
|
25
|
+
│ ├── design-decisions.md
|
|
26
|
+
│ ├── task-list.md
|
|
27
|
+
│ └── tasks/
|
|
28
|
+
│ └── TASK_TEMPLATE.md
|
|
29
|
+
├── testing/
|
|
30
|
+
│ └── uat-results.md
|
|
31
|
+
└── defects/
|
|
32
|
+
└── DEFECT_TEMPLATE.md
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage by Phase
|
|
36
|
+
|
|
37
|
+
### Phase 1: Planning Templates
|
|
38
|
+
|
|
39
|
+
Load from `.forge/templates/planning/`:
|
|
40
|
+
|
|
41
|
+
| Document | Template | Output Location |
|
|
42
|
+
|----------|----------|-----------------|
|
|
43
|
+
| Project Scope | `project-scope.md` | `docs/planning/project-scope.md` |
|
|
44
|
+
| User Stories | `user-stories.md` | `docs/planning/user-stories.md` |
|
|
45
|
+
| Implementation Plan | `implementation-plan.md` | `docs/planning/implementation-plan.md` |
|
|
46
|
+
| Technology & Architecture | `technology-and-architecture.md` | `docs/planning/technology-and-architecture.md` |
|
|
47
|
+
|
|
48
|
+
### Phase 2: Design Templates
|
|
49
|
+
|
|
50
|
+
Load from `.forge/templates/design/`:
|
|
51
|
+
|
|
52
|
+
| Document | Template | Output Location |
|
|
53
|
+
|----------|----------|-----------------|
|
|
54
|
+
| Design Decisions | `design-decisions.md` | `docs/design/design-decisions.md` |
|
|
55
|
+
| Task List | `task-list.md` | `docs/design/task-list.md` |
|
|
56
|
+
| Individual Task | `tasks/TASK_TEMPLATE.md` | `docs/design/tasks/{task-slug}.md` |
|
|
57
|
+
|
|
58
|
+
### Phase 4: Testing Templates
|
|
59
|
+
|
|
60
|
+
| Document | Template | Output Location |
|
|
61
|
+
|----------|----------|-----------------|
|
|
62
|
+
| UAT Results | `testing/uat-results.md` | `docs/testing/uat-results.md` |
|
|
63
|
+
|
|
64
|
+
### Defect Templates
|
|
65
|
+
|
|
66
|
+
| Document | Template | Output Location |
|
|
67
|
+
|----------|----------|-----------------|
|
|
68
|
+
| Defect Report | `defects/DEFECT_TEMPLATE.md` | `docs/defects/{defect-slug}.md` |
|
|
69
|
+
|
|
70
|
+
## Template Variables
|
|
71
|
+
|
|
72
|
+
When applying templates, replace these placeholders:
|
|
73
|
+
|
|
74
|
+
| Variable | Description | Example |
|
|
75
|
+
|----------|-------------|---------|
|
|
76
|
+
| `[Task Title]` | Title of the task | "Implement user authentication" |
|
|
77
|
+
| `[Task Slug]` | URL-safe identifier | "implement-user-auth" |
|
|
78
|
+
| `[YYYY-MM-DD]` | Date placeholder | "2026-03-22" |
|
|
79
|
+
| `[timestamp]` | ISO 8601 timestamp | "2026-03-22T10:00:00Z" |
|
|
80
|
+
| `[Persona]` | User persona name | "End User" |
|
|
81
|
+
| `[Goal]` | User goal | "reset my password" |
|
|
82
|
+
| `[Benefit]` | User benefit | " regain access to my account" |
|
|
83
|
+
|
|
84
|
+
## Required Frontmatter Fields
|
|
85
|
+
|
|
86
|
+
### Task Document
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
---
|
|
90
|
+
title: [Task Title]
|
|
91
|
+
status: not-started
|
|
92
|
+
mode: greenfield | brownfield
|
|
93
|
+
complexity: small | medium | large
|
|
94
|
+
categories:
|
|
95
|
+
- backend
|
|
96
|
+
affected_modules: []
|
|
97
|
+
dependencies: []
|
|
98
|
+
---
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Defect Document
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
---
|
|
105
|
+
title: [Defect Title]
|
|
106
|
+
severity: critical | high | medium | low
|
|
107
|
+
classification: design | implementation
|
|
108
|
+
status: open
|
|
109
|
+
source:
|
|
110
|
+
type: sentry | logs | test | uat | user-report
|
|
111
|
+
url: null
|
|
112
|
+
discovered: [timestamp]
|
|
113
|
+
affected_features: []
|
|
114
|
+
routed_to: null
|
|
115
|
+
---
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Template Application Process
|
|
119
|
+
|
|
120
|
+
### Creating a New Document
|
|
121
|
+
|
|
122
|
+
1. **Read the template** from `.forge/templates/`
|
|
123
|
+
2. **Replace placeholders** with actual values
|
|
124
|
+
3. **Set initial status** in frontmatter (e.g., `status: in-progress`)
|
|
125
|
+
4. **Set dates** to current timestamp
|
|
126
|
+
5. **Write to destination** in `docs/`
|
|
127
|
+
|
|
128
|
+
### Example: Creating a Task Document
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
Input: TASK_TEMPLATE.md
|
|
132
|
+
Variables:
|
|
133
|
+
title = "Implement user authentication"
|
|
134
|
+
slug = "implement-user-auth"
|
|
135
|
+
complexity = "medium"
|
|
136
|
+
categories = ["backend", "database"]
|
|
137
|
+
|
|
138
|
+
Output: docs/design/tasks/implement-user-auth.md
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Template Validation
|
|
142
|
+
|
|
143
|
+
After creating a document, validate:
|
|
144
|
+
|
|
145
|
+
1. **Frontmatter present** - Document starts with `---`
|
|
146
|
+
2. **Required fields** - All required fields populated
|
|
147
|
+
3. **Valid enums** - Status, mode, complexity use valid values
|
|
148
|
+
4. **File path** - Correct location and naming
|
|
149
|
+
|
|
150
|
+
## Modifying Templates
|
|
151
|
+
|
|
152
|
+
Templates can be customized per project:
|
|
153
|
+
|
|
154
|
+
1. Copy from `.forge/templates/` to project root
|
|
155
|
+
2. Modify as needed
|
|
156
|
+
3. Use project-local template instead of global
|
|
157
|
+
|
|
158
|
+
Or extend `.forge/config.yaml`:
|
|
159
|
+
```yaml
|
|
160
|
+
templates:
|
|
161
|
+
custom_path: .forge/templates-custom/
|
|
162
|
+
```
|