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,268 @@
1
+ ---
2
+ name: sf:history
3
+ description: View completed specifications from archive
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ - Glob
8
+ - Grep
9
+ ---
10
+
11
+ <purpose>
12
+ Display completed specifications from the archive. Shows completion dates, audit/review cycle counts, and decisions made. Allows viewing full details of archived specifications to learn from past work.
13
+ </purpose>
14
+
15
+ <context>
16
+ @.specflow/archive/SPEC-*.md
17
+ @.specflow/STATE.md
18
+ </context>
19
+
20
+ <arguments>
21
+ - `[ID]` — Specification ID to show details for (e.g., SPEC-001). Optional — shows list if omitted.
22
+ </arguments>
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: Check Archive
41
+
42
+ ```bash
43
+ ls .specflow/archive/SPEC-*.md 2>/dev/null | wc -l
44
+ ```
45
+
46
+ **If 0 (empty archive):**
47
+ ```
48
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
+ COMPLETED SPECIFICATIONS
50
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
51
+
52
+ No completed specifications yet.
53
+
54
+ Complete your first spec to see it here.
55
+
56
+ **Workflow:**
57
+ 1. `/sf new "task"` — Create specification
58
+ 2. `/sf audit` → `/sf run` → `/sf review`
59
+ 3. `/sf done` — Archives the specification
60
+ ```
61
+ Exit.
62
+
63
+ ## Step 3: Branch Based on Arguments
64
+
65
+ **If specific ID provided:** Go to Step 4a (Detailed View)
66
+ **If no ID provided:** Go to Step 4b (List View)
67
+
68
+ ## Step 4a: Detailed Archive View
69
+
70
+ ### Check Spec Exists
71
+
72
+ ```bash
73
+ [ -f ".specflow/archive/{ID}.md" ] && echo "FOUND" || echo "NOT_FOUND"
74
+ ```
75
+
76
+ **If NOT_FOUND:**
77
+ ```
78
+ Specification {ID} not found in archive.
79
+
80
+ It may be:
81
+ - Still in progress: `/sf show {ID}`
82
+ - Never existed: `/sf list` to see all specs
83
+
84
+ Use `/sf history` to see archived specifications.
85
+ ```
86
+ Exit.
87
+
88
+ ### Parse Archived Specification
89
+
90
+ Read `.specflow/archive/{ID}.md` and extract:
91
+ - Frontmatter: id, type, status, priority, complexity, created
92
+ - Title from first heading
93
+ - Context section (summary)
94
+ - Audit History section
95
+ - Review History section (if exists)
96
+ - Files created/modified (from Requirements)
97
+
98
+ ### Calculate Statistics
99
+
100
+ - Duration: created → archived (from last audit/review date)
101
+ - Audit cycles: count audit entries
102
+ - Review cycles: count review entries
103
+ - Decisions: from Audit History responses
104
+
105
+ ### Extract Decisions from STATE.md
106
+
107
+ Read `.specflow/STATE.md` Decisions table and filter by spec ID.
108
+
109
+ ### Display Detailed View
110
+
111
+ ```
112
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
113
+ {ID}: {Title} (Archived)
114
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
115
+
116
+ **Created:** {created date}
117
+ **Completed:** {completion date}
118
+ **Duration:** {days} days
119
+ **Type:** {type}
120
+ **Complexity:** {complexity}
121
+
122
+ ---
123
+
124
+ ## Summary
125
+
126
+ {Context section content, first paragraph}
127
+
128
+ ## Audit History
129
+
130
+ | Version | Date | Result |
131
+ |---------|------------|----------------|
132
+ | v1 | 2024-01-11 | Needs Revision |
133
+ | v2 | 2024-01-12 | Approved |
134
+
135
+ **Total audits:** {N} | **First-pass:** {Yes/No}
136
+
137
+ ## Review History
138
+
139
+ | Version | Date | Result |
140
+ |---------|------------|----------------|
141
+ | v1 | 2024-01-15 | Approved |
142
+
143
+ **Total reviews:** {N} | **First-pass:** {Yes/No}
144
+
145
+ ## Decisions Made
146
+
147
+ {If decisions found:}
148
+ | Decision | Rationale |
149
+ |-----------------------------------|------------------------------|
150
+ | Use jose instead of jsonwebtoken | Better TypeScript support |
151
+ | httpOnly cookies for tokens | XSS protection |
152
+
153
+ {If no decisions:}
154
+ No major decisions recorded for this specification.
155
+
156
+ ## Files Created/Modified
157
+
158
+ {If files listed in Requirements:}
159
+ **Created:**
160
+ - src/middleware/auth.ts
161
+ - src/services/auth.ts
162
+ - src/types/auth.ts
163
+
164
+ **Modified:**
165
+ - src/app/api/route.ts
166
+
167
+ {If files not explicitly listed:}
168
+ See specification for details.
169
+
170
+ ---
171
+
172
+ **Note:** Archived specifications are read-only.
173
+
174
+ **View full spec:** Read `.specflow/archive/{ID}.md`
175
+ ```
176
+ Exit.
177
+
178
+ ## Step 4b: List All Archived
179
+
180
+ ### Parse All Archived Specs
181
+
182
+ For each file in `.specflow/archive/SPEC-*.md`:
183
+ - Extract id, title, type, complexity, created
184
+ - Count audit entries (Audit v1, v2, etc.)
185
+ - Count review entries (if any)
186
+ - Get completion date (last audit/review date)
187
+
188
+ ### Sort by Completion Date
189
+
190
+ Most recent first.
191
+
192
+ ### Calculate Summary Statistics
193
+
194
+ - Total completed
195
+ - Average audit cycles
196
+ - Average review cycles
197
+ - First-pass audit rate
198
+ - First-pass review rate
199
+
200
+ ### Display List
201
+
202
+ ```
203
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
204
+ COMPLETED SPECIFICATIONS
205
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
206
+
207
+ | ID | Title | Completed | Type | Audits | Reviews |
208
+ |----------|---------------------------|------------|----------|--------|---------|
209
+ | SPEC-005 | Settings page | 2024-01-19 | feature | 1 | 1 |
210
+ | SPEC-002 | API rate limiting | 2024-01-18 | feature | 1 | 2 |
211
+ | SPEC-001 | User authentication | 2024-01-15 | feature | 2 | 1 |
212
+
213
+ ---
214
+
215
+ ## Summary
216
+
217
+ **Total completed:** {N} specifications
218
+
219
+ | Metric | Value |
220
+ |------------------------|--------|
221
+ | Average audit cycles | {N.N} |
222
+ | Average review cycles | {N.N} |
223
+ | First-pass audit rate | {N}% |
224
+ | First-pass review rate | {N}% |
225
+
226
+ ## By Type
227
+
228
+ | Type | Count |
229
+ |----------|-------|
230
+ | feature | {N} |
231
+ | refactor | {N} |
232
+ | bugfix | {N} |
233
+
234
+ ## By Complexity
235
+
236
+ | Complexity | Count |
237
+ |------------|-------|
238
+ | small | {N} |
239
+ | medium | {N} |
240
+ | large | {N} |
241
+
242
+ ---
243
+
244
+ **View details:** `/sf history SPEC-001`
245
+
246
+ **Insights:**
247
+ {If first-pass audit rate < 50%:}
248
+ - Consider more thorough initial specs (low first-pass audit rate)
249
+
250
+ {If average audits > 2:}
251
+ - Specs may need better scoping upfront
252
+
253
+ {If all metrics good:}
254
+ - Great spec quality! Keep up the discipline.
255
+ ```
256
+
257
+ </workflow>
258
+
259
+ <success_criteria>
260
+ - [ ] Initialization verified
261
+ - [ ] Empty archive handled gracefully
262
+ - [ ] List view shows all archived specs with key metrics
263
+ - [ ] Detail view shows full history and decisions
264
+ - [ ] Audit/review cycles counted correctly
265
+ - [ ] Summary statistics calculated
266
+ - [ ] Sorted by completion date (most recent first)
267
+ - [ ] Insights provided based on data
268
+ </success_criteria>
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: sf:init
3
+ description: Initialize SpecFlow in current project — analyze codebase and create .specflow/ structure
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ ---
11
+
12
+ <purpose>
13
+ Initialize SpecFlow in the current project. Analyzes the codebase to understand tech stack, patterns, and structure, then creates the `.specflow/` directory with PROJECT.md, STATE.md, and config.json.
14
+ </purpose>
15
+
16
+ <context>
17
+ @~/.claude/specflow-cc/templates/project.md
18
+ @~/.claude/specflow-cc/templates/state.md
19
+ </context>
20
+
21
+ <workflow>
22
+
23
+ ## Step 1: Check if Already Initialized
24
+
25
+ ```bash
26
+ [ -d .specflow ] && echo "EXISTS" || echo "NOT_EXISTS"
27
+ ```
28
+
29
+ **If EXISTS:**
30
+ ```
31
+ SpecFlow already initialized in this project.
32
+
33
+ Use `/sf status` to see current state.
34
+ ```
35
+ Exit.
36
+
37
+ ## Step 2: Detect Tech Stack
38
+
39
+ Scan for common configuration files:
40
+
41
+ ```bash
42
+ # Package managers / Languages
43
+ ls package.json pyproject.toml Cargo.toml go.mod pom.xml build.gradle Gemfile composer.json 2>/dev/null
44
+
45
+ # Frameworks
46
+ ls next.config.* nuxt.config.* vite.config.* angular.json vue.config.* 2>/dev/null
47
+
48
+ # Database
49
+ ls prisma/schema.prisma drizzle.config.* knexfile.* 2>/dev/null
50
+
51
+ # Testing
52
+ ls jest.config.* vitest.config.* pytest.ini 2>/dev/null
53
+ ```
54
+
55
+ ## Step 3: Analyze Project Structure
56
+
57
+ ```bash
58
+ # Get top-level structure
59
+ ls -la | head -20
60
+
61
+ # Common source directories
62
+ ls -d src app lib pages components 2>/dev/null
63
+ ```
64
+
65
+ ## Step 4: Detect Patterns
66
+
67
+ Look for common patterns in the codebase:
68
+
69
+ ```bash
70
+ # API routes pattern
71
+ ls -d **/api/** app/api pages/api 2>/dev/null | head -5
72
+
73
+ # Component patterns
74
+ ls -d **/components/** 2>/dev/null | head -5
75
+
76
+ # Check for TypeScript
77
+ ls tsconfig.json 2>/dev/null
78
+ ```
79
+
80
+ ## Step 5: Create .specflow Directory
81
+
82
+ ```bash
83
+ mkdir -p .specflow/specs .specflow/audits .specflow/archive .specflow/todos
84
+ ```
85
+
86
+ ## Step 6: Generate PROJECT.md
87
+
88
+ Based on detected stack and patterns, create `.specflow/PROJECT.md`:
89
+
90
+ ```markdown
91
+ # [Project Name from package.json or directory]
92
+
93
+ ## What This Is
94
+
95
+ [Infer from README.md if exists, otherwise "Project initialized with SpecFlow"]
96
+
97
+ ## Core Value
98
+
99
+ [To be defined by user]
100
+
101
+ ## Tech Stack
102
+
103
+ | Layer | Technology |
104
+ |-------|------------|
105
+ [Fill based on detection]
106
+
107
+ ## Project Structure
108
+
109
+ ```
110
+ [Simplified tree of main directories]
111
+ ```
112
+
113
+ ## Patterns & Conventions
114
+
115
+ [List detected patterns]
116
+
117
+ ## Constraints
118
+
119
+ [To be defined by user]
120
+
121
+ ---
122
+ *Generated by SpecFlow on [date]*
123
+ ```
124
+
125
+ ## Step 7: Generate STATE.md
126
+
127
+ Create `.specflow/STATE.md`:
128
+
129
+ ```markdown
130
+ # SpecFlow State
131
+
132
+ ## Current Position
133
+
134
+ - **Active Specification:** none
135
+ - **Status:** idle
136
+ - **Next Step:** /sf new
137
+
138
+ ## Queue
139
+
140
+ | # | ID | Title | Priority | Status |
141
+ |---|----|-------|----------|--------|
142
+
143
+ ## Decisions
144
+
145
+ | Date | Specification | Decision |
146
+ |------|---------------|----------|
147
+
148
+ ## Project Patterns
149
+
150
+ [Patterns from PROJECT.md]
151
+
152
+ ## Warnings
153
+
154
+ | Date | Specification | Reason |
155
+ |------|---------------|--------|
156
+
157
+ ---
158
+ *Last updated: [date]*
159
+ ```
160
+
161
+ ## Step 8: Generate config.json
162
+
163
+ Create `.specflow/config.json`:
164
+
165
+ ```json
166
+ {
167
+ "auto_commit": true,
168
+ "commit_format": "feat(sf-{id}): {description}",
169
+ "ask_questions": "critical_only",
170
+ "complexity_threshold": {
171
+ "small": 50000,
172
+ "medium": 150000
173
+ },
174
+ "audit_storage": "hybrid"
175
+ }
176
+ ```
177
+
178
+ ## Step 9: Output Summary
179
+
180
+ ```
181
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
182
+ SPECFLOW INITIALIZED
183
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
184
+
185
+ **Project:** [name]
186
+ **Stack:** [detected technologies]
187
+
188
+ | File | Purpose |
189
+ |------|---------|
190
+ | `.specflow/PROJECT.md` | Project overview |
191
+ | `.specflow/STATE.md` | Current state |
192
+ | `.specflow/config.json` | Configuration |
193
+
194
+ ## Next Step
195
+
196
+ `/sf new "your task description"` — create first specification
197
+
198
+ ---
199
+
200
+ **Tip:** Review `.specflow/PROJECT.md` and fill in:
201
+ - Core Value
202
+ - Constraints
203
+ - Any missing patterns
204
+ ```
205
+
206
+ </workflow>
207
+
208
+ <success_criteria>
209
+ - [ ] .specflow/ directory created
210
+ - [ ] .specflow/specs/ subdirectory created
211
+ - [ ] .specflow/audits/ subdirectory created
212
+ - [ ] .specflow/archive/ subdirectory created
213
+ - [ ] PROJECT.md created with detected stack
214
+ - [ ] STATE.md created with initial state
215
+ - [ ] config.json created with defaults
216
+ - [ ] User knows next step is /sf new
217
+ </success_criteria>
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: sf:list
3
+ description: List all specifications with status, priority, and complexity
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ - Glob
8
+ ---
9
+
10
+ <purpose>
11
+ Display all specifications from `.specflow/specs/` with their basic info: ID, title, status, priority, complexity. Helps navigate between tasks and understand project state.
12
+ </purpose>
13
+
14
+ <context>
15
+ @.specflow/STATE.md
16
+ </context>
17
+
18
+ <workflow>
19
+
20
+ ## Step 1: Verify Initialization
21
+
22
+ ```bash
23
+ [ -d .specflow ] && echo "OK" || echo "NOT_INITIALIZED"
24
+ ```
25
+
26
+ **If NOT_INITIALIZED:**
27
+ ```
28
+ SpecFlow not initialized.
29
+
30
+ Run `/sf init` to start.
31
+ ```
32
+ Exit.
33
+
34
+ ## Step 2: Get Active Specification
35
+
36
+ Read `.specflow/STATE.md` and extract Active Specification ID.
37
+
38
+ ## Step 3: Find All Specifications
39
+
40
+ ```bash
41
+ ls -1 .specflow/specs/SPEC-*.md 2>/dev/null
42
+ ```
43
+
44
+ **If no specs found:**
45
+ ```
46
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
47
+ SPECIFICATIONS
48
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
+
50
+ No specifications found.
51
+
52
+ Create your first specification:
53
+ `/sf new "task description"`
54
+ ```
55
+ Exit.
56
+
57
+ ## Step 4: Parse Each Specification
58
+
59
+ For each SPEC-XXX.md file, read the frontmatter and extract:
60
+ - id
61
+ - type
62
+ - status
63
+ - priority (default: medium)
64
+ - complexity
65
+
66
+ Also extract title from first `# [Title]` line.
67
+
68
+ ## Step 5: Count Archived Specs
69
+
70
+ ```bash
71
+ ls -1 .specflow/archive/SPEC-*.md 2>/dev/null | wc -l
72
+ ```
73
+
74
+ ## Step 6: Sort Specifications
75
+
76
+ Sort by:
77
+ 1. Priority: high → medium → low
78
+ 2. Then by creation date (oldest first, from ID number)
79
+
80
+ ## Step 7: Display List
81
+
82
+ ```
83
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
84
+ SPECIFICATIONS
85
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
86
+
87
+ | # | ID | Title | Status | Priority | Size |
88
+ |----|----------|--------------------|----------|----------|--------|
89
+ | 1 | SPEC-003 | Auth middleware | running | high | medium | ← active
90
+ | 2 | SPEC-004 | User profile | audited | medium | small |
91
+ | 3 | SPEC-005 | Settings page | draft | low | small |
92
+
93
+ Total: 3 specs | {archived} complete | {in_progress} in progress
94
+
95
+ ---
96
+
97
+ **Actions:**
98
+ - `/sf show SPEC-XXX` — view details
99
+ - `/sf next` — work on highest priority
100
+ - `/sf new "task"` — create new specification
101
+ ```
102
+
103
+ ## Step 8: Show Status Legend (if helpful)
104
+
105
+ If there are multiple statuses, show legend:
106
+
107
+ ```
108
+ **Status Legend:**
109
+ - draft: Needs audit
110
+ - audited: Ready to implement
111
+ - running: Implementation in progress
112
+ - review: Needs review
113
+ - done: Completed (in archive)
114
+ ```
115
+
116
+ </workflow>
117
+
118
+ <success_criteria>
119
+ - [ ] Initialization verified
120
+ - [ ] All specs from .specflow/specs/ listed
121
+ - [ ] Frontmatter parsed (id, status, priority, complexity)
122
+ - [ ] Titles extracted
123
+ - [ ] Sorted by priority, then date
124
+ - [ ] Active specification marked
125
+ - [ ] Statistics shown (total, complete, in progress)
126
+ - [ ] Clear next actions provided
127
+ </success_criteria>