specflow-cc 1.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.
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: sf:revise
3
+ description: Revise specification based on audit feedback
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - Task
11
+ - AskUserQuestion
12
+ ---
13
+
14
+ <purpose>
15
+ Revise the active specification based on audit feedback. Can apply all comments, specific numbered items, or custom changes described by user.
16
+ </purpose>
17
+
18
+ <context>
19
+ @.specflow/STATE.md
20
+ @.specflow/PROJECT.md
21
+ @~/.claude/specflow-cc/agents/spec-reviser.md
22
+ </context>
23
+
24
+ <workflow>
25
+
26
+ ## Step 1: Verify Initialization
27
+
28
+ ```bash
29
+ [ -d .specflow ] && echo "OK" || echo "NOT_INITIALIZED"
30
+ ```
31
+
32
+ **If NOT_INITIALIZED:**
33
+ ```
34
+ SpecFlow not initialized.
35
+
36
+ Run `/sf init` first.
37
+ ```
38
+ Exit.
39
+
40
+ ## Step 2: Get Active Specification
41
+
42
+ Read `.specflow/STATE.md` and extract Active Specification.
43
+
44
+ **If no active specification:**
45
+ ```
46
+ No active specification to revise.
47
+
48
+ Run `/sf new "task description"` to create one.
49
+ ```
50
+ Exit.
51
+
52
+ ## Step 3: Load Specification
53
+
54
+ Read the active spec file: `.specflow/specs/SPEC-XXX.md`
55
+
56
+ **If status is not 'draft', 'auditing', or 'revision_requested':**
57
+ ```
58
+ Specification SPEC-XXX cannot be revised (status: {status}).
59
+
60
+ Use `/sf status` to see current state.
61
+ ```
62
+ Exit.
63
+
64
+ ## Step 4: Extract Latest Audit
65
+
66
+ Find the most recent "Audit v[N]" section in Audit History.
67
+
68
+ **If no audit exists:**
69
+ ```
70
+ Specification SPEC-XXX has no audit history.
71
+
72
+ Run `/sf audit` first to get feedback.
73
+ ```
74
+ Exit.
75
+
76
+ ## Step 5: Parse Arguments
77
+
78
+ | Argument | Action |
79
+ |----------|--------|
80
+ | (none) | Interactive mode — show comments, ask what to fix |
81
+ | "all" | Apply all critical issues AND recommendations |
82
+ | "1,2,3" | Apply only numbered items |
83
+ | "..." | Treat as custom revision instructions |
84
+
85
+ ### If Interactive Mode (no arguments):
86
+
87
+ Display audit comments:
88
+
89
+ ```
90
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
91
+ REVISION: SPEC-XXX
92
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
93
+
94
+ Last audit (v{N}) found:
95
+
96
+ **Critical:**
97
+ 1. [Issue 1]
98
+ 2. [Issue 2]
99
+
100
+ **Recommendations:**
101
+ 3. [Recommendation 1]
102
+ 4. [Recommendation 2]
103
+
104
+ ---
105
+
106
+ What to fix?
107
+ ```
108
+
109
+ Use AskUserQuestion with options:
110
+ - "Apply all feedback" → treat as "all"
111
+ - "Fix critical only (1, 2)" → treat as "1,2"
112
+ - "Custom selection" → ask for numbers or description
113
+
114
+ ## Step 6: Spawn Reviser Agent
115
+
116
+ Launch the spec-reviser subagent:
117
+
118
+ ```
119
+ Task(prompt="
120
+ <specification>
121
+ @.specflow/specs/SPEC-XXX.md
122
+ </specification>
123
+
124
+ <project_context>
125
+ @.specflow/PROJECT.md
126
+ </project_context>
127
+
128
+ <revision_scope>
129
+ {Parsed scope: "all", "1,2", or custom instructions}
130
+ </revision_scope>
131
+
132
+ Revise this specification following the spec-reviser agent instructions.
133
+ Apply the specified changes and record the revision response.
134
+ ", subagent_type="sf-spec-reviser", description="Revise specification")
135
+ ```
136
+
137
+ ## Step 7: Handle Agent Response
138
+
139
+ The agent will:
140
+ 1. Parse the latest audit
141
+ 2. Apply requested revisions
142
+ 3. Record Response v[N] in Audit History
143
+ 4. Update status to "auditing"
144
+ 5. Update STATE.md
145
+
146
+ ## Step 8: Display Result
147
+
148
+ ```
149
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
150
+ REVISION COMPLETE
151
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
152
+
153
+ **Specification:** SPEC-XXX
154
+ **Audit:** v{N} → Response v{N}
155
+
156
+ ### Changes Applied
157
+
158
+ 1. [✓] {Change description}
159
+ 2. [✓] {Change description}
160
+
161
+ {If any skipped:}
162
+ ### Skipped
163
+
164
+ 3. [✗] {Item} — {reason}
165
+
166
+ ---
167
+
168
+ ## Next Step
169
+
170
+ `/sf audit` — re-audit revised specification
171
+ ```
172
+
173
+ </workflow>
174
+
175
+ <fallback>
176
+
177
+ **If agent spawning fails**, execute inline:
178
+
179
+ ## Inline Revision
180
+
181
+ ### Parse Audit Comments
182
+
183
+ Extract issues from latest audit section.
184
+
185
+ ### Apply Changes
186
+
187
+ For each item in scope:
188
+
189
+ 1. Locate the relevant section
190
+ 2. Make minimal, targeted changes
191
+ 3. Track what was changed
192
+
193
+ ### Record Response
194
+
195
+ Get response version:
196
+
197
+ ```bash
198
+ RESPONSE_COUNT=$(grep -c "### Response v" .specflow/specs/SPEC-XXX.md 2>/dev/null || echo 0)
199
+ NEXT_VERSION=$((RESPONSE_COUNT + 1))
200
+ ```
201
+
202
+ Append to Audit History:
203
+
204
+ ```markdown
205
+ ### Response v{N} ({date} {time})
206
+ **Applied:** {scope description}
207
+
208
+ **Changes:**
209
+ 1. [✓/✗] {Item} — {what was done}
210
+ 2. [✓/✗] {Item} — {what was done}
211
+ ```
212
+
213
+ ### Update Status
214
+
215
+ In spec frontmatter: `status: auditing`
216
+
217
+ In STATE.md:
218
+ - Status → "auditing"
219
+ - Next Step → "/sf audit"
220
+
221
+ </fallback>
222
+
223
+ <success_criteria>
224
+ - [ ] Active specification identified
225
+ - [ ] Latest audit parsed
226
+ - [ ] Revision scope determined (all/specific/custom)
227
+ - [ ] Changes applied correctly
228
+ - [ ] Response recorded in Audit History
229
+ - [ ] Spec frontmatter status updated
230
+ - [ ] STATE.md updated
231
+ - [ ] Clear summary of changes shown
232
+ </success_criteria>
@@ -0,0 +1,265 @@
1
+ ---
2
+ name: sf:run
3
+ description: Execute the specification (implement the code)
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Task
12
+ - AskUserQuestion
13
+ ---
14
+
15
+ <purpose>
16
+ Execute the active specification by implementing all requirements. Creates atomic commits during implementation and prepares for review.
17
+ </purpose>
18
+
19
+ <context>
20
+ @.specflow/STATE.md
21
+ @.specflow/PROJECT.md
22
+ @~/.claude/specflow-cc/agents/spec-executor.md
23
+ </context>
24
+
25
+ <workflow>
26
+
27
+ ## Step 1: Verify Initialization
28
+
29
+ ```bash
30
+ [ -d .specflow ] && echo "OK" || echo "NOT_INITIALIZED"
31
+ ```
32
+
33
+ **If NOT_INITIALIZED:**
34
+ ```
35
+ SpecFlow not initialized.
36
+
37
+ Run `/sf init` first.
38
+ ```
39
+ Exit.
40
+
41
+ ## Step 2: Get Active Specification
42
+
43
+ Read `.specflow/STATE.md` and extract Active Specification.
44
+
45
+ **If no active specification:**
46
+ ```
47
+ No active specification to execute.
48
+
49
+ Run `/sf new "task description"` to create one.
50
+ ```
51
+ Exit.
52
+
53
+ ## Step 3: Load Specification
54
+
55
+ Read the active spec file: `.specflow/specs/SPEC-XXX.md`
56
+
57
+ ## Step 4: Check Audit Status
58
+
59
+ **If status is "audited":**
60
+ Continue to execution.
61
+
62
+ **If status is NOT "audited":**
63
+ Show warning:
64
+
65
+ ```
66
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
67
+ WARNING: Specification has not passed audit
68
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
69
+
70
+ **Specification:** SPEC-XXX
71
+ **Current Status:** {status}
72
+
73
+ {If audit exists and has issues:}
74
+ ### Outstanding Issues
75
+
76
+ From last audit (v{N}):
77
+
78
+ **Critical:**
79
+ 1. {Issue 1}
80
+ 2. {Issue 2}
81
+
82
+ **Recommendations:**
83
+ 3. {Recommendation 1}
84
+
85
+ ---
86
+
87
+ Proceeding without audit approval may result in:
88
+ - Implementation that doesn't meet requirements
89
+ - Rework needed after review
90
+
91
+ Continue anyway?
92
+ ```
93
+
94
+ Use AskUserQuestion with options:
95
+ - "Yes, proceed anyway" → continue, log warning
96
+ - "No, run audit first" → exit with `/sf audit` suggestion
97
+
98
+ **If user proceeds anyway:**
99
+ Log in STATE.md Warnings table:
100
+ ```
101
+ | {date} | SPEC-XXX | Executed without audit approval |
102
+ ```
103
+
104
+ ## Step 5: Pre-Execution Summary
105
+
106
+ Display what will be implemented:
107
+
108
+ ```
109
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
110
+ EXECUTING: SPEC-XXX
111
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
112
+
113
+ **Title:** {spec title}
114
+ **Type:** {feature|refactor|bugfix}
115
+ **Complexity:** {small|medium|large}
116
+
117
+ ### Scope
118
+
119
+ **Files to create:** {count}
120
+ **Files to modify:** {count}
121
+ **Files to delete:** {count}
122
+
123
+ ### Acceptance Criteria
124
+
125
+ - [ ] {Criterion 1}
126
+ - [ ] {Criterion 2}
127
+ - [ ] {Criterion 3}
128
+
129
+ ---
130
+
131
+ Beginning implementation...
132
+ ```
133
+
134
+ ## Step 6: Update Status
135
+
136
+ Update STATE.md:
137
+ - Status → "running"
138
+ - Next Step → "(in progress)"
139
+
140
+ Update spec frontmatter:
141
+ - status → "running"
142
+
143
+ ## Step 7: Spawn Executor Agent
144
+
145
+ Launch the spec-executor subagent:
146
+
147
+ ```
148
+ Task(prompt="
149
+ <specification>
150
+ @.specflow/specs/SPEC-XXX.md
151
+ </specification>
152
+
153
+ <project_context>
154
+ @.specflow/PROJECT.md
155
+ </project_context>
156
+
157
+ Execute this specification following the spec-executor agent instructions.
158
+ Implement all requirements with atomic commits.
159
+ ", subagent_type="sf-spec-executor", description="Execute specification")
160
+ ```
161
+
162
+ ## Step 8: Handle Agent Response
163
+
164
+ The agent will:
165
+ 1. Implement all requirements
166
+ 2. Create atomic commits
167
+ 3. Handle deviations
168
+ 4. Add Execution Summary to spec
169
+ 5. Update STATE.md to "review"
170
+
171
+ ## Step 9: Display Result
172
+
173
+ ```
174
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
175
+ EXECUTION COMPLETE
176
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
177
+
178
+ **Specification:** SPEC-XXX
179
+ **Status:** Ready for review
180
+
181
+ ### Summary
182
+
183
+ - **Files created:** {count}
184
+ - **Files modified:** {count}
185
+ - **Files deleted:** {count}
186
+ - **Commits:** {count}
187
+
188
+ ### Acceptance Criteria
189
+
190
+ - [x] {Criterion 1}
191
+ - [x] {Criterion 2}
192
+ - [x] {Criterion 3}
193
+
194
+ {If deviations occurred:}
195
+ ### Deviations
196
+
197
+ 1. [Rule {N}] {description}
198
+
199
+ ---
200
+
201
+ ## Next Step
202
+
203
+ `/sf review` — audit the implementation
204
+ ```
205
+
206
+ </workflow>
207
+
208
+ <fallback>
209
+
210
+ **If agent spawning fails**, execute inline:
211
+
212
+ ## Inline Execution
213
+
214
+ ### Load Requirements
215
+
216
+ Parse specification for:
217
+ - Files to create/modify/delete
218
+ - Interfaces
219
+ - Acceptance criteria
220
+ - Constraints
221
+
222
+ ### Implement
223
+
224
+ For each requirement:
225
+ 1. Create/modify file
226
+ 2. Follow project patterns
227
+ 3. Meet acceptance criteria
228
+
229
+ ### Commit
230
+
231
+ After each logical unit:
232
+ ```bash
233
+ git add <files>
234
+ git commit -m "feat(sf-XXX): <description>"
235
+ ```
236
+
237
+ ### Handle Deletions
238
+
239
+ After replacements work:
240
+ 1. Check no remaining references
241
+ 2. Delete old files
242
+ 3. Commit removal
243
+
244
+ ### Update Specification
245
+
246
+ Append Execution Summary to spec.
247
+
248
+ ### Update STATE.md
249
+
250
+ - Status → "review"
251
+ - Next Step → "/sf review"
252
+
253
+ </fallback>
254
+
255
+ <success_criteria>
256
+ - [ ] Active specification identified
257
+ - [ ] Audit status checked (warning if not audited)
258
+ - [ ] All files created as specified
259
+ - [ ] All files modified as specified
260
+ - [ ] All files deleted as specified
261
+ - [ ] Atomic commits created
262
+ - [ ] Execution Summary added to spec
263
+ - [ ] STATE.md updated to "review"
264
+ - [ ] Clear next step shown
265
+ </success_criteria>
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: sf:show
3
+ description: Display full specification details
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ - Glob
8
+ ---
9
+
10
+ <purpose>
11
+ Display the full content of a specification including context, task, requirements, acceptance criteria, and audit/review history. Without arguments, shows the active specification.
12
+ </purpose>
13
+
14
+ <context>
15
+ @.specflow/STATE.md
16
+ </context>
17
+
18
+ <arguments>
19
+ - `[ID]` — Optional. Specification ID (e.g., SPEC-003). If omitted, shows active specification.
20
+ </arguments>
21
+
22
+ <workflow>
23
+
24
+ ## Step 1: Verify Initialization
25
+
26
+ ```bash
27
+ [ -d .specflow ] && echo "OK" || echo "NOT_INITIALIZED"
28
+ ```
29
+
30
+ **If NOT_INITIALIZED:**
31
+ ```
32
+ SpecFlow not initialized.
33
+
34
+ Run `/sf init` to start.
35
+ ```
36
+ Exit.
37
+
38
+ ## Step 2: Determine Specification ID
39
+
40
+ **If argument provided:**
41
+ Use provided ID (e.g., SPEC-003).
42
+
43
+ **If no argument:**
44
+ Read `.specflow/STATE.md` and get Active Specification.
45
+
46
+ **If no active specification and no argument:**
47
+ ```
48
+ No specification specified and no active specification.
49
+
50
+ Use `/sf show SPEC-XXX` to view a specific spec
51
+ or `/sf list` to see all specifications.
52
+ ```
53
+ Exit.
54
+
55
+ ## Step 3: Find Specification File
56
+
57
+ ```bash
58
+ # Check in specs directory
59
+ [ -f .specflow/specs/{ID}.md ] && echo "SPECS"
60
+
61
+ # Check in archive
62
+ [ -f .specflow/archive/{ID}.md ] && echo "ARCHIVE"
63
+ ```
64
+
65
+ **If not found:**
66
+ ```
67
+ Specification {ID} not found.
68
+
69
+ Use `/sf list` to see available specifications.
70
+ ```
71
+ Exit.
72
+
73
+ ## Step 4: Read Specification
74
+
75
+ Read the spec file and parse:
76
+ - Frontmatter (id, type, status, priority, complexity, created)
77
+ - Title
78
+ - Context section
79
+ - Task section
80
+ - Requirements section
81
+ - Acceptance Criteria section
82
+ - Constraints section
83
+ - Assumptions section
84
+ - Audit History section
85
+ - Review History section (if exists)
86
+
87
+ ## Step 5: Summarize History
88
+
89
+ ### Audit History Summary
90
+ Count audit versions and get final status:
91
+ - "v{N} — APPROVED" or "v{N} — NEEDS_REVISION"
92
+
93
+ ### Review History Summary
94
+ If review section exists:
95
+ - Count review versions
96
+ - Get final review status
97
+
98
+ ## Step 6: Determine Recommended Action
99
+
100
+ Based on current status:
101
+
102
+ | Status | Recommended Action |
103
+ |--------|-------------------|
104
+ | draft | `/sf audit` — audit specification |
105
+ | auditing | Complete audit or `/sf revise` |
106
+ | revision_requested | `/sf revise` — address comments |
107
+ | audited | `/sf run` — implement specification |
108
+ | running | Continue implementation or `/sf review` |
109
+ | review | `/sf fix` or `/sf done` |
110
+ | done | No action (archived) |
111
+
112
+ ## Step 7: Display Specification
113
+
114
+ ```
115
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
116
+ {ID}: {Title}
117
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
118
+
119
+ **Status:** {status} | **Priority:** {priority} | **Complexity:** {complexity}
120
+ **Type:** {type} | **Created:** {created}
121
+
122
+ {If archived:}
123
+ **Location:** Archive (completed)
124
+
125
+ ---
126
+
127
+ ## Context
128
+
129
+ {Context from spec}
130
+
131
+ ## Task
132
+
133
+ {Task from spec}
134
+
135
+ ## Requirements
136
+
137
+ {Requirements from spec - files to create/modify/delete}
138
+
139
+ ## Acceptance Criteria
140
+
141
+ {Criteria from spec with checkboxes}
142
+
143
+ {If constraints exist:}
144
+ ## Constraints
145
+
146
+ {Constraints from spec}
147
+
148
+ {If assumptions exist:}
149
+ ## Assumptions
150
+
151
+ {Assumptions from spec}
152
+
153
+ ---
154
+
155
+ ## History
156
+
157
+ {If audit history exists:}
158
+ **Audit:** v{N} — {APPROVED|NEEDS_REVISION} ({date})
159
+
160
+ {If review history exists:}
161
+ **Review:** v{N} — {APPROVED|NEEDS_FIXES} ({date})
162
+
163
+ {If implementation started:}
164
+ **Implementation:** {In progress | Completed}
165
+
166
+ ---
167
+
168
+ **Next Step:** `{recommended_command}` — {description}
169
+ ```
170
+
171
+ ## Step 8: Additional Context
172
+
173
+ **If spec is in archive:**
174
+ ```
175
+ This specification is complete and archived.
176
+
177
+ To view active specs: `/sf list`
178
+ To see completed history: `/sf history`
179
+ ```
180
+
181
+ **If spec has outstanding issues:**
182
+ ```
183
+ **Outstanding Issues:**
184
+
185
+ From {audit/review} v{N}:
186
+ 1. {issue}
187
+ 2. {issue}
188
+
189
+ Address with `/sf revise` or `/sf fix`.
190
+ ```
191
+
192
+ </workflow>
193
+
194
+ <success_criteria>
195
+ - [ ] Initialization verified
196
+ - [ ] Spec ID determined (from argument or active)
197
+ - [ ] Spec file found (specs or archive)
198
+ - [ ] Full content displayed
199
+ - [ ] Frontmatter parsed and shown
200
+ - [ ] History summarized
201
+ - [ ] Recommended next action clear
202
+ - [ ] Archive status indicated if applicable
203
+ </success_criteria>