buildflow-dev 1.0.7 → 4.0.2
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 +138 -51
- package/package.json +4 -2
- package/src/commands/init.js +19 -0
- package/src/commands/install.js +2 -2
- package/templates/CLAUDE.md +49 -33
- package/templates/commands/build.md +237 -66
- package/templates/commands/check.md +59 -24
- package/templates/commands/hotfix.md +119 -0
- package/templates/commands/modify.md +212 -38
- package/templates/commands/onboard.md +246 -52
- package/templates/commands/plan.md +204 -36
- package/templates/commands/ship.md +109 -47
- package/templates/commands/spec.md +251 -0
- package/templates/commands/start.md +38 -8
- package/templates/commands/think.md +186 -38
|
@@ -1,105 +1,276 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: buildflow-build
|
|
3
|
-
description:
|
|
3
|
+
description: Spec-traced wave execution with pattern-matched Builders, auto-test, auto-fix, and PR-ready commits
|
|
4
4
|
allowed-tools: Read, Write, Bash, Grep, Glob
|
|
5
5
|
agents: builder, reviewer
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# /buildflow-build
|
|
9
9
|
|
|
10
|
-
Execute the current phase plan.
|
|
10
|
+
Execute the current phase plan. Each Builder receives a precise context packet — task spec, AC refs, before/after contract, and the closest existing example to follow. Every wave auto-tests, auto-fixes until green, and produces a PR-ready commit. The next wave never starts until the current wave is fully passing.
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
|
-
- `/buildflow-build` — execute
|
|
14
|
-
- `/buildflow-build wave-2` — execute
|
|
15
|
-
- `/buildflow-build <task>` — build
|
|
13
|
+
- `/buildflow-build` — execute all waves
|
|
14
|
+
- `/buildflow-build wave-2` — execute a specific wave
|
|
15
|
+
- `/buildflow-build <task>` — build a single task
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Context Packet for this command (load only these)
|
|
18
|
+
- `.buildflow/phases/[N]/PLAN.md`
|
|
19
|
+
- `.buildflow/codebase/PATTERNS.md` (if exists)
|
|
20
|
+
- `.buildflow/memory/light.md` (app_name, framework, style_fingerprint only)
|
|
21
|
+
|
|
22
|
+
Do NOT load: full specs, full codebase, research, retros, old phases.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Step 1: Load & Confirm Plan
|
|
18
27
|
Read `.buildflow/phases/[N]/PLAN.md`.
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
Report: "Phase [N] — [N] waves, [N] tasks, [N] ACs. Est: [total]. Starting Wave [N]."
|
|
29
|
+
|
|
30
|
+
Check external dependency checklist if present. If unchecked items: "Verify these before building: [list]"
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Step 2: Detect Test Framework (runs once before any wave)
|
|
35
|
+
|
|
36
|
+
Before writing a single test line, identify what testing infrastructure exists.
|
|
37
|
+
|
|
38
|
+
### Detection checklist:
|
|
39
|
+
|
|
40
|
+
**JavaScript / TypeScript:**
|
|
41
|
+
```bash
|
|
42
|
+
# Check package.json for test deps
|
|
43
|
+
cat package.json | grep -E "jest|vitest|mocha|jasmine|@testing-library|supertest|cypress|playwright"
|
|
44
|
+
# Check for config files
|
|
45
|
+
ls jest.config.* vitest.config.* .mocharc.* 2>/dev/null
|
|
46
|
+
# Check for existing test files
|
|
47
|
+
find . -name "*.test.ts" -o -name "*.test.js" -o -name "*.spec.ts" -o -name "*.spec.js" | head -5
|
|
48
|
+
find . -type d -name "__tests__" | head -3
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Python:**
|
|
52
|
+
```bash
|
|
53
|
+
cat requirements.txt pyproject.toml setup.cfg 2>/dev/null | grep -E "pytest|unittest|nose"
|
|
54
|
+
find . -name "test_*.py" -o -name "*_test.py" | head -5
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Go:**
|
|
58
|
+
```bash
|
|
59
|
+
find . -name "*_test.go" | head -5
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Rust:**
|
|
63
|
+
```bash
|
|
64
|
+
grep -n "#\[test\]\|#\[cfg(test)\]" src/**/*.rs | head -5
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Framework Resolution:
|
|
68
|
+
|
|
69
|
+
| Result | Action |
|
|
70
|
+
|--------|--------|
|
|
71
|
+
| Framework found + config exists + test files exist | Use it. Infer conventions from existing test files. |
|
|
72
|
+
| Framework in package.json but no test files yet | Use it. Write tests following framework docs conventions. |
|
|
73
|
+
| No framework found, greenfield project | Ask: "No test framework detected. Recommend installing [Jest/Vitest for TS, pytest for Python, built-in for Go/Rust]. Set it up now? (yes / skip / I'll do it later)" |
|
|
74
|
+
| No framework, existing project with no tests | Warn: "⚠ No test framework found. Tests cannot be written until one is installed. Proceeding without tests — recommend adding [framework] before shipping." Log to `security/DEBT.md`: "No test framework — zero coverage." |
|
|
75
|
+
|
|
76
|
+
### If framework found — capture test profile:
|
|
77
|
+
```
|
|
78
|
+
Test Framework Profile
|
|
79
|
+
──────────────────────
|
|
80
|
+
Framework: Jest 29 / Vitest 1.x / pytest 7.x / go test / cargo test
|
|
81
|
+
Config file: jest.config.ts / vitest.config.ts / pytest.ini / N/A
|
|
82
|
+
Test location: co-located (*.test.ts) / __tests__/ / tests/
|
|
83
|
+
Naming: describe/it / test() / def test_ / #[test]
|
|
84
|
+
Mocking: jest.mock / vi.mock / pytest fixtures / mockall
|
|
85
|
+
Coverage tool: --coverage / --cov / go test -cover / cargo tarpaulin
|
|
86
|
+
Existing tests: [N] files, [N] total cases
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This profile is passed to every Builder as part of their context packet.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Step 3: Establish Style Fingerprint
|
|
94
|
+
If `PATTERNS.md` exists: extract the 5 most important conventions and hold them in scope.
|
|
95
|
+
If not: read 2 existing source files and infer:
|
|
96
|
+
- Naming convention
|
|
97
|
+
- Import order
|
|
98
|
+
- Error handling pattern
|
|
99
|
+
- Async style
|
|
100
|
+
- Test naming pattern (from test profile above)
|
|
101
|
+
|
|
102
|
+
This fingerprint applies to every Builder in every wave.
|
|
103
|
+
|
|
104
|
+
---
|
|
21
105
|
|
|
22
|
-
## Step
|
|
23
|
-
Before writing any code, confirm:
|
|
24
|
-
- Naming conventions (camelCase, PascalCase, snake_case)
|
|
25
|
-
- Import organization
|
|
26
|
-
- Error handling style
|
|
27
|
-
- Test file location and naming
|
|
106
|
+
## Step 3: Wave Execution Loop
|
|
28
107
|
|
|
29
|
-
|
|
108
|
+
Repeat for each wave:
|
|
30
109
|
|
|
31
|
-
|
|
110
|
+
### 3a — Build Context Packets
|
|
111
|
+
For each task in this wave, assemble a minimal context packet:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Task: [name]
|
|
115
|
+
Goal: [one sentence — what this task makes true]
|
|
116
|
+
AC refs: [AC-001, AC-003]
|
|
117
|
+
Before: [what currently exists — "file doesn't exist" or "function X does Y"]
|
|
118
|
+
After: [what must be true when this task is done]
|
|
119
|
+
|
|
120
|
+
Files to create/modify: [explicit list — max 5]
|
|
121
|
+
Closest existing example: [path/to/similar/file.ts — "follow this structure"]
|
|
122
|
+
Key pattern to follow: [specific convention from PATTERNS.md]
|
|
123
|
+
Definition of done: [linked ACs that must pass]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The "closest existing example" is the most important field. Builders replicate proven patterns — they don't invent new ones unless the task explicitly requires it. Find the nearest analog in the codebase.
|
|
127
|
+
|
|
128
|
+
### 3b — Parallel Build
|
|
129
|
+
Spawn one Builder per task. Each Builder receives ONLY its context packet.
|
|
32
130
|
|
|
33
|
-
### 3a — Build
|
|
34
|
-
Spawn Builder agents in parallel for all tasks in this wave.
|
|
35
131
|
Each Builder:
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
132
|
+
- Writes code that satisfies the Before → After contract
|
|
133
|
+
- Follows the closest existing example's structure
|
|
134
|
+
- Covers the referenced ACs
|
|
135
|
+
- **Writes tests as part of the same task — not after, not later, not optional**
|
|
136
|
+
- Adds `LEARN:` comment only for patterns not present elsewhere in the codebase
|
|
137
|
+
|
|
138
|
+
#### Mandatory Test Writing Rules (enforced per Builder)
|
|
139
|
+
|
|
140
|
+
**Prerequisite:** Test Framework Profile from Step 2 must exist. If no framework was found and user chose to skip, mark this task's test output as SKIPPED and log to `security/DEBT.md`.
|
|
141
|
+
|
|
142
|
+
**For every new source file created:**
|
|
143
|
+
- Create a corresponding test file using the detected framework and location convention:
|
|
144
|
+
- Jest/Vitest co-located: `auth.service.ts` → `auth.service.test.ts`
|
|
145
|
+
- `__tests__` folder: `src/auth/auth.service.ts` → `src/auth/__tests__/auth.service.test.ts`
|
|
146
|
+
- pytest: `src/auth/service.py` → `tests/auth/test_service.py`
|
|
147
|
+
- Go: `auth/service.go` → `auth/service_test.go` (same package)
|
|
148
|
+
- Rust: add `#[cfg(test)] mod tests { }` block inside same file
|
|
149
|
+
- Test file must cover: each exported function/method, each AC referenced by this task
|
|
150
|
+
- Minimum: 1 happy path + 1 error/edge case per exported function
|
|
151
|
+
|
|
152
|
+
**For every modified source file:**
|
|
153
|
+
- Locate the existing test file using the detected convention
|
|
154
|
+
- Add new test cases for every function whose behavior changed
|
|
155
|
+
- Update existing test cases if the function's contract or signature changed
|
|
156
|
+
- Do NOT delete passing test cases unless the behavior they test was explicitly removed
|
|
157
|
+
|
|
158
|
+
**Test structure — follow detected framework exactly:**
|
|
159
|
+
|
|
160
|
+
Jest / Vitest:
|
|
161
|
+
```typescript
|
|
162
|
+
describe('AuthService', () => {
|
|
163
|
+
describe('login', () => {
|
|
164
|
+
it('returns token when credentials are valid', async () => { ... })
|
|
165
|
+
it('throws UnauthorizedError when password is wrong', async () => { ... })
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
```
|
|
169
|
+
pytest:
|
|
170
|
+
```python
|
|
171
|
+
def test_login_returns_token_with_valid_credentials(): ...
|
|
172
|
+
def test_login_raises_unauthorized_with_wrong_password(): ...
|
|
173
|
+
```
|
|
174
|
+
Go:
|
|
175
|
+
```go
|
|
176
|
+
func TestLogin_ReturnsToken_WithValidCredentials(t *testing.T) { ... }
|
|
177
|
+
func TestLogin_ReturnsError_WithWrongPassword(t *testing.T) { ... }
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Builder reports back:
|
|
181
|
+
```
|
|
182
|
+
Task: [name] — COMPLETE
|
|
183
|
+
Files created: [list]
|
|
184
|
+
Files modified: [list]
|
|
185
|
+
Test files written/updated: [list with case count]
|
|
186
|
+
auth.service.test.ts — 6 cases (4 new, 2 updated)
|
|
187
|
+
ACs addressed: [AC-001 ✓, AC-003 ✓]
|
|
188
|
+
Pattern followed: [example file used]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 3c — Reviewer Check
|
|
192
|
+
Reviewer reads each Builder's output:
|
|
193
|
+
- Does the implementation satisfy the referenced ACs?
|
|
194
|
+
- Does it match the style fingerprint and closest example?
|
|
195
|
+
- Are tests present for non-trivial logic?
|
|
45
196
|
- Any security concerns?
|
|
46
|
-
-
|
|
197
|
+
- Did the Builder follow the Before → After contract?
|
|
198
|
+
|
|
199
|
+
Flag any deviation from existing patterns — Builders should blend in, not stand out.
|
|
47
200
|
|
|
48
|
-
###
|
|
49
|
-
|
|
201
|
+
### 3d — Test + Fix Loop
|
|
202
|
+
Run the full test suite:
|
|
50
203
|
```bash
|
|
51
|
-
npm test # Node /
|
|
204
|
+
npm test # Node / TS / JS
|
|
52
205
|
pytest # Python
|
|
53
206
|
go test ./... # Go
|
|
54
207
|
cargo test # Rust
|
|
55
|
-
# etc. based on detected framework
|
|
56
208
|
```
|
|
57
209
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- No import errors, missing modules, or broken references
|
|
61
|
-
- All previously passing tests still pass (no regressions)
|
|
210
|
+
If frontend changed: verify dev server renders without errors, core flow works.
|
|
211
|
+
Check: no regressions in previously passing tests.
|
|
62
212
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
213
|
+
**On test failure:**
|
|
214
|
+
1. Read the exact error — file, line, message
|
|
215
|
+
2. Trace root cause (not just symptom)
|
|
216
|
+
3. Apply minimal fix
|
|
217
|
+
4. Re-run tests
|
|
218
|
+
5. Repeat until green
|
|
69
219
|
|
|
70
|
-
|
|
220
|
+
Max 5 fix attempts. After 5: stop, report what's unresolved, ask how to proceed.
|
|
71
221
|
|
|
72
|
-
|
|
73
|
-
|
|
222
|
+
Fix log per attempt:
|
|
223
|
+
```
|
|
224
|
+
Fix [X]/5 Wave [N]
|
|
225
|
+
Error: [message at file:line]
|
|
226
|
+
Root cause: [why it's failing]
|
|
227
|
+
Fix: [exactly what changed]
|
|
228
|
+
Result: PASS / still failing
|
|
229
|
+
```
|
|
74
230
|
|
|
75
|
-
|
|
231
|
+
### 3e — Wave Commit
|
|
232
|
+
When all tests pass, commit this wave atomically:
|
|
233
|
+
```bash
|
|
234
|
+
git add [changed files — explicit list, not -A]
|
|
235
|
+
git commit -m "[type](scope): [what changed]
|
|
236
|
+
|
|
237
|
+
[Body: why this change, which ACs it satisfies]
|
|
238
|
+
[AC refs: AC-001, AC-003]
|
|
239
|
+
[Wave: N of M]"
|
|
76
240
|
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Result: [pass / still failing]
|
|
241
|
+
|
|
242
|
+
Commit types: `feat` / `fix` / `test` / `refactor` / `chore`
|
|
243
|
+
|
|
244
|
+
Example:
|
|
82
245
|
```
|
|
246
|
+
feat(auth): add JWT middleware and login route
|
|
83
247
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
248
|
+
Implements token validation for all protected routes.
|
|
249
|
+
Satisfies: AC-001 (valid login), AC-002 (invalid password rejection), AC-003 (expired token)
|
|
250
|
+
Wave: 2 of 4
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Mark wave complete in `phases/[N]/PLAN.md`. Proceed to next wave.
|
|
254
|
+
|
|
255
|
+
---
|
|
88
256
|
|
|
89
|
-
## Step
|
|
90
|
-
After all waves
|
|
91
|
-
- Run
|
|
92
|
-
- Verify all
|
|
93
|
-
- Check
|
|
257
|
+
## Step 4: Final Integration Check
|
|
258
|
+
After all waves:
|
|
259
|
+
- Run full test suite one last time
|
|
260
|
+
- Verify all AC-referenced behaviors work end-to-end
|
|
261
|
+
- Check imports across wave boundaries (no dangling references)
|
|
94
262
|
|
|
95
|
-
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Step 5: Update Memory (lean — prune old build fields)
|
|
96
266
|
```yaml
|
|
97
267
|
last_build_date: [today]
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
files_changed: [list]
|
|
268
|
+
plan_status: built
|
|
269
|
+
test_status: passing
|
|
101
270
|
waves_completed: [N]
|
|
102
|
-
test_status: all passing
|
|
103
271
|
```
|
|
272
|
+
Remove from `light.md`: per-task details from previous builds.
|
|
273
|
+
|
|
274
|
+
---
|
|
104
275
|
|
|
105
|
-
## Token Budget: ~50K per wave (
|
|
276
|
+
## Token Budget: ~50K per wave (context packets keep individual Builder costs low)
|
|
@@ -1,62 +1,97 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: buildflow-check
|
|
3
|
-
description: Verify quality with parallel Reviewer agents
|
|
3
|
+
description: Verify quality and spec compliance with parallel Reviewer agents
|
|
4
4
|
allowed-tools: Read, Bash, Grep, Glob
|
|
5
5
|
agent: reviewer
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# /buildflow-check
|
|
9
9
|
|
|
10
|
-
Quality verification.
|
|
10
|
+
Quality and spec-compliance verification. Four parallel Reviewers check code correctness, quality, security, and — most importantly — whether every acceptance criterion is actually satisfied.
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
|
-
- `/buildflow-check` — check
|
|
13
|
+
- `/buildflow-check` — full check: spec + code + security
|
|
14
14
|
- `/buildflow-check <file>` — check a specific file
|
|
15
|
-
- `/buildflow-check
|
|
16
|
-
- `/buildflow-check
|
|
15
|
+
- `/buildflow-check acceptance` — spec compliance only
|
|
16
|
+
- `/buildflow-check tests` — test coverage only
|
|
17
|
+
|
|
18
|
+
## Context Packet (load only these)
|
|
19
|
+
- `.buildflow/specs/acceptance.md` — the source of truth for what must be true
|
|
20
|
+
- `.buildflow/phases/[N]/PLAN.md` — what was supposed to be built
|
|
21
|
+
- Changed files only (git diff since last commit) — NOT the full codebase
|
|
22
|
+
- `.buildflow/codebase/PATTERNS.md` (if exists)
|
|
23
|
+
|
|
24
|
+
Do NOT load: PRD, TDD, old phases, research files, retros.
|
|
17
25
|
|
|
18
26
|
## Step 1: Load Acceptance Criteria
|
|
19
|
-
Read `.buildflow/
|
|
27
|
+
Read every AC from `.buildflow/specs/acceptance.md`.
|
|
28
|
+
This is the primary verification target — all other checks are secondary.
|
|
29
|
+
|
|
30
|
+
## Step 2: Parallel Review (4 reviewers)
|
|
31
|
+
|
|
32
|
+
**Reviewer A — Spec Compliance (most important):**
|
|
33
|
+
For each acceptance criterion:
|
|
34
|
+
- AC-001: Given [context], when [action], then [outcome] — does the code make this true?
|
|
35
|
+
- AC-002: ... etc.
|
|
20
36
|
|
|
21
|
-
|
|
37
|
+
Score each:
|
|
38
|
+
```
|
|
39
|
+
AC-001 ✓ PASS — [brief evidence]
|
|
40
|
+
AC-002 ✓ PASS — [brief evidence]
|
|
41
|
+
AC-003 ✗ FAIL — [what's missing or wrong]
|
|
42
|
+
AC-NF-001 ⚠ PARTIAL — [what works, what doesn't]
|
|
43
|
+
```
|
|
22
44
|
|
|
23
|
-
**Reviewer
|
|
45
|
+
**Reviewer B — Correctness:**
|
|
24
46
|
- Does the code do what was specified?
|
|
25
47
|
- Are edge cases handled?
|
|
26
48
|
- Are there logical errors?
|
|
27
49
|
|
|
28
|
-
**Reviewer
|
|
50
|
+
**Reviewer C — Code Quality:**
|
|
29
51
|
- Is the code readable?
|
|
30
52
|
- Are there unnecessary duplications?
|
|
31
53
|
- Does it match `.buildflow/codebase/PATTERNS.md`?
|
|
32
54
|
- Are functions appropriately sized?
|
|
33
55
|
|
|
34
|
-
**Reviewer
|
|
56
|
+
**Reviewer D — Security:**
|
|
35
57
|
- No hardcoded secrets?
|
|
36
58
|
- No obvious injection risks?
|
|
37
59
|
- No sensitive data in logs?
|
|
38
|
-
-
|
|
60
|
+
- Relevant ACs for auth/security satisfied?
|
|
39
61
|
|
|
40
62
|
## Step 3: Test Check
|
|
41
|
-
- Do
|
|
63
|
+
- Do all tests pass?
|
|
42
64
|
- Are new tests written for new code?
|
|
43
|
-
- Is
|
|
65
|
+
- Is each AC covered by at least one test?
|
|
44
66
|
|
|
45
67
|
## Step 4: Synthesize Findings
|
|
46
68
|
|
|
47
|
-
Report format:
|
|
48
69
|
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
Spec Compliance
|
|
71
|
+
───────────────
|
|
72
|
+
AC-001 ✓ login with valid credentials redirects to dashboard
|
|
73
|
+
AC-002 ✓ login with wrong password shows error message
|
|
74
|
+
AC-003 ✗ FAIL — password reset email not implemented
|
|
75
|
+
AC-NF-001 ⚠ login endpoint has no rate limiting
|
|
76
|
+
|
|
77
|
+
Code Quality
|
|
78
|
+
────────────
|
|
79
|
+
✓ PASS naming conventions match PATTERNS.md
|
|
80
|
+
⚠ WARN AuthService is 340 lines — consider splitting
|
|
81
|
+
✗ FAIL SQL query in getUserById is not parameterized (injection risk)
|
|
52
82
|
```
|
|
53
83
|
|
|
54
|
-
## Step 5:
|
|
55
|
-
|
|
84
|
+
## Step 5: Ship Readiness
|
|
85
|
+
|
|
86
|
+
| Condition | Status |
|
|
87
|
+
|-----------|--------|
|
|
88
|
+
| All ACs passing | ✓ / ✗ |
|
|
89
|
+
| No FAIL-level code issues | ✓ / ✗ |
|
|
90
|
+
| Tests passing | ✓ / ✗ |
|
|
91
|
+
| Security gate clear | ✓ / ✗ |
|
|
56
92
|
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
- Failures: "Fix these issues, then re-run /buildflow-check"
|
|
93
|
+
- **All green:** "Ready for `/buildflow-ship`"
|
|
94
|
+
- **AC failures:** "Spec not complete. Fix AC failures before shipping — they represent unfinished features, not code style."
|
|
95
|
+
- **Code failures only:** "Spec satisfied. Fix code issues or proceed with caution."
|
|
61
96
|
|
|
62
|
-
## Token Budget: ~
|
|
97
|
+
## Token Budget: ~22K
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: buildflow-hotfix
|
|
3
|
+
description: Fast-path fix for production incidents and small patches — no planning, no waves
|
|
4
|
+
allowed-tools: Read, Write, Bash, Grep, Glob
|
|
5
|
+
agent: surgeon
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /buildflow-hotfix
|
|
9
|
+
|
|
10
|
+
Emergency and small-patch path. Skips all planning, spec, and wave orchestration. Goes directly: understand → restore point → fix → test → ship.
|
|
11
|
+
|
|
12
|
+
Use this for:
|
|
13
|
+
- Production incidents
|
|
14
|
+
- One-liner bug fixes
|
|
15
|
+
- Small patches that don't justify a full plan
|
|
16
|
+
- Dependency version bumps
|
|
17
|
+
- Config changes
|
|
18
|
+
|
|
19
|
+
Do NOT use for: new features, refactors, or anything that touches more than ~5 files. Use `/buildflow-plan` + `/buildflow-build` for those.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
- `/buildflow-hotfix "fix login crash on empty password"`
|
|
23
|
+
- `/buildflow-hotfix "bump lodash to 4.17.21"`
|
|
24
|
+
- `/buildflow-hotfix src/api/auth.ts "rate limiting not applying to /refresh"`
|
|
25
|
+
|
|
26
|
+
## Context Packet (minimal — load only what's needed)
|
|
27
|
+
- `.buildflow/memory/light.md` (app_name, framework fields only)
|
|
28
|
+
- Target file(s) if specified
|
|
29
|
+
- Do NOT load: specs, phases, codebase MAP, PATTERNS — keep it fast
|
|
30
|
+
|
|
31
|
+
## Step 1: Understand the Fix
|
|
32
|
+
Parse the description. Identify:
|
|
33
|
+
- What is broken?
|
|
34
|
+
- What file(s) are likely involved?
|
|
35
|
+
- What is the expected behavior after the fix?
|
|
36
|
+
|
|
37
|
+
If the description is ambiguous, ask ONE clarifying question only.
|
|
38
|
+
|
|
39
|
+
## Step 2: Scope Check
|
|
40
|
+
Count files that need to change.
|
|
41
|
+
- 1–5 files: proceed
|
|
42
|
+
- 6+ files: warn — "This looks larger than a hotfix. Consider /buildflow-plan instead."
|
|
43
|
+
- Ask: "Proceed as hotfix anyway? (yes/no)"
|
|
44
|
+
|
|
45
|
+
## Step 3: Create Restore Point
|
|
46
|
+
```bash
|
|
47
|
+
git stash push -m "hotfix restore point: [description]"
|
|
48
|
+
# or if clean working tree:
|
|
49
|
+
git tag "pre-hotfix-[timestamp]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Step 4: Apply Fix
|
|
53
|
+
Make the minimal change:
|
|
54
|
+
- Fix only the root cause
|
|
55
|
+
- Do not refactor, rename, or clean up surrounding code
|
|
56
|
+
- Match existing code style
|
|
57
|
+
|
|
58
|
+
## Step 4b: Write Regression Test (always — even in hotfix mode)
|
|
59
|
+
|
|
60
|
+
### First: check if a test framework exists
|
|
61
|
+
```bash
|
|
62
|
+
cat package.json | grep -E "jest|vitest|mocha" 2>/dev/null
|
|
63
|
+
find . -name "*.test.ts" -o -name "*.test.js" -o -name "test_*.py" | head -3
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- **Framework found:** write the regression test using it
|
|
67
|
+
- **No framework found:** warn — "No test framework detected. Regression test skipped. This bug may recur." Log to `security/DEBT.md`: "Hotfix [description] shipped without regression test — no framework available."
|
|
68
|
+
- Do not block the hotfix for a missing framework, but always log the gap.
|
|
69
|
+
|
|
70
|
+
For the specific behavior being fixed:
|
|
71
|
+
1. Write a test that reproduces the bug before applying the fix
|
|
72
|
+
2. Run it — confirm it fails
|
|
73
|
+
3. Apply the fix (Step 4)
|
|
74
|
+
4. Run it again — confirm it passes
|
|
75
|
+
|
|
76
|
+
Name it after the exact bug:
|
|
77
|
+
```
|
|
78
|
+
it('should not crash when user has no profile photo')
|
|
79
|
+
it('should return 401 when session token is expired')
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If a test file already exists for the changed file: add the case there.
|
|
83
|
+
If not: create a minimal test file covering this function only. Do not skip — a hotfix without a regression test will regress again.
|
|
84
|
+
|
|
85
|
+
## Step 5: Test
|
|
86
|
+
Run the full test suite:
|
|
87
|
+
```bash
|
|
88
|
+
npm test # or pytest / go test etc.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If tests fail: fix and re-test. Max 3 attempts before stopping and asking the user.
|
|
92
|
+
|
|
93
|
+
## Step 6: Ship
|
|
94
|
+
```bash
|
|
95
|
+
git add [changed files only]
|
|
96
|
+
git commit -m "hotfix: [description]"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Do not create a phase, do not update state.md phase number.
|
|
100
|
+
Update `light.md`:
|
|
101
|
+
```yaml
|
|
102
|
+
last_hotfix: [today]
|
|
103
|
+
last_hotfix_desc: [description]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Step 7: Report
|
|
107
|
+
```
|
|
108
|
+
Hotfix complete
|
|
109
|
+
───────────────
|
|
110
|
+
Fix: [what changed]
|
|
111
|
+
Files: [list]
|
|
112
|
+
Tests: passing
|
|
113
|
+
Commit: [hash]
|
|
114
|
+
Time: fast-path (no planning)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
If no test coverage existed: "⚠ No test covers this area. Consider adding one."
|
|
118
|
+
|
|
119
|
+
## Token Budget: ~10K
|