sdd-pipeline 1.2.1 → 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.
package/bin/sdd.js CHANGED
@@ -4,7 +4,7 @@
4
4
  const path = require('path')
5
5
  const fs = require('fs')
6
6
  const init = require('../lib/init')
7
- const bmad = require('../lib/bmad')
7
+ const bmad = require('../lib/bmad/index')
8
8
  const config = require('../lib/config')
9
9
 
10
10
  const args = process.argv.slice(2)
@@ -77,6 +77,12 @@ function inferProblem(input) {
77
77
  if (lower.includes('export') || lower.includes('report')) {
78
78
  return 'Users cannot act on their data — business decisions are slowed or made without full information.'
79
79
  }
80
+ if (lower.includes('todo') || lower.includes('task')) {
81
+ return 'Users forget tasks or lack a system to track progress — important items slip through the cracks.'
82
+ }
83
+ if (lower.includes('contact form') || lower.includes('form')) {
84
+ return 'Users cannot easily reach out or submit information — communication barriers reduce engagement.'
85
+ }
80
86
 
81
87
  // Generic fallback
82
88
  return 'Users face a friction point that prevents them from completing their goal — specific symptoms and impact are being confirmed in the interview.'
@@ -2,13 +2,17 @@
2
2
  ---
3
3
  tool: Bash
4
4
  when: always
5
- description: Phase 3 — Break SPEC.md into independently verifiable tasks (each ≤2 hours). Creates sdd/tasks/task-{timestamp}-{project}/ with MASTER-TASKS.md + T-XXX-*.md files. Args: optional flags.
5
+ description: Phase 3 — Break SPEC.md into independently verifiable tasks (each ≤2 hours). Creates sdd/tasks/task-{timestamp}-{project}/ with MASTER-TASKS.md + T-XXX-*.md files. Includes test tasks from SPEC Section 9.
6
+ args: optional
6
7
  ---
7
8
  $ErrorActionPreference = "Stop"
8
9
 
9
- # --- Output path resolution ---
10
+ # Parse arguments
11
+ $args = $argsRaw.Trim()
12
+
13
+ # Output path resolution
10
14
  $SDD_OUTPUT_BASE = "sdd"
11
- $SDD_TASKS_DIR = "sdd/tasks"
15
+ $SDD_TASKS_DIR = "$SDD_OUTPUT_BASE/tasks"
12
16
 
13
17
  # Check config for custom output directory
14
18
  if (Test-Path ".sdd/config.json") {
@@ -28,7 +32,7 @@ if (-not (Test-Path $SDD_TASKS_DIR)) {
28
32
  New-Item -ItemType Directory -Path $SDD_TASKS_DIR -Force | Out-Null
29
33
  }
30
34
 
31
- # --- Gate 1: SPEC.md must exist ---
35
+ # Gate 1: SPEC.md must exist
32
36
  $specPath = "$SDD_OUTPUT_BASE/SPEC.md"
33
37
  $legacySpecPath = "SPEC.md"
34
38
 
@@ -42,24 +46,183 @@ if (-not (Test-Path $specPath) -and -not (Test-Path $legacySpecPath)) {
42
46
 
43
47
  if (Test-Path $specPath) {
44
48
  Write-Host "[OK] Found: $specPath" -ForegroundColor Green
49
+ $activeSpec = $specPath
45
50
  } else {
46
51
  Write-Host "[OK] Found: $legacySpecPath (legacy location)" -ForegroundColor Green
52
+ Write-Host "[MIGRATE] SPEC.md should be moved to $specPath" -ForegroundColor Yellow
53
+ $activeSpec = $legacySpecPath
47
54
  }
48
55
 
49
- # --- Gate 2: Templates must exist ---
50
- if (!(Test-Path "templates/task-master.template.md")) {
51
- Write-Host ""
52
- Write-Host "ERROR: templates/task-master.template.md not found. Run /sdd-init first." -ForegroundColor Red
53
- exit 1
56
+ Write-Host ""
57
+ Write-Host "=== SDD Tasks Generator - Phase 3 ===" -ForegroundColor Cyan
58
+
59
+ # Read and parse SPEC
60
+ $specContent = Get-Content $activeSpec -Raw -Encoding UTF8
61
+
62
+ # Extract project name
63
+ $projectName = "Project"
64
+ if ($specContent -match "^#\s+SPEC\.md\s*[-—]\s*(.+)$") {
65
+ $projectName = $Matches[1].Trim()
54
66
  }
55
- if (!(Test-Path "templates/task-detail.template.md")) {
56
- Write-Host ""
57
- Write-Host "ERROR: templates/task-detail.template.md not found. Run /sdd-init first." -ForegroundColor Red
58
- exit 1
67
+
68
+ # Extract features
69
+ $features = @()
70
+ if ($specContent -match "(?s)### 4\.1\s+Core Features(.+?)(?=###|\Z)") {
71
+ $featuresSection = $Matches[1]
72
+ $featureMatches = [regex]::Matches($featuresSection, "(?s)####\s+\[([^\]]+)\](.+?)(?=####|\Z)")
73
+ foreach ($match in $featureMatches) {
74
+ $features += @{
75
+ Name = $match.Groups[1].Value.Trim()
76
+ Content = $match.Groups[2].Value
77
+ }
78
+ }
79
+ }
80
+
81
+ # Extract test categories
82
+ $testCategories = @()
83
+ if ($specContent -match "(?s)### 9\.1\s+Test Categories(.+?)(?=###|\Z)") {
84
+ $testSection = $Matches[1]
85
+ if ($testSection -match 'Unit\s+Tests') { $testCategories += 'Unit' }
86
+ if ($testSection -match 'Integration\s+Tests') { $testCategories += 'Integration' }
87
+ if ($testSection -match 'E2E\s+Tests') { $testCategories += 'E2E' }
88
+ if ($testSection -match 'Accessibility\s+Tests') { $testCategories += 'Accessibility' }
89
+ }
90
+
91
+ Write-Host "[OK] Project: $projectName" -ForegroundColor Green
92
+ Write-Host "[OK] Features: $($features.Count)" -ForegroundColor Green
93
+ Write-Host "[OK] Test categories: $($testCategories -join ', ')" -ForegroundColor Green
94
+
95
+ # Create task directory
96
+ $timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
97
+ $safeName = $projectName -replace '[^a-zA-Z0-9]', '-' -replace '-+', '-'
98
+ $taskDir = "$SDD_TASKS_DIR/task-$timestamp-$safeName"
99
+ New-Item -ItemType Directory -Path $taskDir -Force | Out-Null
100
+ Write-Host "[OK] Created: $taskDir" -ForegroundColor Green
101
+
102
+ # Generate tasks
103
+ $tasks = @()
104
+ $phase = 1
105
+
106
+ # Task 1: Setup
107
+ $tasks += @{
108
+ Id = "T-001"
109
+ Name = "Project Setup"
110
+ Phase = $phase
111
+ DependsOn = @()
112
+ }
113
+
114
+ $phase++
115
+ $prevTask = $tasks[-1].Id
116
+
117
+ # Feature tasks
118
+ foreach ($feature in $features) {
119
+ $tasks += @{
120
+ Id = "T-00$phase"
121
+ Name = $feature.Name
122
+ Phase = $phase
123
+ DependsOn = @($prevTask)
124
+ }
125
+ $prevTask = "T-00$phase"
126
+ $phase++
127
+ }
128
+
129
+ # Test tasks
130
+ foreach ($category in $testCategories) {
131
+ $tasks += @{
132
+ Id = "T-00$phase"
133
+ Name = "$category Tests"
134
+ Phase = $phase
135
+ DependsOn = @($prevTask)
136
+ }
137
+ $prevTask = "T-00$phase"
138
+ $phase++
59
139
  }
60
- Write-Host "[OK] Templates verified" -ForegroundColor Green
61
140
 
62
- # --- Update config ---
141
+ # Final task
142
+ $tasks += @{
143
+ Id = "T-00$phase"
144
+ Name = "Final Polish"
145
+ Phase = $phase
146
+ DependsOn = @($prevTask)
147
+ }
148
+
149
+ # Generate MASTER-TASKS.md
150
+ $masterContent = @"
151
+ # MASTER-TASKS — $projectName
152
+
153
+ ## Task Index
154
+
155
+ | ID | Name | Estimate | Status |
156
+ |----|------|----------|--------|
157
+ "@
158
+
159
+ foreach ($task in $tasks) {
160
+ $masterContent += "| $($task.Id) | $($task.Name) | 1h | [ ] |`n"
161
+ }
162
+
163
+ $total = $tasks.Count
164
+ $masterContent += @"
165
+
166
+ ## Progress
167
+
168
+ - Completed: 0 / $total
169
+ - In Progress: 0
170
+ - Pending: $total
171
+
172
+ ## Test Categories
173
+
174
+ $($testCategories -join ', ')
175
+
176
+ ## Notes
177
+
178
+ Generated from: SPEC.md
179
+ Auto-generated by SDD Pipeline v1.2.2
180
+ "@
181
+
182
+ Set-Content -Path "$taskDir/MASTER-TASKS.md" -Value $masterContent -Encoding UTF8
183
+ Write-Host " [CREATED] MASTER-TASKS.md" -ForegroundColor Gray
184
+
185
+ # Generate individual task files
186
+ $taskNum = 1
187
+ foreach ($task in $tasks) {
188
+ $safeName = $task.Name -replace '[^a-zA-Z0-9]', '-' -replace '-+', '-'
189
+ $filename = "$($task.Id)-$safeName.md"
190
+
191
+ $taskContent = @"
192
+ ---
193
+ name: $filename
194
+ description: "$($task.Name)"
195
+ phase: $($task.Phase)
196
+ estimate: 1h
197
+ spec_sections: ["4.1"]
198
+ depends_on: [$($task.DependsOn -join ', ')]
199
+ ---
200
+
201
+ # $($task.Id): $($task.Name)
202
+
203
+ ## Files to Modify/Create
204
+
205
+ - [List files]
206
+
207
+ ## Implementation Steps
208
+
209
+ 1. [Step 1]
210
+ 2. [Step 2]
211
+ 3. [Step 3]
212
+
213
+ ## Verification
214
+
215
+ - [ ] Verification check 1
216
+ - [ ] Verification check 2
217
+ - [ ] Verification check 3
218
+ "@
219
+
220
+ Set-Content -Path "$taskDir/$filename" -Value $taskContent -Encoding UTF8
221
+ Write-Host " [CREATED] $filename" -ForegroundColor Gray
222
+ $taskNum++
223
+ }
224
+
225
+ # Update config
63
226
  if (Test-Path ".sdd/config.json") {
64
227
  $config = Get-Content ".sdd/config.json" -Raw | ConvertFrom-Json
65
228
  $config.phases.current = 3
@@ -67,55 +230,13 @@ if (Test-Path ".sdd/config.json") {
67
230
  $config.phases.phase2.completedAt = (Get-Date -Format "yyyy-MM-dd")
68
231
  $config.phases.phase3.status = "in-progress"
69
232
  $config | ConvertTo-Json -Depth 10 | Set-Content ".sdd/config.json"
233
+ Write-Host "[OK] Config updated" -ForegroundColor Green
70
234
  }
71
235
 
72
- # --- Generate task directory name ---
73
- $timestamp = Get-Date -Format "yyMMdd-HHmmss"
74
- $projectName = if ($config.project.name -and $config.project.name -ne "TODO") { $config.project.name } else { "project" }
75
- $taskDirName = "task-${timestamp}-$($projectName.ToLower().Replace(' ', '-'))"
76
- $taskDirPath = Join-Path $SDD_TASKS_DIR $taskDirName
77
-
78
- New-Item -ItemType Directory -Path $taskDirPath -Force | Out-Null
79
-
80
- # --- Copy templates ---
81
- Copy-Item "templates/task-master.template.md" "$taskDirPath/MASTER-TASKS.md"
82
- Copy-Item "templates/task-detail.template.md" "$taskDirPath/T-001-[task-name].md"
83
-
84
- # --- Update MASTER-TASKS.md with project info ---
85
- $masterContent = Get-Content "$taskDirPath/MASTER-TASKS.md" -Raw
86
- $masterContent = $masterContent -replace '\[Project Name\]', $projectName
87
- $masterContent = $masterContent -replace '\[DATE\]', (Get-Date -Format "yyyy-MM-dd")
88
- $masterContent = $masterContent -replace '\.\./SPEC\.md', "../SPEC.md"
89
- Set-Content "$taskDirPath/MASTER-TASKS.md" $masterContent -Encoding UTF8
90
-
91
- # --- Summary ---
92
- Write-Host ""
93
- Write-Host "========================================" -ForegroundColor Cyan
94
- Write-Host " Task Directory Created" -ForegroundColor Cyan
95
- Write-Host "========================================" -ForegroundColor Cyan
96
- Write-Host ""
97
- Write-Host "Location: $taskDirPath/" -ForegroundColor White
236
+ # Summary
98
237
  Write-Host ""
99
- Write-Host "Structure:" -ForegroundColor White
100
- Write-Host " sdd/tasks/$taskDirName/" -ForegroundColor Gray
101
- Write-Host " ├── MASTER-TASKS.md # Task index" -ForegroundColor Gray
102
- Write-Host " └── T-001-[task-name].md # Task template" -ForegroundColor Gray
238
+ Write-Host "[OK] Tasks generated: $total tasks" -ForegroundColor Green
103
239
  Write-Host ""
104
- Write-Host "Config updated: Phase 2 completed, Phase 3 in-progress." -ForegroundColor Green
240
+ Write-Host "Directory: $taskDir" -ForegroundColor White
105
241
  Write-Host ""
106
- Write-Host "Next steps:" -ForegroundColor White
107
- Write-Host " 1. Edit $taskDirName/MASTER-TASKS.md with task index" -ForegroundColor Gray
108
- Write-Host " 2. Create T-XXX-*.md files" -ForegroundColor Gray
109
- Write-Host " 3. Implement tasks using /sdd-cook --task T-XXX" -ForegroundColor Gray
110
- Write-Host " 4. Mark done with /sdd-task-status T-XXX done" -ForegroundColor Gray
111
-
112
- ---
113
-
114
- # Generate tasks by analyzing SPEC.md
115
- # Break SPEC.md into discrete tasks (T-001, T-002, ...)
116
- # Each task must:
117
- # - Take <= 2 hours
118
- # - Be independently verifiable
119
- # - Have output artifact specified
120
- # - Have frontmatter fields: depends_on, parallel_group, spec_sections
121
- # Follow templates/task-master.template.md and task-detail.template.md
242
+ Write-Host "Next: /sdd-cook --all" -ForegroundColor Cyan
@@ -0,0 +1,140 @@
1
+ # SDD Tasks Generator - Phase 3
2
+ # Standalone script for non-Claude Code usage
3
+ # Usage: powershell -File commands/sdd-tasks.ps1
4
+
5
+ $ErrorActionPreference = 'Stop'
6
+
7
+ Write-Host ""
8
+ Write-Host "=== SDD Tasks Generator - Phase 3 ===" -ForegroundColor Cyan
9
+
10
+ # Check SPEC
11
+ $specPath = "sdd/SPEC.md"
12
+ if (-not (Test-Path $specPath)) {
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
+ exit 1
17
+ }
18
+ Write-Host "[OK] Found: $specPath" -ForegroundColor Green
19
+
20
+ # Parse SPEC
21
+ $specContent = Get-Content $specPath -Raw -Encoding UTF8
22
+
23
+ # Extract project name
24
+ $projectName = "Project"
25
+ if ($specContent -match "^#\s+SPEC\.md\s*[-—]\s*(.+)$") {
26
+ $projectName = $Matches[1].Trim()
27
+ }
28
+
29
+ # Extract features
30
+ $features = @()
31
+ if ($specContent -match "(?s)### 4\.1\s+Core Features(.+?)(?=###|\Z)") {
32
+ $featuresSection = $Matches[1]
33
+ $featureMatches = [regex]::Matches($featuresSection, "(?s)####\s+\[([^\]]+)\](.+?)(?=####|\Z)")
34
+ foreach ($match in $featureMatches) {
35
+ $features += $match.Groups[1].Value.Trim()
36
+ }
37
+ }
38
+
39
+ # Extract test categories
40
+ $testCategories = @()
41
+ if ($specContent -match "(?s)### 9\.1\s+Test Categories(.+?)(?=###|\Z)") {
42
+ $testSection = $Matches[1]
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' }
47
+ }
48
+
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
52
+
53
+ # Create task directory
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
59
+
60
+ # Build task list
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
+ }
75
+
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
+ }
82
+
83
+ # Final task
84
+ $tasks += @{ Id = "T-00$phase"; Name = "Final Polish"; Phase = $phase; DependsOn = $prevId }
85
+
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"
95
+
96
+ Set-Content -Path "$taskDir/MASTER-TASKS.md" -Value $masterContent -Encoding UTF8
97
+ Write-Host " [CREATED] MASTER-TASKS.md" -ForegroundColor Gray
98
+
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 { "@()" }
104
+
105
+ $taskContent = @"
106
+ ---
107
+ name: $filename
108
+ description: "$($t.Name)"
109
+ phase: $($t.Phase)
110
+ estimate: 1h
111
+ spec_sections: ["4.1"]
112
+ depends_on: [$dependsOn]
113
+ ---
114
+
115
+ # $($t.Id): $($t.Name)
116
+
117
+ ## Files to Modify/Create
118
+ - [List files]
119
+
120
+ ## Implementation Steps
121
+ 1. [Step 1]
122
+ 2. [Step 2]
123
+ 3. [Step 3]
124
+
125
+ ## Verification
126
+ - [ ] Check 1
127
+ - [ ] Check 2
128
+ - [ ] Check 3
129
+ "@
130
+
131
+ Set-Content -Path "$taskDir/$filename" -Value $taskContent -Encoding UTF8
132
+ Write-Host " [CREATED] $filename" -ForegroundColor Gray
133
+ }
134
+
135
+ Write-Host ""
136
+ Write-Host "[OK] Tasks generated: $($tasks.Count) tasks" -ForegroundColor Green
137
+ Write-Host ""
138
+ Write-Host "Directory: $taskDir" -ForegroundColor White
139
+ Write-Host ""
140
+ Write-Host "Next: /sdd-cook --all" -ForegroundColor Cyan