specflow-cc 1.11.1 → 1.13.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/CHANGELOG.md +64 -0
- package/README.md +7 -0
- package/agents/impl-reviewer.md +56 -0
- package/agents/sf-spec-executor-orchestrator.md +8 -0
- package/agents/spec-auditor.md +60 -0
- package/agents/spec-creator.md +36 -0
- package/agents/spec-executor-orchestrator.md +21 -0
- package/agents/spec-executor-worker.md +19 -0
- package/agents/spec-executor.md +40 -1
- package/agents/spec-reviser.md +8 -0
- package/agents/spec-splitter.md +10 -0
- package/commands/sf/audit.md +11 -69
- package/commands/sf/autopilot.md +601 -0
- package/commands/sf/done.md +11 -69
- package/commands/sf/help.md +14 -0
- package/commands/sf/init.md +77 -0
- package/commands/sf/review.md +11 -69
- package/commands/sf/revise.md +4 -7
- package/commands/sf/run.md +11 -69
- package/package.json +1 -1
- package/templates/project.md +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,70 @@ All notable changes to SpecFlow will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.13.0] - 2026-02-11
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Autopilot mode** (`/sf:autopilot`) — run the full spec lifecycle autonomously
|
|
13
|
+
- Single spec: `/sf:autopilot` or `/sf:autopilot SPEC-XXX`
|
|
14
|
+
- Batch mode: `/sf:autopilot --all` processes entire queue sequentially
|
|
15
|
+
- Cycle detection: configurable limits for audit (default: 3) and fix (default: 3) cycles
|
|
16
|
+
- Graceful halt on `needs_decomposition` or `paused` specs
|
|
17
|
+
- Summary report with per-spec outcomes and cycle counts
|
|
18
|
+
- Agent failure handling: continues batch on single-spec failure
|
|
19
|
+
- Configurable via `.specflow/config.json` under `"autopilot"` key
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **Replaced all Bash/awk/sed markdown mutations** with Read+Write tool instructions across 13 agent and command files
|
|
24
|
+
- Eliminates fragile shell-based file editing that could corrupt markdown structure
|
|
25
|
+
- All STATE.md, spec, and archive updates now use explicit Read→Write pattern
|
|
26
|
+
- Affected: spec-creator, spec-auditor, spec-reviser, spec-splitter, spec-executor, spec-executor-orchestrator, impl-reviewer, and 6 command files
|
|
27
|
+
|
|
28
|
+
- `/sf:help` — added Autonomous Execution section with autopilot commands
|
|
29
|
+
- README — added autopilot to workflow diagram, commands table, and typical session
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## [1.12.0] - 2026-02-10
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- **Language Profiles** — optional, per-language configuration in PROJECT.md that adapts all agents to language-specific needs
|
|
38
|
+
- `/sf:init` auto-detects language from `Cargo.toml` (Rust), `go.mod` (Go), `tsconfig.json` (TypeScript), `pyproject.toml` (Python)
|
|
39
|
+
- Generates `## Language Profile` section in PROJECT.md with build/lint/test commands, max files per spec, compilation gate, and trait-first settings
|
|
40
|
+
- Projects without a detected language remain fully language-agnostic (backward-compatible)
|
|
41
|
+
|
|
42
|
+
- **Compilation gates** — incremental build verification during implementation (Rust, Go)
|
|
43
|
+
- `spec-executor` and `spec-executor-worker` run `build_check` command after each file or tightly coupled group
|
|
44
|
+
- Build failures auto-fixed before proceeding (Rule 3: blocking issues)
|
|
45
|
+
- Lint check runs at end of implementation scope
|
|
46
|
+
- New `build_check` field in worker JSON result protocol
|
|
47
|
+
|
|
48
|
+
- **Trait-first enforcement** — compiled languages require type/trait design before implementation
|
|
49
|
+
- `spec-creator` mandates G1/Wave 1 as types-only when `Trait-first: Yes`
|
|
50
|
+
- `spec-auditor` validates trait-first compliance (Critical if G1 mixes traits and implementation)
|
|
51
|
+
- Prevents cascading rework from wrong trait boundaries in Rust/Go
|
|
52
|
+
|
|
53
|
+
- **Language-aware spec sizing** — file count limits adapted per language
|
|
54
|
+
- Rust: 3-5 files max (borrow checker errors cascade)
|
|
55
|
+
- Go: 5-8 files max
|
|
56
|
+
- TypeScript/Python: 8-10 files max
|
|
57
|
+
- `spec-auditor` raises Warning/Critical when file count exceeds language profile limit
|
|
58
|
+
|
|
59
|
+
- **Language-specific review gates** in `impl-reviewer`
|
|
60
|
+
- Runs build, lint, and test commands from profile as review gates
|
|
61
|
+
- Rust idiom checks: no unnecessary `.clone()`, `?` operator over `.unwrap()`, `unsafe` documentation, `Send + Sync` bounds
|
|
62
|
+
- Go idiom checks: error returns over panics, interfaces accepted/structs returned, context propagation
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- `templates/project.md` — added optional Language Profile section
|
|
67
|
+
- `spec-auditor` — added Step 3.10 (Language Profile Check) with 5 sub-checks and scope threshold override
|
|
68
|
+
- `spec-creator` — added language-specific sizing table and trait-first override in task group generation
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
8
72
|
## [1.11.1] - 2026-02-10
|
|
9
73
|
|
|
10
74
|
### Fixed
|
package/README.md
CHANGED
|
@@ -241,6 +241,8 @@ Your spec becomes documentation: why the code exists, what decisions were made,
|
|
|
241
241
|
↓ ↓ ↓
|
|
242
242
|
/sf:revise /sf:fix (optional UAT)
|
|
243
243
|
(if needed) (if needed)
|
|
244
|
+
|
|
245
|
+
/sf:autopilot — runs the entire flow above automatically
|
|
244
246
|
```
|
|
245
247
|
|
|
246
248
|
**Key principle:** Audits and reviews run in fresh context — no bias from creation.
|
|
@@ -312,6 +314,7 @@ Six months later, you can read the spec and understand not just *what* was built
|
|
|
312
314
|
| `/sf:fix` | Fix based on review feedback |
|
|
313
315
|
| `/sf:verify` | Interactive user acceptance testing |
|
|
314
316
|
| `/sf:done` | Complete and archive |
|
|
317
|
+
| `/sf:autopilot` | Run full lifecycle autonomously |
|
|
315
318
|
|
|
316
319
|
**Quick mode:**
|
|
317
320
|
|
|
@@ -455,6 +458,10 @@ Use `max` for maximum quality everywhere, `quality` for critical features, `budg
|
|
|
455
458
|
/sf:review # Fresh context review
|
|
456
459
|
/sf:verify # Manual verification
|
|
457
460
|
/sf:done # Archive
|
|
461
|
+
|
|
462
|
+
# Or skip manual steps — run everything autonomously
|
|
463
|
+
/sf:autopilot # Process active spec end-to-end
|
|
464
|
+
/sf:autopilot --all # Process entire queue
|
|
458
465
|
```
|
|
459
466
|
|
|
460
467
|
---
|
package/agents/impl-reviewer.md
CHANGED
|
@@ -165,6 +165,54 @@ During code review, watch for signals that the specification itself may have bee
|
|
|
165
165
|
|
|
166
166
|
**Note:** This is a safety net, not a primary check. Strategic issues should be caught earlier by `spec-auditor`.
|
|
167
167
|
|
|
168
|
+
### 4.9 Language Profile Check
|
|
169
|
+
|
|
170
|
+
**Detection:** Check if PROJECT.md contains a `## Language Profile` section.
|
|
171
|
+
|
|
172
|
+
**If no Language Profile:** Skip this check.
|
|
173
|
+
|
|
174
|
+
**If Language Profile exists:** Run configured verification commands and check results.
|
|
175
|
+
|
|
176
|
+
**4.9.1 Build Check:**
|
|
177
|
+
Run `Build check` command from profile (e.g., `cargo check`, `go build ./...`):
|
|
178
|
+
```bash
|
|
179
|
+
{build_check_command}
|
|
180
|
+
```
|
|
181
|
+
- Exit 0 → ✓ Passed
|
|
182
|
+
- Non-zero → **Critical**: "Build check failed: {error output}"
|
|
183
|
+
|
|
184
|
+
**4.9.2 Lint Check:**
|
|
185
|
+
Run `Lint` command from profile (e.g., `cargo clippy -- -D warnings`):
|
|
186
|
+
```bash
|
|
187
|
+
{lint_command}
|
|
188
|
+
```
|
|
189
|
+
- Exit 0 → ✓ Passed
|
|
190
|
+
- Non-zero → **Major**: "Lint check failed: {warning count} warnings/errors"
|
|
191
|
+
|
|
192
|
+
**4.9.3 Test Check:**
|
|
193
|
+
Run `Test` command from profile (e.g., `cargo test`):
|
|
194
|
+
```bash
|
|
195
|
+
{test_command}
|
|
196
|
+
```
|
|
197
|
+
- Exit 0 → ✓ Passed
|
|
198
|
+
- Non-zero → **Critical**: "Tests failed: {failure summary}"
|
|
199
|
+
|
|
200
|
+
**4.9.4 Language-Specific Idiom Check:**
|
|
201
|
+
|
|
202
|
+
For **Rust** (Language = Rust):
|
|
203
|
+
- [ ] No unnecessary `.clone()` calls — prefer borrowing
|
|
204
|
+
- [ ] Error handling uses `?` operator and `Result<T, E>` — not `.unwrap()` or `.expect()` in production code
|
|
205
|
+
- [ ] `unsafe` blocks have safety invariant comments
|
|
206
|
+
- [ ] Proper `Send + Sync` bounds on trait objects
|
|
207
|
+
- [ ] No `Box<dyn Any>` type erasure where concrete types work
|
|
208
|
+
|
|
209
|
+
For **Go** (Language = Go):
|
|
210
|
+
- [ ] Errors returned, not panicked
|
|
211
|
+
- [ ] Interfaces accepted, structs returned
|
|
212
|
+
- [ ] Context propagation (`ctx context.Context` as first param)
|
|
213
|
+
|
|
214
|
+
If idiom violations found: add as **Major** issues with specific file:line references.
|
|
215
|
+
|
|
168
216
|
## Step 5: Categorize Findings
|
|
169
217
|
|
|
170
218
|
Organize into:
|
|
@@ -240,6 +288,14 @@ Append to specification's Review History:
|
|
|
240
288
|
- If APPROVED: Status → "done", Next Step → "/sf:done"
|
|
241
289
|
- If CHANGES_REQUESTED: Status → "review", Next Step → "/sf:fix"
|
|
242
290
|
|
|
291
|
+
Update STATE.md by reading the current file content, then writing the updated file with:
|
|
292
|
+
- "**Status:**" line changed to the new status
|
|
293
|
+
- "**Next Step:**" line changed to the new next step
|
|
294
|
+
- No other content modified
|
|
295
|
+
|
|
296
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
297
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
298
|
+
|
|
243
299
|
</process>
|
|
244
300
|
|
|
245
301
|
<output>
|
|
@@ -389,6 +389,14 @@ Update ONLY the Current Position section:
|
|
|
389
389
|
- Status → "review"
|
|
390
390
|
- Next Step → "/sf:review"
|
|
391
391
|
|
|
392
|
+
Update STATE.md by reading the current file content, then writing the updated file with:
|
|
393
|
+
- "**Status:**" line changed to the new status
|
|
394
|
+
- "**Next Step:**" line changed to the new next step
|
|
395
|
+
- No other content modified
|
|
396
|
+
|
|
397
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
398
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
399
|
+
|
|
392
400
|
**CRITICAL — DO NOT go beyond this:**
|
|
393
401
|
- Do NOT move the spec to Completed Specifications table
|
|
394
402
|
- Do NOT remove the spec from Queue table
|
package/agents/spec-auditor.md
CHANGED
|
@@ -415,6 +415,57 @@ Check if spec includes items marked as "Out of Scope" or "Deferred" in PROJECT.m
|
|
|
415
415
|
**If compliant:**
|
|
416
416
|
- Add to audit output: "Project compliance: ✓ Honors PROJECT.md decisions"
|
|
417
417
|
|
|
418
|
+
## Step 3.10: Language Profile Check
|
|
419
|
+
|
|
420
|
+
**Detection:** Check if PROJECT.md contains a `## Language Profile` section.
|
|
421
|
+
|
|
422
|
+
**If no Language Profile section:** Skip this check entirely.
|
|
423
|
+
|
|
424
|
+
**If Language Profile exists:** Parse settings and validate spec compliance.
|
|
425
|
+
|
|
426
|
+
### 3.10.1 File Count Check
|
|
427
|
+
|
|
428
|
+
Extract `Max files per spec` from profile. Count total files to create + modify in spec.
|
|
429
|
+
|
|
430
|
+
| Condition | Action |
|
|
431
|
+
|-----------|--------|
|
|
432
|
+
| Files ≤ max | ✓ OK |
|
|
433
|
+
| Files = max + 1-2 | **Warning**: "File count ({N}) slightly exceeds language profile limit ({max}). Consider splitting." |
|
|
434
|
+
| Files > max + 2 | **Critical**: "File count ({N}) significantly exceeds language profile limit ({max}). Must split with `/sf:split`." |
|
|
435
|
+
|
|
436
|
+
### 3.10.2 Trait-First Check
|
|
437
|
+
|
|
438
|
+
If `Trait-first: Yes` AND spec complexity is medium or large:
|
|
439
|
+
|
|
440
|
+
- Check if Implementation Tasks section exists
|
|
441
|
+
- If yes: verify G1 (Wave 1) contains ONLY types/traits/interfaces, not implementation
|
|
442
|
+
- If G1 mixes traits and implementation: **Critical**: "Trait-first violation: G1 must contain only types/traits/interfaces. Implementation must be in Wave 2+."
|
|
443
|
+
- If no Implementation Tasks: **Warning**: "Trait-first language requires explicit task grouping for medium/large specs. Recommend adding Implementation Tasks with types in G1."
|
|
444
|
+
|
|
445
|
+
### 3.10.3 Compilation Gate Awareness
|
|
446
|
+
|
|
447
|
+
If `Compilation gate: Yes`:
|
|
448
|
+
|
|
449
|
+
- Verify task groups are small enough for incremental compilation checks
|
|
450
|
+
- If any single task group modifies >3 files: **Warning**: "Large task group ({N} files) with compilation gate. Consider splitting into smaller groups for incremental `build_check` verification."
|
|
451
|
+
|
|
452
|
+
### 3.10.4 Scope Threshold Override
|
|
453
|
+
|
|
454
|
+
If Language Profile exists, override default Scope Sanity Thresholds:
|
|
455
|
+
|
|
456
|
+
| Metric | Default | With Language Profile |
|
|
457
|
+
|--------|---------|---------------------|
|
|
458
|
+
| Files/plan (Blocker) | 15+ | `Max files per spec` from profile |
|
|
459
|
+
| Tasks/plan (Warning) | 4 | 3 (if `Trait-first: Yes`) |
|
|
460
|
+
|
|
461
|
+
### 3.10.5 Language Profile Verdict
|
|
462
|
+
|
|
463
|
+
**If all checks pass:**
|
|
464
|
+
- Add to audit output: "Language profile: ✓ Compliant with {Language} profile"
|
|
465
|
+
|
|
466
|
+
**If warnings or critical issues found:**
|
|
467
|
+
- Add issues to appropriate category (Critical/Recommendations)
|
|
468
|
+
|
|
418
469
|
## Step 4: Generate Implementation Tasks (for large specs)
|
|
419
470
|
|
|
420
471
|
If scope is large, generate the Implementation Tasks section:
|
|
@@ -634,6 +685,14 @@ Update status:
|
|
|
634
685
|
- If NEEDS_DECOMPOSITION: Status → "needs_decomposition", Next Step → "/sf:split or /sf:run --parallel"
|
|
635
686
|
- If NEEDS_REVISION: Status → "revision_requested", Next Step → "/sf:revise"
|
|
636
687
|
|
|
688
|
+
Update STATE.md by reading the current file content, then writing the updated file with:
|
|
689
|
+
- "**Status:**" line changed to the new status
|
|
690
|
+
- "**Next Step:**" line changed to the new next step
|
|
691
|
+
- No other content modified
|
|
692
|
+
|
|
693
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
694
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
695
|
+
|
|
637
696
|
</process>
|
|
638
697
|
|
|
639
698
|
<output>
|
|
@@ -738,6 +797,7 @@ Tip: `/clear` recommended before `/sf:run` — executor needs fresh context
|
|
|
738
797
|
- [ ] Specification fully read
|
|
739
798
|
- [ ] PROJECT.md context loaded
|
|
740
799
|
- [ ] All 10 dimensions evaluated (clarity, completeness, testability, scope, feasibility, architecture, duplication, cognitive load, strategic fit, project compliance)
|
|
800
|
+
- [ ] Language profile checked (if present in PROJECT.md)
|
|
741
801
|
- [ ] Assumptions extracted and impact assessed
|
|
742
802
|
- [ ] Project alignment verified
|
|
743
803
|
- [ ] Project compliance verified (decisions, constraints, out-of-scope)
|
package/agents/spec-creator.md
CHANGED
|
@@ -42,6 +42,26 @@ Good specifications are:
|
|
|
42
42
|
| medium | 50-150k | Multiple files, moderate feature |
|
|
43
43
|
| large | >150k | Many files, complex feature — needs /sf:split |
|
|
44
44
|
|
|
45
|
+
## Language Profile Awareness
|
|
46
|
+
|
|
47
|
+
If PROJECT.md contains a `## Language Profile` section, adapt behavior:
|
|
48
|
+
|
|
49
|
+
**Max files per spec:** If `Max files per spec` is set (e.g., 5 for Rust), use it for complexity estimation. A spec exceeding this limit should be flagged as needing `/sf:split`.
|
|
50
|
+
|
|
51
|
+
**Trait-first:** If `Trait-first: Yes`, for medium and large specs:
|
|
52
|
+
- First task group (G1, Wave 1) MUST be types/traits/interfaces only
|
|
53
|
+
- Implementation groups depend on G1
|
|
54
|
+
- This ensures trait design is audited before implementation begins
|
|
55
|
+
|
|
56
|
+
**Language-specific sizing:**
|
|
57
|
+
|
|
58
|
+
| Language | Max Files | Trait-First | Notes |
|
|
59
|
+
|----------|-----------|-------------|-------|
|
|
60
|
+
| Rust | 3-5 | Yes | Borrow checker errors cascade; smaller specs essential |
|
|
61
|
+
| Go | 5-8 | Yes | Interface design drives implementation |
|
|
62
|
+
| TypeScript | 8-10 | No | Dynamic typing allows larger specs |
|
|
63
|
+
| Python | 8-10 | No | Dynamic typing allows larger specs |
|
|
64
|
+
|
|
45
65
|
</philosophy>
|
|
46
66
|
|
|
47
67
|
<process>
|
|
@@ -136,6 +156,12 @@ Write to `.specflow/specs/SPEC-XXX.md` using the template structure:
|
|
|
136
156
|
- **Medium** and **large** complexity specs: Always include Implementation Tasks section
|
|
137
157
|
- **Small** complexity specs: Optional (skip if only 1-2 files or simple change)
|
|
138
158
|
|
|
159
|
+
**Language Profile Override:**
|
|
160
|
+
If PROJECT.md has `Trait-first: Yes` in Language Profile:
|
|
161
|
+
- G1 (Wave 1) MUST contain ONLY types/traits/interfaces — no implementation
|
|
162
|
+
- All implementation groups MUST depend on G1
|
|
163
|
+
- This is mandatory, not a suggestion — trait design errors cascade in compiled languages
|
|
164
|
+
|
|
139
165
|
**Task Groups:**
|
|
140
166
|
|
|
141
167
|
1. Group related work logically:
|
|
@@ -215,6 +241,16 @@ Update `.specflow/STATE.md`:
|
|
|
215
241
|
- Set Next Step to "/sf:audit"
|
|
216
242
|
- Add spec to Queue
|
|
217
243
|
|
|
244
|
+
Update STATE.md by reading the current file content, then writing the updated file with:
|
|
245
|
+
- "**Active Specification:**" line changed to the new spec
|
|
246
|
+
- "**Status:**" line changed to "drafting"
|
|
247
|
+
- "**Next Step:**" line changed to "/sf:audit"
|
|
248
|
+
- Queue table updated with new spec entry
|
|
249
|
+
- No other content modified
|
|
250
|
+
|
|
251
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
252
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
253
|
+
|
|
218
254
|
**If `<prior_discussion>` provided:**
|
|
219
255
|
Update the discussion file (PRE-XXX.md or DISC-XXX.md):
|
|
220
256
|
- Set `used_by: SPEC-XXX` in frontmatter
|
|
@@ -330,6 +330,10 @@ Write `.specflow/execution/SPEC-XXX-state.json`:
|
|
|
330
330
|
| SPEC-XXX | orchestrated | Wave 0/{total} (0%) | {timestamp} |
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
+
Update STATE.md by reading the current file content, then writing the updated file with the Execution Status table row added/updated.
|
|
334
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
335
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
336
|
+
|
|
333
337
|
## Step 3: Execute Waves
|
|
334
338
|
|
|
335
339
|
For each wave:
|
|
@@ -597,6 +601,10 @@ After wave completes (all groups done):
|
|
|
597
601
|
| SPEC-XXX | orchestrated | Wave 2/{total} (67%) | {timestamp} |
|
|
598
602
|
```
|
|
599
603
|
|
|
604
|
+
Update STATE.md by reading the current file content, then writing the updated file with the Execution Status table row updated for this wave.
|
|
605
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
606
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
607
|
+
|
|
600
608
|
## Step 4: Aggregate Results
|
|
601
609
|
|
|
602
610
|
Combine all worker results:
|
|
@@ -683,6 +691,10 @@ rm .specflow/execution/SPEC-XXX-state.json
|
|
|
683
691
|
- Change row to show "Complete" or remove row entirely
|
|
684
692
|
- Or archive: `mv .specflow/execution/SPEC-XXX-state.json .specflow/execution/archive/`
|
|
685
693
|
|
|
694
|
+
Update STATE.md by reading the current file content, then writing the updated file with the Execution Status table row removed or updated to "Complete".
|
|
695
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
696
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
697
|
+
|
|
686
698
|
**Note:** Only delete on FULL success. If any groups failed or are partial, keep state file for potential retry.
|
|
687
699
|
|
|
688
700
|
## Step 7: Update STATE.md
|
|
@@ -692,6 +704,15 @@ Update ONLY the Current Position section:
|
|
|
692
704
|
- Next Step → "/sf:review"
|
|
693
705
|
- Remove or update Execution Status row
|
|
694
706
|
|
|
707
|
+
Update STATE.md by reading the current file content, then writing the updated file with:
|
|
708
|
+
- "**Status:**" line changed to the new status
|
|
709
|
+
- "**Next Step:**" line changed to the new next step
|
|
710
|
+
- Execution Status row removed or updated
|
|
711
|
+
- No other content modified
|
|
712
|
+
|
|
713
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
714
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
715
|
+
|
|
695
716
|
**CRITICAL — DO NOT go beyond this:**
|
|
696
717
|
- Do NOT move the spec to Completed Specifications table
|
|
697
718
|
- Do NOT remove the spec from Queue table
|
|
@@ -122,6 +122,22 @@ After implementing, verify:
|
|
|
122
122
|
- Follows project conventions
|
|
123
123
|
- Meets task requirements
|
|
124
124
|
|
|
125
|
+
### 3.2.1 Compilation Gate (Language Profile)
|
|
126
|
+
|
|
127
|
+
If PROJECT.md has `Compilation gate: Yes` in Language Profile:
|
|
128
|
+
|
|
129
|
+
After implementing each file or tightly coupled group, run the `Build check` command:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Example for Rust: cargo check
|
|
133
|
+
# Example for Go: go build ./...
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**If build fails:** fix immediately (Rule 3: Auto-fix blocking issues). Do NOT proceed until current file compiles.
|
|
137
|
+
**If build passes:** continue to next file.
|
|
138
|
+
|
|
139
|
+
At end of all tasks in this group: run `Lint` command if specified in profile (e.g., `cargo clippy -- -D warnings`).
|
|
140
|
+
|
|
125
141
|
### 3.3 Commit
|
|
126
142
|
|
|
127
143
|
Create atomic commit:
|
|
@@ -189,10 +205,13 @@ Output structured JSON for orchestrator:
|
|
|
189
205
|
],
|
|
190
206
|
"deviations": [],
|
|
191
207
|
"self_check": "passed",
|
|
208
|
+
"build_check": "passed",
|
|
192
209
|
"error": null
|
|
193
210
|
}
|
|
194
211
|
```
|
|
195
212
|
|
|
213
|
+
**Note:** `build_check` field is only included when Language Profile has `Compilation gate: Yes`. Values: `"passed"`, `"fixed"` (had to fix compilation errors), `"skipped"` (no language profile).
|
|
214
|
+
|
|
196
215
|
**For segmented execution, add segment fields:**
|
|
197
216
|
|
|
198
217
|
```json
|
package/agents/spec-executor.md
CHANGED
|
@@ -131,6 +131,28 @@ After implementing, verify:
|
|
|
131
131
|
- Meets relevant acceptance criteria
|
|
132
132
|
- Follows project conventions
|
|
133
133
|
|
|
134
|
+
### 4.2.1 Compilation Gate (Language Profile)
|
|
135
|
+
|
|
136
|
+
If PROJECT.md has `Compilation gate: Yes` in Language Profile:
|
|
137
|
+
|
|
138
|
+
After implementing each file or tightly coupled group of files, run the `Build check` command from the profile:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Example for Rust:
|
|
142
|
+
cargo check
|
|
143
|
+
# Example for Go:
|
|
144
|
+
go build ./...
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**If build fails:**
|
|
148
|
+
- Fix the compilation error immediately (Rule 3: Auto-fix blocking issues)
|
|
149
|
+
- Do NOT proceed to next file until current file compiles
|
|
150
|
+
- Track as: `[Rule 3 - Compilation] Fixed {error} in {file}`
|
|
151
|
+
|
|
152
|
+
**If build passes:** continue to next file.
|
|
153
|
+
|
|
154
|
+
This prevents cascading errors — especially critical for Rust where borrow checker errors in file A can mask the real issue in file B.
|
|
155
|
+
|
|
134
156
|
### 4.3 Commit
|
|
135
157
|
|
|
136
158
|
Create atomic commit:
|
|
@@ -191,7 +213,16 @@ For key modifications, verify the change is present:
|
|
|
191
213
|
grep -q "expected_pattern" path/to/modified/file && echo "VERIFIED" || echo "NOT FOUND"
|
|
192
214
|
```
|
|
193
215
|
|
|
194
|
-
**4.
|
|
216
|
+
**4. Language profile checks (if Language Profile exists in PROJECT.md):**
|
|
217
|
+
|
|
218
|
+
Run each configured command and verify it passes:
|
|
219
|
+
- `Lint` command (e.g., `cargo clippy -- -D warnings`) → must exit 0
|
|
220
|
+
- `Test` command (e.g., `cargo test`) → must exit 0
|
|
221
|
+
- `Safety check` command if present (e.g., `cargo miri test`) → must exit 0
|
|
222
|
+
|
|
223
|
+
If any check fails: fix the issue before proceeding (Rule 3).
|
|
224
|
+
|
|
225
|
+
**5. Report self-check result:**
|
|
195
226
|
|
|
196
227
|
- If ALL checks pass: continue to Execution Summary
|
|
197
228
|
- If ANY check fails: **fix the issue** before proceeding, do NOT report success with missing artifacts
|
|
@@ -237,6 +268,14 @@ Update ONLY the Current Position section:
|
|
|
237
268
|
- Status → "review"
|
|
238
269
|
- Next Step → "/sf:review"
|
|
239
270
|
|
|
271
|
+
Update STATE.md by reading the current file content, then writing the updated file with:
|
|
272
|
+
- "**Status:**" line changed to the new status
|
|
273
|
+
- "**Next Step:**" line changed to the new next step
|
|
274
|
+
- No other content modified
|
|
275
|
+
|
|
276
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
277
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
278
|
+
|
|
240
279
|
**CRITICAL — DO NOT go beyond this:**
|
|
241
280
|
- Do NOT move the spec to Completed Specifications table
|
|
242
281
|
- Do NOT remove the spec from Queue table
|
package/agents/spec-reviser.md
CHANGED
|
@@ -139,6 +139,14 @@ Set status to "auditing" (ready for re-audit).
|
|
|
139
139
|
- Status → "auditing"
|
|
140
140
|
- Next Step → "/sf:audit"
|
|
141
141
|
|
|
142
|
+
Update STATE.md by reading the current file content, then writing the updated file with:
|
|
143
|
+
- "**Status:**" line changed to the new status
|
|
144
|
+
- "**Next Step:**" line changed to the new next step
|
|
145
|
+
- No other content modified
|
|
146
|
+
|
|
147
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
148
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
149
|
+
|
|
142
150
|
</process>
|
|
143
151
|
|
|
144
152
|
<output>
|
package/agents/spec-splitter.md
CHANGED
|
@@ -188,6 +188,16 @@ Update `.specflow/STATE.md`:
|
|
|
188
188
|
- Set first child (no dependencies) as Active Specification
|
|
189
189
|
- Add note to Decisions: "Split SPEC-XXX into N parts"
|
|
190
190
|
|
|
191
|
+
Update STATE.md by reading the current file content, then writing the updated file with:
|
|
192
|
+
- Parent spec removed from Queue table
|
|
193
|
+
- All child specs added to Queue table in dependency order
|
|
194
|
+
- First child (no dependencies) set as Active Specification
|
|
195
|
+
- Decisions section updated with split note
|
|
196
|
+
- No other content modified
|
|
197
|
+
|
|
198
|
+
Use the Read tool to read `.specflow/STATE.md`, then use the Write tool to write the updated content.
|
|
199
|
+
Do NOT use Bash (awk, sed, or echo) to modify `.specflow/STATE.md`.
|
|
200
|
+
|
|
191
201
|
</process>
|
|
192
202
|
|
|
193
203
|
<output>
|
package/commands/sf/audit.md
CHANGED
|
@@ -242,75 +242,17 @@ The agent will:
|
|
|
242
242
|
|
|
243
243
|
After the agent updates STATE.md, check if rotation is needed:
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
RECENT_DECISIONS=$(echo "$DECISIONS" | tail -5)
|
|
257
|
-
OLD_DECISION_COUNT=$((DECISION_COUNT - 5))
|
|
258
|
-
OLD_DECISIONS=$(echo "$DECISIONS" | head -n $OLD_DECISION_COUNT)
|
|
259
|
-
|
|
260
|
-
# Create or append to archive
|
|
261
|
-
if [ ! -f .specflow/DECISIONS_ARCHIVE.md ]; then
|
|
262
|
-
cat > .specflow/DECISIONS_ARCHIVE.md << 'EOF'
|
|
263
|
-
# SpecFlow Decisions Archive
|
|
264
|
-
|
|
265
|
-
Historical decisions rotated from STATE.md to maintain compactness.
|
|
266
|
-
|
|
267
|
-
## Archived Decisions
|
|
268
|
-
|
|
269
|
-
| Date | Decision |
|
|
270
|
-
|------|----------|
|
|
271
|
-
EOF
|
|
272
|
-
fi
|
|
273
|
-
|
|
274
|
-
# Write old decisions to temp file for awk to read (awk -v cannot handle multiline strings)
|
|
275
|
-
TEMP_OLD=$(mktemp)
|
|
276
|
-
echo "$OLD_DECISIONS" > "$TEMP_OLD"
|
|
277
|
-
|
|
278
|
-
# Append old decisions to archive (insert after table header)
|
|
279
|
-
TEMP_ARCHIVE=$(mktemp)
|
|
280
|
-
awk -v oldfile="$TEMP_OLD" '
|
|
281
|
-
/^\| Date \| Decision \|$/ { print; getline; print; while ((getline line < oldfile) > 0) print line; close(oldfile); next }
|
|
282
|
-
{print}
|
|
283
|
-
' .specflow/DECISIONS_ARCHIVE.md > "$TEMP_ARCHIVE"
|
|
284
|
-
mv "$TEMP_ARCHIVE" .specflow/DECISIONS_ARCHIVE.md
|
|
285
|
-
rm -f "$TEMP_OLD"
|
|
286
|
-
|
|
287
|
-
# Write recent decisions to temp file for awk to read
|
|
288
|
-
TEMP_RECENT=$(mktemp)
|
|
289
|
-
echo "$RECENT_DECISIONS" > "$TEMP_RECENT"
|
|
290
|
-
|
|
291
|
-
# Update STATE.md with only recent decisions
|
|
292
|
-
TEMP_STATE=$(mktemp)
|
|
293
|
-
awk -v recentfile="$TEMP_RECENT" '
|
|
294
|
-
/^## Decisions$/ {
|
|
295
|
-
print
|
|
296
|
-
print ""
|
|
297
|
-
print "| Date | Decision |"
|
|
298
|
-
print "|------|----------|"
|
|
299
|
-
while ((getline line < recentfile) > 0) print line
|
|
300
|
-
close(recentfile)
|
|
301
|
-
in_decisions=1
|
|
302
|
-
next
|
|
303
|
-
}
|
|
304
|
-
/^## / && in_decisions { in_decisions=0 }
|
|
305
|
-
!in_decisions || !/^\|/ { print }
|
|
306
|
-
' .specflow/STATE.md > "$TEMP_STATE"
|
|
307
|
-
mv "$TEMP_STATE" .specflow/STATE.md
|
|
308
|
-
rm -f "$TEMP_RECENT"
|
|
309
|
-
|
|
310
|
-
echo "Rotated $(echo "$OLD_DECISIONS" | grep -c '^|') old decisions to DECISIONS_ARCHIVE.md"
|
|
311
|
-
fi
|
|
312
|
-
fi
|
|
313
|
-
```
|
|
245
|
+
1. Use the Read tool to read `.specflow/STATE.md` and count total lines
|
|
246
|
+
2. If total lines <= 100, no action needed
|
|
247
|
+
3. If total lines > 100:
|
|
248
|
+
a. Read the `## Decisions` section and extract all decision rows (lines matching `| YYYY-`)
|
|
249
|
+
b. Count decision rows. If <= 7, no rotation needed
|
|
250
|
+
c. If > 7 decisions:
|
|
251
|
+
- Identify the 5 most recent decisions (last 5 rows) -- these STAY
|
|
252
|
+
- Identify older decisions (all rows except last 5) -- these MOVE to archive
|
|
253
|
+
- Read `.specflow/DECISIONS_ARCHIVE.md` (create with template if missing)
|
|
254
|
+
- Write updated DECISIONS_ARCHIVE.md: insert old decisions after the table header row
|
|
255
|
+
- Write updated STATE.md: replace Decisions section content with only the 5 most recent decisions
|
|
314
256
|
|
|
315
257
|
## Step 7: Display Result
|
|
316
258
|
|