specflow-cc 1.0.0 → 1.1.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 CHANGED
@@ -5,6 +5,21 @@ 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.1.0] - 2026-01-20
9
+
10
+ ### Added
11
+
12
+ #### Analysis Commands
13
+ - `/sf scan [--focus]` - Deep codebase analysis for tech debt, concerns, and improvement opportunities
14
+
15
+ #### Agents
16
+ - `codebase-scanner` - Analyzes codebase and writes structured SCAN.md report
17
+
18
+ #### Templates
19
+ - `scan.md` - Codebase scan report template
20
+
21
+ ---
22
+
8
23
  ## [1.0.0] - 2026-01-20
9
24
 
10
25
  ### Added
package/README.md CHANGED
@@ -112,6 +112,12 @@ npx specflow-cc --local
112
112
  | `/sf pause` | Save context for later |
113
113
  | `/sf resume` | Restore saved context |
114
114
 
115
+ ### Analysis
116
+
117
+ | Command | Description |
118
+ |---------|-------------|
119
+ | `/sf scan [--focus]` | Deep codebase analysis for concerns and tech debt |
120
+
115
121
  ### Utilities
116
122
 
117
123
  | Command | Description |
@@ -164,6 +170,7 @@ After `/sf init`, SpecFlow creates:
164
170
  .specflow/
165
171
  ├── PROJECT.md # Project overview and patterns
166
172
  ├── STATE.md # Current state and queue
173
+ ├── SCAN.md # Codebase scan results (from /sf scan)
167
174
  ├── config.json # Configuration
168
175
  ├── specs/ # Active specifications
169
176
  │ └── SPEC-001.md
@@ -228,8 +235,8 @@ SpecFlow includes a statusline hook showing:
228
235
 
229
236
  | Aspect | GSD | SpecFlow |
230
237
  |--------|-----|----------|
231
- | Commands | 25 | 22 |
232
- | Agents | 11 | 6 |
238
+ | Commands | 25 | 23 |
239
+ | Agents | 11 | 7 |
233
240
  | Phases per task | 5+ | 3-4 |
234
241
  | Quality audit | No | Yes (explicit) |
235
242
  | Revision loop | No | Yes |
@@ -0,0 +1,243 @@
1
+ ---
2
+ name: sf-codebase-scanner
3
+ description: Analyzes codebase for concerns, quality issues, and improvement opportunities. Writes SCAN.md directly.
4
+ tools: Read, Bash, Grep, Glob, Write
5
+ ---
6
+
7
+ <role>
8
+ You are a SpecFlow codebase scanner. You analyze a codebase to identify technical debt, code quality issues, security concerns, and improvement opportunities.
9
+
10
+ You are spawned by `/sf scan` with a focus area:
11
+ - **concerns** — Technical debt, bugs, security issues
12
+ - **quality** — Code quality, conventions, test coverage gaps
13
+ - **arch** — Architecture problems, structure issues
14
+ - **all** — Complete analysis (default)
15
+
16
+ Your job: Explore thoroughly, analyze deeply, write `.specflow/SCAN.md` directly. Return only confirmation.
17
+ </role>
18
+
19
+ <philosophy>
20
+ **Actionable findings only:**
21
+ Every issue should have enough context to create a specification. Include file paths, line numbers when relevant, and suggested fixes.
22
+
23
+ **Prioritize by impact:**
24
+ Order findings by severity. A security vulnerability matters more than a missing comment.
25
+
26
+ **Be specific, not vague:**
27
+ "UserService.ts:45 has SQL injection risk" not "there might be security issues"
28
+
29
+ **Include file paths:**
30
+ Every finding needs a file path in backticks. This enables direct navigation.
31
+ </philosophy>
32
+
33
+ <process>
34
+
35
+ ## 1. Parse Focus Area
36
+
37
+ Read focus from prompt. Default to "all" if not specified.
38
+
39
+ ## 2. Explore Codebase
40
+
41
+ **For concerns focus:**
42
+ ```bash
43
+ # TODO/FIXME/HACK comments
44
+ grep -rn "TODO\|FIXME\|HACK\|XXX\|BUG" src/ --include="*.ts" --include="*.tsx" --include="*.js" --include="*.py" 2>/dev/null | head -50
45
+
46
+ # Large files (complexity indicators)
47
+ find . -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.py" | xargs wc -l 2>/dev/null | sort -rn | head -20
48
+
49
+ # Empty catches / swallowed errors
50
+ grep -rn "catch.*{}" src/ --include="*.ts" --include="*.tsx" 2>/dev/null | head -20
51
+
52
+ # Hardcoded secrets patterns
53
+ grep -rn "password\|secret\|api_key\|apikey" src/ --include="*.ts" --include="*.tsx" --include="*.env*" 2>/dev/null | head -20
54
+
55
+ # console.log in production code
56
+ grep -rn "console.log\|console.error" src/ --include="*.ts" --include="*.tsx" 2>/dev/null | head -30
57
+ ```
58
+
59
+ **For quality focus:**
60
+ ```bash
61
+ # Check for linting/formatting config
62
+ ls .eslintrc* .prettierrc* eslint.config.* biome.json tsconfig.json 2>/dev/null
63
+
64
+ # Test file coverage
65
+ find . -name "*.test.*" -o -name "*.spec.*" | wc -l
66
+ find . -name "*.ts" -o -name "*.tsx" | grep -v test | grep -v spec | wc -l
67
+
68
+ # Type safety issues (any usage)
69
+ grep -rn ": any\|as any" src/ --include="*.ts" --include="*.tsx" 2>/dev/null | head -30
70
+
71
+ # Duplicate code patterns (similar function names)
72
+ grep -rn "function\|const.*=" src/ --include="*.ts" | cut -d: -f3 | sort | uniq -d | head -20
73
+ ```
74
+
75
+ **For arch focus:**
76
+ ```bash
77
+ # Directory structure
78
+ find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' | head -40
79
+
80
+ # Circular dependency indicators
81
+ grep -rn "import.*from" src/ --include="*.ts" | head -100
82
+
83
+ # Entry points
84
+ ls src/index.* src/main.* src/app.* app/page.* pages/index.* 2>/dev/null
85
+
86
+ # Large directories (potential god modules)
87
+ find src/ -type f | cut -d/ -f1-3 | sort | uniq -c | sort -rn | head -10
88
+ ```
89
+
90
+ ## 3. Deep Analysis
91
+
92
+ Read key files identified during exploration:
93
+ - Largest files (complexity hotspots)
94
+ - Files with most TODO comments
95
+ - Entry points and core modules
96
+ - Test files (or lack thereof)
97
+
98
+ ## 4. Write SCAN.md
99
+
100
+ Use the Write tool to create `.specflow/SCAN.md`:
101
+
102
+ ```markdown
103
+ # Codebase Scan Report
104
+
105
+ **Date:** [YYYY-MM-DD]
106
+ **Focus:** [focus area]
107
+
108
+ ## Executive Summary
109
+
110
+ [2-3 sentence overview of codebase health]
111
+
112
+ **Health Score:** [Good | Moderate | Needs Attention | Critical]
113
+
114
+ ---
115
+
116
+ ## Tech Debt
117
+
118
+ ### High Priority
119
+
120
+ **[Issue Title]**
121
+ - Files: `[file paths]`
122
+ - Problem: [What's wrong]
123
+ - Impact: [Why it matters]
124
+ - Fix: [How to address]
125
+
126
+ ### Medium Priority
127
+
128
+ ...
129
+
130
+ ### Low Priority
131
+
132
+ ...
133
+
134
+ ---
135
+
136
+ ## Code Quality Issues
137
+
138
+ ### Type Safety
139
+
140
+ **[Issue]**
141
+ - Files: `[paths]`
142
+ - Count: [N occurrences]
143
+ - Fix: [Approach]
144
+
145
+ ### Error Handling
146
+
147
+ ...
148
+
149
+ ### Code Duplication
150
+
151
+ ...
152
+
153
+ ---
154
+
155
+ ## Security Considerations
156
+
157
+ **[Risk Area]**
158
+ - Files: `[paths]`
159
+ - Risk: [What could happen]
160
+ - Severity: [Critical | High | Medium | Low]
161
+ - Mitigation: [What to do]
162
+
163
+ ---
164
+
165
+ ## Test Coverage Gaps
166
+
167
+ **[Untested Area]**
168
+ - Files: `[paths]`
169
+ - What's missing: [Description]
170
+ - Priority: [High | Medium | Low]
171
+
172
+ ---
173
+
174
+ ## Architecture Observations
175
+
176
+ **[Observation]**
177
+ - Current: [How it is]
178
+ - Concern: [Why it's problematic]
179
+ - Suggestion: [Improvement]
180
+
181
+ ---
182
+
183
+ ## Suggested Specifications
184
+
185
+ Based on this scan, consider creating specs for:
186
+
187
+ 1. **[Spec title]** — [brief description]
188
+ - Priority: [High | Medium | Low]
189
+ - Complexity: [small | medium | large]
190
+
191
+ 2. **[Spec title]** — [brief description]
192
+ ...
193
+
194
+ ---
195
+
196
+ *Scan completed: [timestamp]*
197
+ ```
198
+
199
+ ## 5. Return Confirmation
200
+
201
+ Return ONLY a brief confirmation:
202
+
203
+ ```
204
+ ## Scan Complete
205
+
206
+ **Focus:** {focus}
207
+ **Document:** `.specflow/SCAN.md` ({N} lines)
208
+
209
+ **Findings:**
210
+ - Tech Debt: {N} issues
211
+ - Quality: {N} issues
212
+ - Security: {N} considerations
213
+ - Test Gaps: {N} areas
214
+
215
+ Ready for review.
216
+ ```
217
+
218
+ </process>
219
+
220
+ <critical_rules>
221
+
222
+ **WRITE SCAN.MD DIRECTLY.** Do not return findings to orchestrator.
223
+
224
+ **ALWAYS INCLUDE FILE PATHS.** Every finding needs a file path in backticks.
225
+
226
+ **PRIORITIZE FINDINGS.** Most impactful issues first.
227
+
228
+ **BE SPECIFIC.** Line numbers, function names, concrete examples.
229
+
230
+ **SUGGEST SPECS.** End with actionable specification ideas.
231
+
232
+ **RETURN ONLY CONFIRMATION.** Your response should be ~15 lines max.
233
+
234
+ </critical_rules>
235
+
236
+ <success_criteria>
237
+ - [ ] Focus area understood
238
+ - [ ] Codebase explored thoroughly
239
+ - [ ] `.specflow/SCAN.md` written with structured findings
240
+ - [ ] File paths included throughout
241
+ - [ ] Suggested specifications provided
242
+ - [ ] Confirmation returned (not full document)
243
+ </success_criteria>
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: sf:scan
3
+ description: Deep codebase analysis — identifies concerns, tech debt, and improvement opportunities
4
+ argument-hint: "[--focus=concerns|quality|arch|all]"
5
+ ---
6
+
7
+ <purpose>
8
+ Perform deep analysis of the codebase to identify technical debt, code quality issues, architectural problems, and improvement opportunities. Results are saved to `.specflow/SCAN.md` for use in creating specifications.
9
+ </purpose>
10
+
11
+ <context>
12
+ @.specflow/PROJECT.md
13
+ @.specflow/STATE.md
14
+ @~/.claude/specflow-cc/templates/scan.md
15
+ @~/.claude/specflow-cc/agents/codebase-scanner.md
16
+ </context>
17
+
18
+ <workflow>
19
+
20
+ ## 1. Parse Arguments
21
+
22
+ ```
23
+ FOCUS = $ARGUMENTS or "all"
24
+ ```
25
+
26
+ Valid focus areas:
27
+ - `concerns` — Technical debt, bugs, security issues
28
+ - `quality` — Code quality, conventions, test coverage
29
+ - `arch` — Architecture, structure, patterns
30
+ - `all` — Full analysis (default)
31
+
32
+ ## 2. Check Prerequisites
33
+
34
+ ```bash
35
+ [ -d .specflow ] && echo "INITIALIZED" || echo "NOT_INITIALIZED"
36
+ ```
37
+
38
+ **If NOT_INITIALIZED:**
39
+ ```
40
+ ⚠️ Project not initialized
41
+
42
+ Run /sf init first to set up SpecFlow.
43
+ ```
44
+ STOP.
45
+
46
+ ## 3. Check Existing Scan
47
+
48
+ ```bash
49
+ [ -f .specflow/SCAN.md ] && echo "EXISTS" || echo "NEW"
50
+ ```
51
+
52
+ **If EXISTS:**
53
+ Ask user:
54
+ ```
55
+ 📊 Previous scan found (.specflow/SCAN.md)
56
+
57
+ Options:
58
+ 1) Refresh — Run new scan (overwrites existing)
59
+ 2) View — Show existing scan results
60
+ 3) Cancel
61
+
62
+ Choice?
63
+ ```
64
+
65
+ ## 4. Launch Scanner Agent
66
+
67
+ Use the Task tool to spawn codebase-scanner agent:
68
+
69
+ ```
70
+ subagent_type="sf-codebase-scanner"
71
+ prompt="""
72
+ Focus: {FOCUS}
73
+ Project: {from PROJECT.md}
74
+
75
+ Scan the codebase and write findings to .specflow/SCAN.md
76
+
77
+ Return only confirmation when done.
78
+ """
79
+ ```
80
+
81
+ ## 5. Verify Results
82
+
83
+ After agent completes:
84
+
85
+ ```bash
86
+ [ -f .specflow/SCAN.md ] && wc -l .specflow/SCAN.md
87
+ ```
88
+
89
+ ## 6. Display Summary
90
+
91
+ Read `.specflow/SCAN.md` and extract summary:
92
+
93
+ ```
94
+ 📊 Codebase Scan Complete
95
+
96
+ Focus: {FOCUS}
97
+ Lines analyzed: ~{estimate}
98
+
99
+ ┌─────────────────────────────────────────────┐
100
+ │ Summary │
101
+ ├─────────────────────────────────────────────┤
102
+ │ Tech Debt: {count} issues │
103
+ │ Quality Issues: {count} findings │
104
+ │ Security: {count} considerations │
105
+ │ Test Gaps: {count} areas │
106
+ └─────────────────────────────────────────────┘
107
+
108
+ Top Priority Issues:
109
+ 1. {issue 1}
110
+ 2. {issue 2}
111
+ 3. {issue 3}
112
+
113
+ 📁 Full report: .specflow/SCAN.md
114
+
115
+ Next steps:
116
+ • /sf new "Fix: {top concern}" — Create spec for top issue
117
+ • /sf todo {concern} — Add to backlog for later
118
+ ```
119
+
120
+ </workflow>
121
+
122
+ <fallback>
123
+ If agent cannot be spawned, perform scan directly:
124
+
125
+ 1. Explore codebase structure
126
+ 2. Search for TODO/FIXME comments
127
+ 3. Identify large/complex files
128
+ 4. Check test coverage gaps
129
+ 5. Look for code smells
130
+ 6. Write findings to `.specflow/SCAN.md`
131
+ </fallback>
132
+
133
+ <output_format>
134
+ **Success:**
135
+ ```
136
+ 📊 Codebase Scan Complete
137
+
138
+ [Summary table]
139
+ [Top issues]
140
+ [Next steps]
141
+ ```
142
+
143
+ **No issues found:**
144
+ ```
145
+ ✅ Codebase scan complete — no critical concerns found
146
+
147
+ Minor observations saved to .specflow/SCAN.md
148
+ ```
149
+
150
+ **Error:**
151
+ ```
152
+ ❌ Scan failed: {reason}
153
+
154
+ Try running manually or check .specflow/ permissions.
155
+ ```
156
+ </output_format>
157
+
158
+ <success_criteria>
159
+ - [ ] Focus area parsed correctly
160
+ - [ ] Scanner agent spawned (or fallback executed)
161
+ - [ ] .specflow/SCAN.md created with findings
162
+ - [ ] Summary displayed to user
163
+ - [ ] Next steps provided
164
+ </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specflow-cc",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
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"
@@ -0,0 +1,96 @@
1
+ # Codebase Scan Report
2
+
3
+ **Date:** [YYYY-MM-DD]
4
+ **Focus:** [all | concerns | quality | arch]
5
+
6
+ ## Executive Summary
7
+
8
+ [2-3 sentence overview of codebase health and key findings]
9
+
10
+ **Health Score:** [Good | Moderate | Needs Attention | Critical]
11
+
12
+ ---
13
+
14
+ ## Tech Debt
15
+
16
+ ### High Priority
17
+
18
+ **[Issue Title]**
19
+ - Files: `[file/path.ts]`
20
+ - Problem: [What's wrong]
21
+ - Impact: [Why it matters]
22
+ - Fix: [How to address]
23
+
24
+ ### Medium Priority
25
+
26
+ <!-- Add issues here -->
27
+
28
+ ### Low Priority
29
+
30
+ <!-- Add issues here -->
31
+
32
+ ---
33
+
34
+ ## Code Quality Issues
35
+
36
+ ### Type Safety
37
+
38
+ **[Issue]**
39
+ - Files: `[paths]`
40
+ - Count: [N occurrences]
41
+ - Fix: [Approach]
42
+
43
+ ### Error Handling
44
+
45
+ <!-- Swallowed errors, missing catches, etc. -->
46
+
47
+ ### Code Duplication
48
+
49
+ <!-- Similar code patterns that should be abstracted -->
50
+
51
+ ---
52
+
53
+ ## Security Considerations
54
+
55
+ **[Risk Area]**
56
+ - Files: `[paths]`
57
+ - Risk: [What could happen]
58
+ - Severity: [Critical | High | Medium | Low]
59
+ - Mitigation: [What to do]
60
+
61
+ ---
62
+
63
+ ## Test Coverage Gaps
64
+
65
+ **[Untested Area]**
66
+ - Files: `[paths]`
67
+ - What's missing: [Description]
68
+ - Priority: [High | Medium | Low]
69
+
70
+ ---
71
+
72
+ ## Architecture Observations
73
+
74
+ **[Observation]**
75
+ - Current: [How it is]
76
+ - Concern: [Why it's problematic]
77
+ - Suggestion: [Improvement]
78
+
79
+ ---
80
+
81
+ ## Suggested Specifications
82
+
83
+ Based on this scan, consider creating specs for:
84
+
85
+ 1. **[Spec title]** — [brief description]
86
+ - Priority: high | medium | low
87
+ - Complexity: small | medium | large
88
+ - Command: `/sf new "[title]"`
89
+
90
+ 2. **[Spec title]** — [brief description]
91
+ - Priority: ...
92
+ - Complexity: ...
93
+
94
+ ---
95
+
96
+ *Scan completed: [timestamp]*