sdd-pipeline 1.2.2 → 1.2.3

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.
@@ -1,385 +1,140 @@
1
- # SDD TASKS Generator - Phase 3
2
- # Generates tasks including TEST tasks from SPEC.md testing requirements
3
- $ErrorActionPreference = 'Stop'
1
+ # SDD Tasks Generator - Phase 3
2
+ # Standalone script for non-Claude Code usage
3
+ # Usage: powershell -File commands/sdd-tasks.ps1
4
4
 
5
- $SDD_TASKS_DIR = "sdd/tasks"
5
+ $ErrorActionPreference = 'Stop'
6
6
 
7
7
  Write-Host ""
8
- Write-Host "=== SDD TASKS Generator - Phase 3 ===" -ForegroundColor Cyan
9
- Write-Host ""
8
+ Write-Host "=== SDD Tasks Generator - Phase 3 ===" -ForegroundColor Cyan
10
9
 
11
- # Check for SPEC
10
+ # Check SPEC
12
11
  $specPath = "sdd/SPEC.md"
13
12
  if (-not (Test-Path $specPath)) {
14
- Write-Host "[ERROR] Phase 2 not complete." -ForegroundColor Red
15
- Write-Host "sdd/SPEC.md not found." -ForegroundColor Red
13
+ Write-Host "[ERROR] SPEC.md not found at $specPath" -ForegroundColor Red
14
+ Write-Host "Run: sdd bmad [feature]" -ForegroundColor Yellow
15
+ Write-Host "Then: claude `/sdd-spec`" -ForegroundColor Yellow
16
16
  exit 1
17
17
  }
18
- Write-Host "[OK] SPEC.md verified" -ForegroundColor Green
18
+ Write-Host "[OK] Found: $specPath" -ForegroundColor Green
19
19
 
20
- # Read SPEC
20
+ # Parse SPEC
21
21
  $specContent = Get-Content $specPath -Raw -Encoding UTF8
22
22
 
23
23
  # Extract project name
24
24
  $projectName = "Project"
25
- if ($specContent -match "^# SPEC\.md.*?[-—]\s+(.+)$") {
25
+ if ($specContent -match "^#\s+SPEC\.md\s*[-—]\s*(.+)$") {
26
26
  $projectName = $Matches[1].Trim()
27
27
  }
28
28
 
29
- # Extract features for testing
29
+ # Extract features
30
30
  $features = @()
31
- if ($specContent -match "### 4\.1 Core Features(.+?)(?=###|\Z)" -CaseSensitive:$false) {
31
+ if ($specContent -match "(?s)### 4\.1\s+Core Features(.+?)(?=###|\Z)") {
32
32
  $featuresSection = $Matches[1]
33
- $featureBlocks = [regex]::Matches($featuresSection, '(?:#### \[([^\]]+)\]|(?:^|\n)- \*\*As a\*\*[^$]+)')
34
- foreach ($block in $featureBlocks) {
35
- if ($block.Value -match '\*\*As a\*\*[^,]+,\s*\*\*I want\*\*\s*([^,]+)') {
36
- $features += $Matches[1].Trim()
37
- }
33
+ $featureMatches = [regex]::Matches($featuresSection, "(?s)####\s+\[([^\]]+)\](.+?)(?=####|\Z)")
34
+ foreach ($match in $featureMatches) {
35
+ $features += $match.Groups[1].Value.Trim()
38
36
  }
39
37
  }
40
38
 
41
- # Extract test requirements
39
+ # Extract test categories
42
40
  $testCategories = @()
43
- if ($specContent -match "### 9\.1 Test Categories(.+?)(?=###|\Z)" -CaseSensitive:$false) {
41
+ if ($specContent -match "(?s)### 9\.1\s+Test Categories(.+?)(?=###|\Z)") {
44
42
  $testSection = $Matches[1]
45
- if ($testSection -match 'Unit Tests') { $testCategories += 'Unit' }
46
- if ($testSection -match 'Integration Tests') { $testCategories += 'Integration' }
47
- if ($testSection -match 'E2E Tests') { $testCategories += 'E2E' }
48
- if ($testSection -match 'Accessibility Tests') { $testCategories += 'Accessibility' }
43
+ if ($testSection -match 'Unit\s+Tests') { $testCategories += 'Unit' }
44
+ if ($testSection -match 'Integration\s+Tests') { $testCategories += 'Integration' }
45
+ if ($testSection -match 'E2E\s+Tests') { $testCategories += 'E2E' }
46
+ if ($testSection -match 'Accessibility\s+Tests') { $testCategories += 'Accessibility' }
49
47
  }
50
48
 
51
- # Extract user flows for testing
52
- $userFlows = @()
53
- if ($specContent -match "Flow:\s*(.+?)(?=\n\s*$|\n\s*\`\`\`)" -CaseSensitive:$false) {
54
- $userFlows = [regex]::Matches($specContent, "Flow:\s*(.+?)[\n\r]", [System.Text.RegularExpressions.RegexOptions]::Singleline) | ForEach-Object { $_.Groups[1].Value.Trim() }
55
- }
56
-
57
- # Extract test specifications
58
- $unitTests = @()
59
- if ($specContent -match "(?:### 9\.2 Unit Test Specifications|Unit:\s*(.+?)(?=Unit:|Flow:|\Z))" -CaseSensitive:$false) {
60
- $unitSection = $Matches[0]
61
- $unitTests = [regex]::Matches($unitSection, "it\('([^']+)'") | ForEach-Object { $_.Groups[1].Value }
62
- }
49
+ Write-Host "[OK] Project: $projectName" -ForegroundColor Green
50
+ Write-Host "[OK] Features: $($features.Count)" -ForegroundColor Green
51
+ Write-Host "[OK] Test categories: $($testCategories -join ', ')" -ForegroundColor Green
63
52
 
64
53
  # Create task directory
65
- $TASK_ID = Get-Date -Format "yyyyMMdd-HHmmss"
66
- $TASK_DIR = "$SDD_TASKS_DIR/task-$TASK_ID-$($projectName.ToLower().Replace(' ', '-'))"
67
- New-Item -ItemType Directory -Path $TASK_DIR -Force | Out-Null
54
+ $timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
55
+ $safeName = $projectName -replace '[^a-zA-Z0-9]', '-' -replace '-+', '-'
56
+ $taskDir = "sdd/tasks/task-$timestamp-$safeName"
57
+ New-Item -ItemType Directory -Path $taskDir -Force | Out-Null
58
+ Write-Host "[OK] Created: $taskDir" -ForegroundColor Green
68
59
 
69
60
  # Build task list
70
- $taskList = @()
61
+ $tasks = @()
62
+ $phase = 1
63
+
64
+ # Task 1: Setup
65
+ $tasks += @{ Id = "T-00$phase"; Name = "Project Setup"; Phase = $phase }
66
+ $phase++
67
+ $prevId = $tasks[-1].Id
68
+
69
+ # Feature tasks
70
+ foreach ($feature in $features) {
71
+ $tasks += @{ Id = "T-00$phase"; Name = $feature; Phase = $phase; DependsOn = $prevId }
72
+ $prevId = "T-00$phase"
73
+ $phase++
74
+ }
71
75
 
72
- # Phase 1: Project Setup
73
- $taskList += @{
74
- id = "T-001"
75
- name = "Project Setup"
76
- phase = 1
77
- estimate = "1h"
78
- depends_on = @()
79
- content = @"
80
- ---
81
- name: T-001-project-setup
82
- description: "Initial project setup: create directory structure, configuration files, and base code"
83
- phase: 1
84
- estimate: 1h
85
- spec_sections: ["3.1", "4.1"]
86
- depends_on: []
87
- ---
76
+ # Test tasks
77
+ foreach ($category in $testCategories) {
78
+ $tasks += @{ Id = "T-00$phase"; Name = "$category Tests"; Phase = $phase; DependsOn = $prevId }
79
+ $prevId = "T-00$phase"
80
+ $phase++
81
+ }
88
82
 
89
- # T-001: Project Setup
83
+ # Final task
84
+ $tasks += @{ Id = "T-00$phase"; Name = "Final Polish"; Phase = $phase; DependsOn = $prevId }
90
85
 
91
- ## Files to Create
92
- - [List files based on tech stack from SPEC Section 6]
86
+ # Generate MASTER-TASKS.md
87
+ $masterContent = "# MASTER-TASKS — $projectName`n`n"
88
+ $masterContent += "| ID | Name | Estimate | Status |`n|----|------|----------|--------|`n"
89
+ foreach ($t in $tasks) {
90
+ $masterContent += "| $($t.Id) | $($t.Name) | 1h | [ ] |`n"
91
+ }
92
+ $masterContent += "`n## Progress`n`n- Completed: 0 / $($tasks.Count)`n- Pending: $($tasks.Count)`n`n"
93
+ $masterContent += "## Test Categories`n`n$($testCategories -join ', ')`n`n"
94
+ $masterContent += "## Notes`n`nGenerated from: SPEC.md`nAuto-generated by SDD Pipeline v1.2.2`n"
93
95
 
94
- ## Implementation Steps
95
- 1. Create project structure
96
- 2. Set up configuration files
97
- 3. Create base HTML/CSS/JS files
98
- 4. Verify initial setup works
96
+ Set-Content -Path "$taskDir/MASTER-TASKS.md" -Value $masterContent -Encoding UTF8
97
+ Write-Host " [CREATED] MASTER-TASKS.md" -ForegroundColor Gray
99
98
 
100
- ## Verification
101
- - [ ] Project structure matches spec
102
- - [ ] Configuration files created
103
- - [ ] Base files load without errors
104
- "@
105
- }
99
+ # Generate task files
100
+ foreach ($t in $tasks) {
101
+ $safeName = $t.Name -replace '[^a-zA-Z0-9]', '-' -replace '-+', '-'
102
+ $filename = "$($t.Id)-$safeName.md"
103
+ $dependsOn = if ($t.DependsOn) { "@($($t.DependsOn))" } else { "@()" }
106
104
 
107
- # Phase 2-4: Feature implementation tasks (placeholder)
108
- $featurePhase = 2
109
- $features | ForEach-Object {
110
- $featureName = $_
111
- $taskList += @{
112
- id = "T-00$featurePhase"
113
- name = "$featureName"
114
- phase = $featurePhase
115
- estimate = "1h"
116
- depends_on = @("T-001")
117
- content = @"
105
+ $taskContent = @"
118
106
  ---
119
- name: T-00$featurePhase-feature
120
- description: "Implement: $featureName"
121
- phase: $featurePhase
107
+ name: $filename
108
+ description: "$($t.Name)"
109
+ phase: $($t.Phase)
122
110
  estimate: 1h
123
111
  spec_sections: ["4.1"]
124
- depends_on: ["T-001"]
112
+ depends_on: [$dependsOn]
125
113
  ---
126
114
 
127
- # T-00$featurePhase`: $featureName
115
+ # $($t.Id): $($t.Name)
128
116
 
129
117
  ## Files to Modify/Create
130
118
  - [List files]
131
119
 
132
120
  ## Implementation Steps
133
- 1. Implement $featureName feature
134
- 2. Connect to other components
135
- 3. Test manually
136
-
137
- ## Verification
138
- - [ ] Feature works as specified
139
- - [ ] No console errors
140
- "@
141
- }
142
- $featurePhase++
143
- }
144
-
145
- # Phase for testing
146
- $testPhase = $featurePhase
147
-
148
- # Add TEST tasks based on categories
149
- if ($testCategories -contains 'Unit' -or $unitTests.Count -gt 0) {
150
- $taskList += @{
151
- id = "T-00$testPhase"
152
- name = "Unit Tests"
153
- phase = $testPhase
154
- estimate = "1h"
155
- depends_on = @("T-00$($testPhase-1)")
156
- content = @"
157
- ---
158
- name: T-00$testPhase-unit-tests
159
- description: "Write and run unit tests for core functionality"
160
- phase: $testPhase
161
- estimate: 1h
162
- spec_sections: ["9.1", "9.2"]
163
- depends_on: ["T-00$($testPhase-1)"]
164
- ---
165
-
166
- # T-00$testPhase`: Unit Tests
167
-
168
- ## Test Files to Create
169
- - `tests/unit/*.test.js` (or equivalent)
170
-
171
- ## Unit Tests to Implement
172
-
173
- ### Core Functions
174
- ` + ($unitTests -join "`n- `") + @"
175
-
176
- ### Test Cases
177
- - Test happy path (valid input)
178
- - Test error path (invalid input)
179
- - Test edge cases (empty, null, boundary values)
121
+ 1. [Step 1]
122
+ 2. [Step 2]
123
+ 3. [Step 3]
180
124
 
181
125
  ## Verification
182
- - [ ] All unit tests pass
183
- - [ ] Code coverage > 80%
184
- - [ ] No failing tests
126
+ - [ ] Check 1
127
+ - [ ] Check 2
128
+ - [ ] Check 3
185
129
  "@
186
- }
187
- $testPhase++
188
- }
189
130
 
190
- if ($testCategories -contains 'Integration') {
191
- $taskList += @{
192
- id = "T-00$testPhase"
193
- name = "Integration Tests"
194
- phase = $testPhase
195
- estimate = "1h"
196
- depends_on = @("T-00$($testPhase-1)")
197
- content = @"
198
- ---
199
- name: T-00$testPhase-integration-tests
200
- description: "Write integration tests for component interactions"
201
- phase: $testPhase
202
- estimate: 1h
203
- spec_sections: ["9.1", "9.3"]
204
- depends_on: ["T-00$($testPhase-1)"]
205
- ---
206
-
207
- # T-00$testPhase`: Integration Tests
208
-
209
- ## Test Files to Create
210
- - `tests/integration/*.test.js`
211
-
212
- ## Integration Flows to Test
213
- ` + ($userFlows | ForEach-Object { "- $_" } -join "`n") + @"
214
-
215
- ## Test Scenarios
216
- - Verify components interact correctly
217
- - Test data flow between modules
218
- - Verify state changes propagate
219
-
220
- ## Verification
221
- - [ ] All integration tests pass
222
- - [ ] Components communicate correctly
223
- - [ ] State management works
224
- "@
225
- }
226
- $testPhase++
227
- }
228
-
229
- if ($testCategories -contains 'E2E') {
230
- $taskList += @{
231
- id = "T-00$testPhase"
232
- name = "End-to-End Tests"
233
- phase = $testPhase
234
- estimate = "1h"
235
- depends_on = @("T-00$($testPhase-1)")
236
- content = @"
237
- ---
238
- name: T-00$testPhase-e2e-tests
239
- description: "Write E2E tests for complete user workflows"
240
- phase: $testPhase
241
- estimate: 1h
242
- spec_sections: ["9.1", "9.4"]
243
- depends_on: ["T-00$($testPhase-1)"]
244
- ---
245
-
246
- # T-00$testPhase`: End-to-End Tests
247
-
248
- ## Test Files to Create
249
- - `tests/e2e/*.test.js`
250
-
251
- ## E2E Scenarios
252
- ` + ($userFlows | ForEach-Object { "- $_" } -join "`n") + @"
253
-
254
- ## Test Approach
255
- - Use Playwright/Cypress/Selenium
256
- - Test complete user journeys
257
- - Verify full application flow
258
-
259
- ## Verification
260
- - [ ] All E2E tests pass
261
- - [ ] User flows complete successfully
262
- - [ ] No broken links or redirects
263
- "@
264
- }
265
- $testPhase++
266
- }
267
-
268
- if ($testCategories -contains 'Accessibility') {
269
- $taskList += @{
270
- id = "T-00$testPhase"
271
- name = "Accessibility Tests"
272
- phase = $testPhase
273
- estimate = "1h"
274
- depends_on = @("T-00$($testPhase-1)")
275
- content = @"
276
- ---
277
- name: T-00$testPhase-a11y-tests
278
- description: "Verify accessibility compliance (WCAG 2.1 AA)"
279
- phase: $testPhase
280
- estimate: 1h
281
- spec_sections: ["9.1"]
282
- depends_on: ["T-00$($testPhase-1)"]
283
- ---
284
-
285
- # T-00$testPhase`: Accessibility Tests
286
-
287
- ## Accessibility Requirements (from SPEC Section 3.1)
288
- - Keyboard navigable
289
- - Screen reader labels
290
- - Color contrast compliance
291
-
292
- ## Test Tools
293
- - axe-core
294
- - Lighthouse
295
- - NVDA/VoiceOver
296
-
297
- ## Verification
298
- - [ ] axe-core reports 0 violations
299
- - [ ] Keyboard navigation works
300
- - [ ] Screen reader announces content
301
- - [ ] Color contrast meets WCAG AA
302
- "@
303
- }
304
- $testPhase++
305
- }
306
-
307
- # Final phase: Polish and Converge
308
- $finalPhase = $testPhase
309
- $taskList += @{
310
- id = "T-00$finalPhase"
311
- name = "Final Polish and Converge"
312
- phase = $finalPhase
313
- estimate = "1h"
314
- depends_on = @("T-00$($finalPhase-1)")
315
- content = @"
316
- ---
317
- name: T-00$finalPhase-final-polish
318
- description: "Final polish, code review, and converge validation"
319
- phase: $finalPhase
320
- estimate: 1h
321
- spec_sections: ["9", "10"]
322
- depends_on: ["T-00$($finalPhase-1)"]
323
- ---
324
-
325
- # T-00$finalPhase`: Final Polish and Converge
326
-
327
- ## Final Checks
328
- - [ ] All tests pass
329
- - [ ] Code follows style guide
330
- - [ ] No console errors
331
- - [ ] Responsive design works
332
- - [ ] Performance acceptable
333
-
334
- ## Converge Validation
335
- - Run: `pwsh run-converge.ps1 -Strict`
336
- - Verify all checks pass
337
- - Fix any issues found
338
-
339
- ## Verification
340
- - [ ] All converge checks pass
341
- - [ ] Ready for deployment
342
- "@
343
- }
344
-
345
- # Generate MASTER-TASKS.md
346
- $masterTasks = "# MASTER-TASKS — $projectName`n`n"
347
- $masterTasks += "## Task Index`n`n"
348
- $masterTasks += "| ID | Name | Estimate | Status |`n"
349
- $masterTasks += "|----|------|----------|--------|`n"
350
-
351
- $totalTasks = $taskList.Count
352
- $completed = 0
353
-
354
- $taskList | ForEach-Object {
355
- $masterTasks += "| $($_.id) | $($_.name) | $($_.estimate) | [ ] |`n"
356
- }
357
-
358
- $masterTasks += "`n## Progress`n`n"
359
- $masterTasks += "- Completed: $completed / $totalTasks`n"
360
- $masterTasks += "- In Progress: 0`n"
361
- $masterTasks += "- Pending: $totalTasks`n`n"
362
- $masterTasks += "## Notes`n`n"
363
- $masterTasks += "Generated from SPEC.md testing requirements.`n"
364
- $masterTasks += "Test categories detected: $($testCategories -join ', ')`n"
365
-
366
- Set-Content -Path "$TASK_DIR/MASTER-TASKS.md" -Value $masterTasks -Encoding UTF8
367
- Write-Host " [CREATED] MASTER-TASKS.md" -ForegroundColor Gray
368
-
369
- # Generate task files
370
- $taskList | ForEach-Object {
371
- $task = $_
372
- # Convert ID like T-001 to T-001-name.md
373
- $safeName = $task.name -replace '[^a-zA-Z0-9]', '-' -replace '-+', '-'
374
- $filename = "$($task.id)-$($safeName.ToLower()).md"
375
- Set-Content -Path "$TASK_DIR/$filename" -Value $task.content -Encoding UTF8
131
+ Set-Content -Path "$taskDir/$filename" -Value $taskContent -Encoding UTF8
376
132
  Write-Host " [CREATED] $filename" -ForegroundColor Gray
377
133
  }
378
134
 
379
135
  Write-Host ""
380
- Write-Host "[OK] Tasks created: $TASK_DIR" -ForegroundColor Green
381
- Write-Host " MASTER-TASKS.md"
382
- Write-Host " $($taskList.Count) task files"
383
- Write-Host " Test tasks: $($testCategories -join ', ')"
136
+ Write-Host "[OK] Tasks generated: $($tasks.Count) tasks" -ForegroundColor Green
137
+ Write-Host ""
138
+ Write-Host "Directory: $taskDir" -ForegroundColor White
384
139
  Write-Host ""
385
- Write-Host "Next: claude `/sdd-cook` or manually implement tasks" -ForegroundColor Cyan
140
+ Write-Host "Next: /sdd-cook --all" -ForegroundColor Cyan