specflow-cc 1.16.0 → 1.17.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ 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.17.1] - 2026-04-07
9
+
10
+ ### Fixed
11
+
12
+ - **TODO.md data loss prevention** — all 6 commands that modify TODO.md now use the `Edit` tool (targeted diff) instead of `Write` (full rewrite), preventing the agent from accidentally dropping entries when reconstructing large files
13
+ - Affected: `sf:todo`, `sf:plan`, `sf:done`, `sf:triage`, `sf:priority`, `spec-reviser`
14
+ - `Write` is now only used for initial TODO.md creation; all subsequent modifications use `Edit`
15
+ - Each command includes explicit "CRITICAL: never rewrite the entire file" guardrails
16
+
17
+ ## [1.17.0] - 2026-03-29
18
+
19
+ ### Added
20
+
21
+ - **Defer-to-TODO enforcement** — when spec-reviser defers requirements during scope reduction, TODOs are now automatically created in `.specflow/todos/TODO.md`
22
+ - New Step 5.5 in spec-reviser agent: mandatory TODO creation for every deferred item
23
+ - Revise command fallback mode also enforces TODO creation for deferred items
24
+ - Spec-auditor now reminds that removed requirements must be captured as TODOs when recommending scope reduction
25
+ - Closes a process gap where deferred work could be silently lost (discovered via SPEC-159 incident)
26
+
8
27
  ## [1.16.0] - 2026-03-23
9
28
 
10
29
  ### Added
@@ -267,6 +267,10 @@ Set NEEDS_DECOMPOSITION if ANY of:
267
267
  - Recommend `/sf:run --parallel` mode
268
268
  - Set status to NEEDS_DECOMPOSITION (if no critical issues)
269
269
 
270
+ **If recommending scope reduction (removing requirements):**
271
+ - Explicitly note in the audit that removed requirements MUST be captured as TODOs
272
+ - Add to recommendations: "Any requirements removed during revision must be tracked via `/sf:todo` to prevent scope loss"
273
+
270
274
  ## Step 3.6: Delta Validation
271
275
 
272
276
  **Detection:** Check if spec frontmatter contains `delta: true`.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sf-spec-reviser
3
3
  description: Revises specifications based on audit feedback, applying targeted or full changes
4
- tools: Read, Write, Glob, Grep, AskUserQuestion
4
+ tools: Read, Write, Edit, Glob, Grep, AskUserQuestion
5
5
  ---
6
6
 
7
7
  <role>
@@ -123,13 +123,44 @@ Append to Audit History:
123
123
  **Applied:** [what was applied]
124
124
 
125
125
  **Changes:**
126
- 1. [✓ if applied, ✗ if skipped] [Item description] — [what was done]
127
- 2. [✓/✗] [Item description] — [what was done]
126
+ 1. [✓ if applied, ✗ if skipped, ⏸ if deferred] [Item description] — [what was done]
127
+ 2. [✓/✗/⏸] [Item description] — [what was done]
128
128
 
129
129
  {If any skipped:}
130
130
  **Skipped:** [reason for skipping recommendations]
131
+
132
+ {If any deferred:}
133
+ **Deferred:** [items deferred to follow-up work]
131
134
  ```
132
135
 
136
+ ## Step 5.5: Create TODOs for Deferred Items
137
+
138
+ After recording the Response, check if any items were marked as deferred (⏸).
139
+
140
+ **If no deferred items:** Skip this step.
141
+
142
+ **If deferred items exist:**
143
+
144
+ For each deferred item:
145
+
146
+ 1. Read `.specflow/todos/TODO.md` to find the highest existing TODO ID
147
+ 2. Generate next TODO ID (zero-padded to 3 digits, starting from 001)
148
+ 3. Create a new TODO entry with:
149
+ - **Description:** `{item description} (deferred from {SPEC-XXX} audit v{N})`
150
+ - **Priority:** —
151
+ - **Notes:** `Origin: {SPEC-XXX} Response v{N}. {reason for deferral}`
152
+
153
+ 4. Use the **Edit** tool (NOT Write) to insert the new entry into `.specflow/todos/TODO.md` after the first `---` following `# To-Do List` — never rewrite the entire file, as this would destroy existing todos
154
+
155
+ 5. Append a "TODOs Created" subsection to the Response in Audit History:
156
+
157
+ ```markdown
158
+ **TODOs Created:**
159
+ - TODO-{XXX} — {item description}
160
+ ```
161
+
162
+ **Important:** This step is mandatory. Every deferred item MUST produce a TODO. If TODO creation fails, report the failure — do not silently skip.
163
+
133
164
  ## Step 6: Update Frontmatter
134
165
 
135
166
  Set status to "auditing" (ready for re-audit).
@@ -169,9 +200,16 @@ Output directly as formatted text (not wrapped in a code block):
169
200
 
170
201
  3. [✗] [Item] — [reason]
171
202
 
203
+ {If any deferred:}
204
+ ### Deferred → TODOs Created
205
+
206
+ 4. [⏸] [Item] → TODO-{XXX}
207
+
172
208
  ### Files Modified
173
209
 
174
210
  - .specflow/specs/SPEC-XXX.md
211
+ {If TODOs created:}
212
+ - .specflow/todos/TODO.md
175
213
 
176
214
  ### Next Step
177
215
 
@@ -188,6 +226,8 @@ Tip: `/clear` recommended — auditor needs fresh context
188
226
  - [ ] User's revision scope understood
189
227
  - [ ] Changes applied precisely
190
228
  - [ ] Revision Response recorded in Audit History
229
+ - [ ] Deferred items (if any) created as TODOs in `.specflow/todos/TODO.md`
230
+ - [ ] TODOs Created subsection appended to Response (if deferred items exist)
191
231
  - [ ] Frontmatter status updated
192
232
  - [ ] STATE.md updated
193
233
  - [ ] Clear summary of changes provided
@@ -4,6 +4,7 @@ description: Finalize specification, archive, and update state
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Write
7
+ - Edit
7
8
  - Bash
8
9
  - Glob
9
10
  - Grep
@@ -278,9 +279,10 @@ Check if the spec frontmatter contains a `source:` field (e.g., `source: TODO-00
278
279
 
279
280
  1. Read `.specflow/todos/TODO.md`
280
281
  2. Check if the referenced TODO-XXX entry still exists in the file
281
- 3. **If it exists** — remove it (the entire block from `## TODO-XXX` heading through the next `---` separator, inclusive)
282
- 4. Update `*Last updated:` timestamp with note: `TODO-XXX cleaned up (completed via SPEC-YYY)`
283
- 5. Write the updated TODO.md
282
+ 3. **If it exists** — use the **Edit** tool (NOT Write) to remove the entire block (from `## TODO-XXX` heading through the next `---` separator, inclusive) — replace with empty string
283
+ 4. Use the **Edit** tool to update `*Last updated:` timestamp with note: `TODO-XXX cleaned up (completed via SPEC-YYY)`
284
+
285
+ **CRITICAL:** Never rewrite the entire file with Write. Use Edit to remove the specific block and update the timestamp — this preserves all other todos.
284
286
 
285
287
  **If no `source:` field or TODO already removed:** Skip — no action needed.
286
288
 
@@ -4,6 +4,7 @@ description: Convert a to-do item into a full specification
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Write
7
+ - Edit
7
8
  - Bash
8
9
  - Glob
9
10
  - Grep
@@ -152,10 +153,11 @@ Use the priority from the todo as the spec's initial priority.
152
153
  **This step is MANDATORY. Do NOT skip it after the agent returns.**
153
154
 
154
155
  1. Read `.specflow/todos/TODO.md`
155
- 2. Remove the entire todo block (from `## TODO-XXX` heading through the next `---` separator, inclusive)
156
- 3. Update `*Last updated:` timestamp with note: `TODO-XXX converted to SPEC-YYY`
157
- 4. Write the updated TODO.md
158
- 5. **Verify** by reading TODO.md again — the converted todo MUST NOT appear
156
+ 2. Use the **Edit** tool (NOT Write) to remove the entire todo block (from `## TODO-XXX` heading through the next `---` separator, inclusive) — replace the block with empty string
157
+ 3. Use the **Edit** tool to update `*Last updated:` timestamp with note: `TODO-XXX converted to SPEC-YYY`
158
+ 4. **Verify** by reading TODO.md again — the converted todo MUST NOT appear
159
+
160
+ **CRITICAL:** Never rewrite the entire file with Write. Use Edit to remove the specific block and update the timestamp — this preserves all other todos.
159
161
 
160
162
  **Important:** Only remove after confirmed spec creation.
161
163
 
@@ -4,6 +4,7 @@ description: Interactive prioritization of specifications and to-dos
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Write
7
+ - Edit
7
8
  - Bash
8
9
  - Glob
9
10
  - AskUserQuestion
@@ -117,7 +118,7 @@ Your choice:
117
118
  If input matches pattern `{ID}={priority}`:
118
119
 
119
120
  1. Validate priority (high | medium | low)
120
- 2. Update frontmatter in spec file OR priority line in TODO.md
121
+ 2. Update frontmatter in spec file OR use the **Edit** tool (NOT Write) to update the priority line in TODO.md — never rewrite the entire file
121
122
  3. Display confirmation
122
123
  4. Return to Step 3
123
124
 
@@ -404,7 +404,13 @@ Items {N, M} require clarification before deciding.
404
404
  `/sf:audit` — re-audit with applied changes
405
405
 
406
406
  {If deferred items exist:}
407
- Note: Deferred items saved to `.specflow/todos/` for future consideration.
407
+ ### Deferred TODOs Created
408
+
409
+ | Deferred Item | TODO Created |
410
+ |---------------|-------------|
411
+ | {item description} | TODO-{XXX} |
412
+
413
+ Note: Each deferred item has been saved as a TODO for future consideration.
408
414
  ```
409
415
 
410
416
  </workflow>
@@ -464,6 +470,19 @@ NEXT_VERSION=$((RESPONSE_COUNT + 1))
464
470
  **Summary:** Applied {X}/{Y} items, Skipped {Z}, Deferred {W}
465
471
  ```
466
472
 
473
+ ### Create TODOs for Deferred Items
474
+
475
+ After recording the Response, if any items were marked "Deferred":
476
+
477
+ 1. Read `.specflow/todos/TODO.md` to find the highest existing TODO ID
478
+ 2. For each deferred item, create a new TODO entry:
479
+ - **Description:** `{item description} (deferred from {SPEC-XXX} audit v{N})`
480
+ - **Priority:** —
481
+ - **Notes:** `Origin: {SPEC-XXX} Response v{N}. {reason for deferral}`
482
+ 3. Append "**TODOs Created:**" subsection to the Response in Audit History listing created TODO IDs
483
+
484
+ **This step is mandatory.** Every "Deferred" decision MUST produce a corresponding TODO.
485
+
467
486
  ### Update Status
468
487
 
469
488
  In spec frontmatter: `status: auditing`
@@ -480,6 +499,7 @@ In STATE.md:
480
499
  - [ ] Revision scope determined (all/specific/custom)
481
500
  - [ ] Changes applied correctly
482
501
  - [ ] Response recorded in Audit History
502
+ - [ ] Deferred items (if any) created as TODOs in `.specflow/todos/TODO.md`
483
503
  - [ ] Spec frontmatter status updated
484
504
  - [ ] STATE.md updated
485
505
  - [ ] Clear summary of changes shown
@@ -4,6 +4,7 @@ description: Add a new to-do item for future work
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Write
7
+ - Edit
7
8
  - Bash
8
9
  - AskUserQuestion
9
10
  ---
@@ -84,7 +85,9 @@ Create from template:
84
85
  ```
85
86
 
86
87
  **If TODO.md exists:**
87
- Insert new todo after `# To-Do List` line:
88
+ Use the **Edit** tool (NOT Write) to make two targeted edits:
89
+
90
+ 1. Insert new todo block after the first `---` following `# To-Do List`:
88
91
 
89
92
  ```markdown
90
93
  ## TODO-{XXX} — {YYYY-MM-DD}
@@ -95,7 +98,9 @@ Insert new todo after `# To-Do List` line:
95
98
  ---
96
99
  ```
97
100
 
98
- Also update `*Last updated:` line at the bottom.
101
+ 2. Update the `*Last updated:` line at the bottom.
102
+
103
+ **CRITICAL:** Never rewrite the entire file. Use Edit to insert the new block and update the timestamp — this preserves all existing todos.
99
104
 
100
105
  ## Step 6: Display Confirmation
101
106
 
@@ -4,6 +4,7 @@ description: Convert scan findings into actionable TODO items
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Write
7
+ - Edit
7
8
  - Bash
8
9
  - AskUserQuestion
9
10
  ---
@@ -182,7 +183,11 @@ If TODO.md doesn't exist, create with header:
182
183
  *Last updated: {YYYY-MM-DD}*
183
184
  ```
184
185
 
185
- If TODO.md exists, insert new entries after `# To-Do List` line and update timestamp.
186
+ If TODO.md exists, use the **Edit** tool (NOT Write) to make two targeted edits:
187
+ 1. Insert new entries after the first `---` following `# To-Do List`
188
+ 2. Update the `*Last updated:` timestamp
189
+
190
+ **CRITICAL:** Never rewrite the entire file with Write. Use Edit to insert new blocks and update the timestamp — this preserves all existing todos.
186
191
 
187
192
  ## Step 7: Display Results
188
193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specflow-cc",
3
- "version": "1.16.0",
3
+ "version": "1.17.1",
4
4
  "description": "Spec-driven development system for Claude Code — quality-first workflow with explicit audit cycles",
5
5
  "bin": {
6
6
  "specflow-cc": "bin/install.js"