specpulse 1.3.3__py3-none-any.whl → 1.4.0__py3-none-any.whl

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.
Files changed (29) hide show
  1. specpulse/__init__.py +1 -1
  2. specpulse/cli/main.py +32 -6
  3. specpulse/core/specpulse.py +24 -90
  4. specpulse/core/validator.py +38 -34
  5. specpulse/resources/commands/claude/sp-decompose.md +17 -17
  6. specpulse/resources/commands/claude/sp-plan.md +47 -47
  7. specpulse/resources/commands/claude/sp-pulse.md +10 -10
  8. specpulse/resources/commands/claude/sp-spec.md +15 -10
  9. specpulse/resources/commands/claude/sp-task.md +15 -15
  10. specpulse/resources/commands/gemini/sp-plan.toml +17 -17
  11. specpulse/resources/memory/constitution.md +237 -128
  12. specpulse/resources/scripts/sp-pulse-init.ps1 +131 -0
  13. specpulse/resources/scripts/sp-pulse-plan.ps1 +147 -0
  14. specpulse/resources/scripts/sp-pulse-plan.sh +131 -127
  15. specpulse/resources/scripts/sp-pulse-spec.ps1 +126 -0
  16. specpulse/resources/scripts/sp-pulse-task.ps1 +166 -0
  17. specpulse/resources/scripts/sp-pulse-task.sh +6 -6
  18. specpulse/resources/templates/decomposition/integration-plan.md +6 -5
  19. specpulse/resources/templates/decomposition/microservices.md +6 -5
  20. specpulse/resources/templates/decomposition/service-plan.md +6 -5
  21. specpulse/resources/templates/plan.md +229 -205
  22. specpulse/resources/templates/task.md +165 -165
  23. specpulse/utils/version_check.py +128 -0
  24. {specpulse-1.3.3.dist-info → specpulse-1.4.0.dist-info}/METADATA +70 -29
  25. {specpulse-1.3.3.dist-info → specpulse-1.4.0.dist-info}/RECORD +29 -24
  26. {specpulse-1.3.3.dist-info → specpulse-1.4.0.dist-info}/WHEEL +0 -0
  27. {specpulse-1.3.3.dist-info → specpulse-1.4.0.dist-info}/entry_points.txt +0 -0
  28. {specpulse-1.3.3.dist-info → specpulse-1.4.0.dist-info}/licenses/LICENSE +0 -0
  29. {specpulse-1.3.3.dist-info → specpulse-1.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,147 @@
1
+ # Generate implementation plan - PowerShell Version
2
+
3
+ param(
4
+ [Parameter(Mandatory=$true, Position=0)]
5
+ [string]$FeatureDir
6
+ )
7
+
8
+ # Configuration
9
+ $ScriptName = Split-Path -Leaf $PSCommandPath
10
+ $ScriptDir = Split-Path -Parent $PSCommandPath
11
+ $ProjectRoot = Split-Path -Parent $ScriptDir
12
+
13
+ # Logging function
14
+ function Log-Message {
15
+ param([string]$Message)
16
+ $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
17
+ Write-Host "[$timestamp] ${ScriptName}: $Message" -ForegroundColor Cyan
18
+ }
19
+
20
+ # Error handling function
21
+ function Exit-WithError {
22
+ param([string]$Message)
23
+ Write-Host "ERROR: $Message" -ForegroundColor Red
24
+ exit 1
25
+ }
26
+
27
+ # Extract feature ID
28
+ $FeatureId = if ($FeatureDir -match '^(\d{3})') { $Matches[1] } else { "001" }
29
+
30
+ # Sanitize feature directory
31
+ $SanitizedDir = $FeatureDir -replace '[^a-zA-Z0-9_-]', ''
32
+
33
+ if ([string]::IsNullOrEmpty($SanitizedDir)) {
34
+ Exit-WithError "Invalid feature directory: '$FeatureDir'"
35
+ }
36
+
37
+ $PlanDir = Join-Path $ProjectRoot "plans\$FeatureDir"
38
+ $SpecDir = Join-Path $ProjectRoot "specs\$FeatureDir"
39
+ $TemplateFile = Join-Path $ProjectRoot "templates\plan.md"
40
+
41
+ # Ensure plans directory exists
42
+ if (-not (Test-Path $PlanDir)) {
43
+ New-Item -ItemType Directory -Path $PlanDir -Force | Out-Null
44
+ }
45
+
46
+ # Find latest spec file
47
+ if (Test-Path $SpecDir) {
48
+ $SpecFile = Get-ChildItem -Path $SpecDir -Filter "spec-*.md" -ErrorAction SilentlyContinue |
49
+ Sort-Object LastWriteTime -Descending |
50
+ Select-Object -First 1
51
+
52
+ if (-not $SpecFile) {
53
+ Exit-WithError "No specification files found in $SpecDir. Please create specification first."
54
+ }
55
+ $SpecFile = $SpecFile.FullName
56
+ } else {
57
+ Exit-WithError "Specifications directory not found: $SpecDir. Please create specification first."
58
+ }
59
+
60
+ # Find next available plan number or create new one
61
+ $existingPlans = Get-ChildItem -Path $PlanDir -Filter "plan-*.md" -ErrorAction SilentlyContinue
62
+ $planNumber = if ($existingPlans) { $existingPlans.Count + 1 } else { 1 }
63
+ $PlanFile = Join-Path $PlanDir ("plan-{0:D3}.md" -f $planNumber)
64
+
65
+ # Ensure plan template exists
66
+ if (-not (Test-Path $TemplateFile)) {
67
+ Exit-WithError "Template not found: $TemplateFile"
68
+ }
69
+
70
+ # Create plan
71
+ Log-Message "Creating implementation plan from template: $PlanFile"
72
+ try {
73
+ Copy-Item -Path $TemplateFile -Destination $PlanFile -Force
74
+ } catch {
75
+ Exit-WithError "Failed to copy plan template: $_"
76
+ }
77
+
78
+ # Validate plan structure
79
+ Log-Message "Validating implementation plan..."
80
+
81
+ # Check for required sections
82
+ $RequiredSections = @(
83
+ "## Implementation Plan:",
84
+ "## Specification Reference",
85
+ "## Phase -1: Pre-Implementation Gates",
86
+ "## Implementation Phases"
87
+ )
88
+
89
+ $content = Get-Content -Path $PlanFile -Raw
90
+ $MissingSections = @()
91
+
92
+ foreach ($section in $RequiredSections) {
93
+ if ($content -notmatch [regex]::Escape($section)) {
94
+ $MissingSections += $section
95
+ }
96
+ }
97
+
98
+ if ($MissingSections.Count -gt 0) {
99
+ Log-Message "WARNING: Missing required sections: $($MissingSections -join ', ')"
100
+ }
101
+
102
+ # Check SDD Gates
103
+ Log-Message "Checking SDD Gates..."
104
+
105
+ $SDDGates = @(
106
+ "Specification First",
107
+ "Incremental Planning",
108
+ "Task Decomposition",
109
+ "Traceable Implementation",
110
+ "Continuous Validation",
111
+ "Quality Assurance",
112
+ "Architecture Documentation",
113
+ "Iterative Refinement",
114
+ "Stakeholder Alignment"
115
+ )
116
+
117
+ foreach ($gate in $SDDGates) {
118
+ if ($content -notmatch [regex]::Escape($gate)) {
119
+ Log-Message "WARNING: Missing SDD gate: $gate"
120
+ }
121
+ }
122
+
123
+ # Check if specification has clarifications needed
124
+ $specContent = Get-Content -Path $SpecFile -Raw
125
+ if ($specContent -match "NEEDS CLARIFICATION") {
126
+ $ClarificationCount = ([regex]::Matches($specContent, "NEEDS CLARIFICATION")).Count
127
+ Log-Message "WARNING: Specification has $ClarificationCount clarifications needed - resolve before proceeding"
128
+ }
129
+
130
+ # Validate gate compliance
131
+ $GateStatus = "PENDING"
132
+ if ($content -match "Gate Status:.*\[(.*?)\]") {
133
+ $GateStatus = $Matches[1]
134
+ }
135
+
136
+ if ($GateStatus -ne "COMPLETED") {
137
+ Log-Message "WARNING: SDD gates not completed. Status: $GateStatus"
138
+ }
139
+
140
+ Log-Message "Implementation plan processing completed successfully"
141
+
142
+ # Output results
143
+ Write-Output "PLAN_FILE=$PlanFile"
144
+ Write-Output "SPEC_FILE=$SpecFile"
145
+ Write-Output "MISSING_SECTIONS=$($MissingSections.Count)"
146
+ Write-Output "SDD_GATES_STATUS=$GateStatus"
147
+ Write-Output "STATUS=ready"
@@ -1,128 +1,132 @@
1
- #!/bin/bash
2
- # Generate implementation plan
3
-
4
- set -euo pipefail # Exit on error, unset vars, pipe failures
5
-
6
- # Configuration
7
- SCRIPT_NAME="$(basename "$0")"
8
- # Script is in project-root/scripts/, so parent dir is project root
9
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
- PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
11
-
12
- # Function to log messages
13
- log() {
14
- echo "[$(date '+%Y-%m-%d %H:%M:%S')] $SCRIPT_NAME: $1" >&2
15
- }
16
-
17
- # Function to handle errors
18
- error_exit() {
19
- log "ERROR: $1"
20
- exit 1
21
- }
22
-
23
- # Validate arguments
24
- if [ $# -eq 0 ]; then
25
- error_exit "Usage: $SCRIPT_NAME <feature-dir>"
26
- fi
27
-
28
- FEATURE_DIR="$1"
29
-
30
- # Extract feature ID from directory name (e.g., "001-feature-name" -> "001")
31
- FEATURE_ID=$(echo "$FEATURE_DIR" | grep -o '^[0-9]\{3\}' || echo "001")
32
-
33
- # Sanitize feature directory
34
- SANITIZED_DIR=$(echo "$FEATURE_DIR" | sed 's/[^a-zA-Z0-9_-]//g')
35
-
36
- if [ -z "$SANITIZED_DIR" ]; then
37
- error_exit "Invalid feature directory: '$FEATURE_DIR'"
38
- fi
39
-
40
- PLAN_DIR="$PROJECT_ROOT/plans/${FEATURE_DIR}"
41
- SPEC_DIR="$PROJECT_ROOT/specs/${FEATURE_DIR}"
42
- TEMPLATE_FILE="$PROJECT_ROOT/templates/plan.md"
43
-
44
- # Ensure plans directory exists
45
- mkdir -p "$PLAN_DIR"
46
-
47
- # Find latest spec file
48
- if [ -d "$SPEC_DIR" ]; then
49
- SPEC_FILE=$(find "$SPEC_DIR" -name "spec-*.md" -printf "%T@ %p\n" | sort -n | tail -1 | cut -d' ' -f2-)
50
- if [ -z "$SPEC_FILE" ]; then
51
- error_exit "No specification files found in $SPEC_DIR. Please create specification first."
52
- fi
53
- else
54
- error_exit "Specifications directory not found: $SPEC_DIR. Please create specification first."
55
- fi
56
-
57
- # Find next available plan number or create new one
58
- if [ -d "$PLAN_DIR" ]; then
59
- existing_plans=$(find "$PLAN_DIR" -name "plan-*.md" | wc -l)
60
- plan_number=$((existing_plans + 1))
61
- else
62
- plan_number=1
63
- fi
64
- PLAN_FILE="$PLAN_DIR/plan-$(printf "%03d" $plan_number).md"
65
-
66
- # Ensure plan template exists
67
- if [ ! -f "$TEMPLATE_FILE" ]; then
68
- error_exit "Template not found: $TEMPLATE_FILE"
69
- fi
70
-
71
- # Create plan
72
- log "Creating implementation plan from template: $PLAN_FILE"
73
- cp "$TEMPLATE_FILE" "$PLAN_FILE" || error_exit "Failed to copy plan template"
74
-
75
- # Validate plan structure
76
- log "Validating implementation plan..."
77
-
78
- # Check for required sections
79
- REQUIRED_SECTIONS=("## Implementation Plan:" "## Specification Reference" "## Phase -1: Pre-Implementation Gates" "## Implementation Phases")
80
- MISSING_SECTIONS=()
81
-
82
- for section in "${REQUIRED_SECTIONS[@]}"; do
83
- if ! grep -q "$section" "$PLAN_FILE"; then
84
- MISSING_SECTIONS+=("$section")
85
- fi
86
- done
87
-
88
- if [ ${#MISSING_SECTIONS[@]} -gt 0 ]; then
89
- log "WARNING: Missing required sections: ${MISSING_SECTIONS[*]}"
90
- fi
91
-
92
- # Check Constitutional Gates
93
- log "Checking Constitutional Gates..."
94
-
95
- CONSTITUTIONAL_GATES=(
96
- "Simplicity Gate"
97
- "Anti-Abstraction Gate"
98
- "Test-First Gate"
99
- "Integration-First Gate"
100
- "Research Gate"
101
- )
102
-
103
- for gate in "${CONSTITUTIONAL_GATES[@]}"; do
104
- if ! grep -q "$gate" "$PLAN_FILE"; then
105
- log "WARNING: Missing constitutional gate: $gate"
106
- fi
107
- done
108
-
109
- # Check if specification has clarifications needed
110
- if grep -q "NEEDS CLARIFICATION" "$SPEC_FILE"; then
111
- CLARIFICATION_COUNT=$(grep -c "NEEDS CLARIFICATION" "$SPEC_FILE")
112
- log "WARNING: Specification has $CLARIFICATION_COUNT clarifications needed - resolve before proceeding"
113
- fi
114
-
115
- # Validate gate compliance
116
- GATE_STATUS=$(grep -A5 "Gate Status:" "$PLAN_FILE" | tail -1 | sed 's/.*\[\(.*\)\].*/\1/' || echo "PENDING")
117
-
118
- if [ "$GATE_STATUS" != "COMPLETED" ]; then
119
- log "WARNING: Constitutional gates not completed. Status: $GATE_STATUS"
120
- fi
121
-
122
- log "Implementation plan processing completed successfully"
123
-
124
- echo "PLAN_FILE=$PLAN_FILE"
125
- echo "SPEC_FILE=$SPEC_FILE"
126
- echo "MISSING_SECTIONS=${#MISSING_SECTIONS[@]}"
127
- echo "CONSTITUTIONAL_GATES_STATUS=$GATE_STATUS"
1
+ #!/bin/bash
2
+ # Generate implementation plan
3
+
4
+ set -euo pipefail # Exit on error, unset vars, pipe failures
5
+
6
+ # Configuration
7
+ SCRIPT_NAME="$(basename "$0")"
8
+ # Script is in project-root/scripts/, so parent dir is project root
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
11
+
12
+ # Function to log messages
13
+ log() {
14
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $SCRIPT_NAME: $1" >&2
15
+ }
16
+
17
+ # Function to handle errors
18
+ error_exit() {
19
+ log "ERROR: $1"
20
+ exit 1
21
+ }
22
+
23
+ # Validate arguments
24
+ if [ $# -eq 0 ]; then
25
+ error_exit "Usage: $SCRIPT_NAME <feature-dir>"
26
+ fi
27
+
28
+ FEATURE_DIR="$1"
29
+
30
+ # Extract feature ID from directory name (e.g., "001-feature-name" -> "001")
31
+ FEATURE_ID=$(echo "$FEATURE_DIR" | grep -o '^[0-9]\{3\}' || echo "001")
32
+
33
+ # Sanitize feature directory
34
+ SANITIZED_DIR=$(echo "$FEATURE_DIR" | sed 's/[^a-zA-Z0-9_-]//g')
35
+
36
+ if [ -z "$SANITIZED_DIR" ]; then
37
+ error_exit "Invalid feature directory: '$FEATURE_DIR'"
38
+ fi
39
+
40
+ PLAN_DIR="$PROJECT_ROOT/plans/${FEATURE_DIR}"
41
+ SPEC_DIR="$PROJECT_ROOT/specs/${FEATURE_DIR}"
42
+ TEMPLATE_FILE="$PROJECT_ROOT/templates/plan.md"
43
+
44
+ # Ensure plans directory exists
45
+ mkdir -p "$PLAN_DIR"
46
+
47
+ # Find latest spec file
48
+ if [ -d "$SPEC_DIR" ]; then
49
+ SPEC_FILE=$(find "$SPEC_DIR" -name "spec-*.md" -printf "%T@ %p\n" | sort -n | tail -1 | cut -d' ' -f2-)
50
+ if [ -z "$SPEC_FILE" ]; then
51
+ error_exit "No specification files found in $SPEC_DIR. Please create specification first."
52
+ fi
53
+ else
54
+ error_exit "Specifications directory not found: $SPEC_DIR. Please create specification first."
55
+ fi
56
+
57
+ # Find next available plan number or create new one
58
+ if [ -d "$PLAN_DIR" ]; then
59
+ existing_plans=$(find "$PLAN_DIR" -name "plan-*.md" | wc -l)
60
+ plan_number=$((existing_plans + 1))
61
+ else
62
+ plan_number=1
63
+ fi
64
+ PLAN_FILE="$PLAN_DIR/plan-$(printf "%03d" $plan_number).md"
65
+
66
+ # Ensure plan template exists
67
+ if [ ! -f "$TEMPLATE_FILE" ]; then
68
+ error_exit "Template not found: $TEMPLATE_FILE"
69
+ fi
70
+
71
+ # Create plan
72
+ log "Creating implementation plan from template: $PLAN_FILE"
73
+ cp "$TEMPLATE_FILE" "$PLAN_FILE" || error_exit "Failed to copy plan template"
74
+
75
+ # Validate plan structure
76
+ log "Validating implementation plan..."
77
+
78
+ # Check for required sections
79
+ REQUIRED_SECTIONS=("## Implementation Plan:" "## Specification Reference" "## Phase -1: Pre-Implementation Gates" "## Implementation Phases")
80
+ MISSING_SECTIONS=()
81
+
82
+ for section in "${REQUIRED_SECTIONS[@]}"; do
83
+ if ! grep -q "$section" "$PLAN_FILE"; then
84
+ MISSING_SECTIONS+=("$section")
85
+ fi
86
+ done
87
+
88
+ if [ ${#MISSING_SECTIONS[@]} -gt 0 ]; then
89
+ log "WARNING: Missing required sections: ${MISSING_SECTIONS[*]}"
90
+ fi
91
+
92
+ # Check SDD Gates
93
+ log "Checking SDD Gates..."
94
+
95
+ SDD_GATES=(
96
+ "Specification First"
97
+ "Incremental Planning"
98
+ "Task Decomposition"
99
+ "Traceable Implementation"
100
+ "Continuous Validation"
101
+ "Quality Assurance"
102
+ "Architecture Documentation"
103
+ "Iterative Refinement"
104
+ "Stakeholder Alignment"
105
+ )
106
+
107
+ for gate in "${SDD_GATES[@]}"; do
108
+ if ! grep -q "$gate" "$PLAN_FILE"; then
109
+ log "WARNING: Missing SDD gate: $gate"
110
+ fi
111
+ done
112
+
113
+ # Check if specification has clarifications needed
114
+ if grep -q "NEEDS CLARIFICATION" "$SPEC_FILE"; then
115
+ CLARIFICATION_COUNT=$(grep -c "NEEDS CLARIFICATION" "$SPEC_FILE")
116
+ log "WARNING: Specification has $CLARIFICATION_COUNT clarifications needed - resolve before proceeding"
117
+ fi
118
+
119
+ # Validate gate compliance
120
+ GATE_STATUS=$(grep -A5 "Gate Status:" "$PLAN_FILE" | tail -1 | sed 's/.*\[\(.*\)\].*/\1/' || echo "PENDING")
121
+
122
+ if [ "$GATE_STATUS" != "COMPLETED" ]; then
123
+ log "WARNING: SDD gates not completed. Status: $GATE_STATUS"
124
+ fi
125
+
126
+ log "Implementation plan processing completed successfully"
127
+
128
+ echo "PLAN_FILE=$PLAN_FILE"
129
+ echo "SPEC_FILE=$SPEC_FILE"
130
+ echo "MISSING_SECTIONS=${#MISSING_SECTIONS[@]}"
131
+ echo "SDD_GATES_STATUS=$GATE_STATUS"
128
132
  echo "STATUS=ready"
@@ -0,0 +1,126 @@
1
+ # Generate or update specification - PowerShell Version
2
+
3
+ param(
4
+ [Parameter(Mandatory=$true, Position=0)]
5
+ [string]$FeatureDir,
6
+
7
+ [Parameter(Mandatory=$false, Position=1)]
8
+ [string]$SpecContent
9
+ )
10
+
11
+ # Configuration
12
+ $ScriptName = Split-Path -Leaf $PSCommandPath
13
+ $ScriptDir = Split-Path -Parent $PSCommandPath
14
+ $ProjectRoot = Split-Path -Parent $ScriptDir
15
+
16
+ # Logging function
17
+ function Log-Message {
18
+ param([string]$Message)
19
+ $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
20
+ Write-Host "[$timestamp] ${ScriptName}: $Message" -ForegroundColor Cyan
21
+ }
22
+
23
+ # Error handling function
24
+ function Exit-WithError {
25
+ param([string]$Message)
26
+ Write-Host "ERROR: $Message" -ForegroundColor Red
27
+ exit 1
28
+ }
29
+
30
+ # Extract feature ID from directory name
31
+ $FeatureId = if ($FeatureDir -match '^(\d{3})') { $Matches[1] } else { "001" }
32
+
33
+ # Sanitize feature directory
34
+ $SanitizedDir = $FeatureDir -replace '[^a-zA-Z0-9_-]', ''
35
+
36
+ if ([string]::IsNullOrEmpty($SanitizedDir)) {
37
+ Exit-WithError "Invalid feature directory: '$FeatureDir'"
38
+ }
39
+
40
+ $SpecDir = Join-Path $ProjectRoot "specs\$FeatureDir"
41
+ $TemplateFile = Join-Path $ProjectRoot "templates\spec.md"
42
+
43
+ # Ensure specs directory exists
44
+ if (-not (Test-Path $SpecDir)) {
45
+ New-Item -ItemType Directory -Path $SpecDir -Force | Out-Null
46
+ }
47
+
48
+ # Find latest spec file or create new one
49
+ if ($SpecContent) {
50
+ # Find next available spec number
51
+ $existingSpecs = Get-ChildItem -Path $SpecDir -Filter "spec-*.md" -ErrorAction SilentlyContinue
52
+ $specNumber = if ($existingSpecs) { $existingSpecs.Count + 1 } else { 1 }
53
+ $SpecFile = Join-Path $SpecDir ("spec-{0:D3}.md" -f $specNumber)
54
+
55
+ # Update specification with provided content
56
+ Log-Message "Creating specification: $SpecFile"
57
+ try {
58
+ Set-Content -Path $SpecFile -Value $SpecContent
59
+ } catch {
60
+ Exit-WithError "Failed to write specification content: $_"
61
+ }
62
+ } else {
63
+ # Find latest spec file
64
+ $latestSpec = Get-ChildItem -Path $SpecDir -Filter "spec-*.md" -ErrorAction SilentlyContinue |
65
+ Sort-Object LastWriteTime -Descending |
66
+ Select-Object -First 1
67
+
68
+ if ($latestSpec) {
69
+ $SpecFile = $latestSpec.FullName
70
+ Log-Message "Using latest specification: $SpecFile"
71
+ } else {
72
+ # No spec files found, create first one
73
+ $SpecFile = Join-Path $SpecDir "spec-001.md"
74
+ if (-not (Test-Path $TemplateFile)) {
75
+ Exit-WithError "Template not found: $TemplateFile"
76
+ }
77
+ Log-Message "Creating specification from template: $SpecFile"
78
+ try {
79
+ Copy-Item -Path $TemplateFile -Destination $SpecFile -Force
80
+ } catch {
81
+ Exit-WithError "Failed to copy specification template: $_"
82
+ }
83
+ }
84
+ }
85
+
86
+ # Validate specification
87
+ Log-Message "Validating specification..."
88
+ if (-not (Test-Path $SpecFile)) {
89
+ Exit-WithError "Specification file does not exist: $SpecFile"
90
+ }
91
+
92
+ # Check for required sections
93
+ $RequiredSections = @(
94
+ "## Specification:",
95
+ "## Metadata",
96
+ "## Functional Requirements",
97
+ "## Acceptance Scenarios"
98
+ )
99
+
100
+ $content = Get-Content -Path $SpecFile -Raw
101
+ $MissingSections = @()
102
+
103
+ foreach ($section in $RequiredSections) {
104
+ if ($content -notmatch [regex]::Escape($section)) {
105
+ $MissingSections += $section
106
+ }
107
+ }
108
+
109
+ if ($MissingSections.Count -gt 0) {
110
+ Log-Message "WARNING: Missing required sections: $($MissingSections -join ', ')"
111
+ }
112
+
113
+ # Check for clarifications needed
114
+ $ClarificationCount = 0
115
+ if ($content -match "NEEDS CLARIFICATION") {
116
+ $ClarificationCount = ([regex]::Matches($content, "NEEDS CLARIFICATION")).Count
117
+ Log-Message "WARNING: Specification has $ClarificationCount clarifications needed"
118
+ }
119
+
120
+ Log-Message "Specification processing completed successfully"
121
+
122
+ # Output results
123
+ Write-Output "SPEC_FILE=$SpecFile"
124
+ Write-Output "CLARIFICATIONS_NEEDED=$ClarificationCount"
125
+ Write-Output "MISSING_SECTIONS=$($MissingSections.Count)"
126
+ Write-Output "STATUS=updated"