specpulse 1.3.4__py3-none-any.whl → 1.4.1__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.
- specpulse/__init__.py +1 -1
- specpulse/core/specpulse.py +22 -88
- specpulse/core/validator.py +38 -34
- specpulse/resources/commands/claude/sp-decompose.md +17 -17
- specpulse/resources/commands/claude/sp-plan.md +47 -47
- specpulse/resources/commands/claude/sp-pulse.md +10 -10
- specpulse/resources/commands/claude/sp-spec.md +15 -10
- specpulse/resources/commands/claude/sp-task.md +15 -15
- specpulse/resources/commands/gemini/sp-plan.toml +17 -17
- specpulse/resources/memory/constitution.md +237 -128
- specpulse/resources/scripts/sp-pulse-plan.ps1 +146 -142
- specpulse/resources/scripts/sp-pulse-plan.sh +131 -127
- specpulse/resources/scripts/sp-pulse-task.ps1 +165 -165
- specpulse/resources/scripts/sp-pulse-task.sh +6 -6
- specpulse/resources/templates/decomposition/integration-plan.md +6 -5
- specpulse/resources/templates/decomposition/microservices.md +6 -5
- specpulse/resources/templates/decomposition/service-plan.md +6 -5
- specpulse/resources/templates/plan.md +229 -205
- specpulse/resources/templates/task.md +165 -165
- {specpulse-1.3.4.dist-info → specpulse-1.4.1.dist-info}/METADATA +72 -30
- {specpulse-1.3.4.dist-info → specpulse-1.4.1.dist-info}/RECORD +25 -25
- {specpulse-1.3.4.dist-info → specpulse-1.4.1.dist-info}/WHEEL +0 -0
- {specpulse-1.3.4.dist-info → specpulse-1.4.1.dist-info}/entry_points.txt +0 -0
- {specpulse-1.3.4.dist-info → specpulse-1.4.1.dist-info}/licenses/LICENSE +0 -0
- {specpulse-1.3.4.dist-info → specpulse-1.4.1.dist-info}/top_level.txt +0 -0
@@ -1,143 +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
|
103
|
-
Log-Message "Checking
|
104
|
-
|
105
|
-
$
|
106
|
-
"
|
107
|
-
"
|
108
|
-
"
|
109
|
-
"
|
110
|
-
"
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
$
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
if ($
|
133
|
-
|
134
|
-
}
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
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"
|
143
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
|
93
|
-
log "Checking
|
94
|
-
|
95
|
-
|
96
|
-
"
|
97
|
-
"
|
98
|
-
"
|
99
|
-
"
|
100
|
-
"
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
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"
|