specpulse 1.0.6__py3-none-any.whl → 1.2.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.
- specpulse/__init__.py +1 -1
- specpulse/cli/main.py +809 -617
- specpulse/core/specpulse.py +1140 -1105
- specpulse/resources/commands/claude/sp-continue.md +203 -0
- specpulse/resources/commands/claude/sp-decompose.md +227 -0
- specpulse/resources/commands/claude/sp-plan.md +220 -0
- specpulse/resources/commands/claude/sp-pulse.md +142 -0
- specpulse/resources/commands/claude/{spec.md → sp-spec.md} +36 -23
- specpulse/resources/commands/claude/sp-status.md +170 -0
- specpulse/resources/commands/claude/sp-task.md +315 -0
- specpulse/resources/commands/gemini/sp-continue.toml +56 -0
- specpulse/resources/commands/gemini/sp-decompose.toml +54 -0
- specpulse/resources/commands/gemini/sp-plan.toml +68 -0
- specpulse/resources/commands/gemini/{pulse.toml → sp-pulse.toml} +12 -6
- specpulse/resources/commands/gemini/sp-spec.toml +54 -0
- specpulse/resources/commands/gemini/sp-status.toml +61 -0
- specpulse/resources/commands/gemini/sp-task.toml +79 -0
- specpulse/resources/memory/constitution.md +5 -5
- specpulse/resources/memory/context.md +53 -1
- specpulse/resources/scripts/sp-pulse-decompose.py +66 -0
- specpulse/resources/scripts/sp-pulse-decompose.sh +56 -0
- specpulse/resources/scripts/{pulse-init.py → sp-pulse-init.py} +6 -6
- specpulse/resources/scripts/{pulse-init.sh → sp-pulse-init.sh} +95 -95
- specpulse/resources/scripts/{pulse-plan.py → sp-pulse-plan.py} +32 -7
- specpulse/resources/scripts/{pulse-plan.sh → sp-pulse-plan.sh} +136 -126
- specpulse/resources/scripts/{pulse-spec.py → sp-pulse-spec.py} +26 -6
- specpulse/resources/scripts/{pulse-spec.sh → sp-pulse-spec.sh} +126 -103
- specpulse/resources/scripts/{pulse-task.py → sp-pulse-task.py} +42 -6
- specpulse/resources/scripts/{pulse-task.sh → sp-pulse-task.sh} +32 -16
- specpulse/resources/templates/decomposition/api-contract.yaml +22 -0
- specpulse/resources/templates/decomposition/integration-plan.md +134 -0
- specpulse/resources/templates/decomposition/interface.ts +20 -0
- specpulse/resources/templates/decomposition/microservices.md +34 -0
- specpulse/resources/templates/decomposition/service-plan.md +168 -0
- specpulse/resources/templates/plan.md +206 -206
- specpulse/resources/templates/spec.md +125 -125
- specpulse/resources/templates/task.md +164 -163
- {specpulse-1.0.6.dist-info → specpulse-1.2.0.dist-info}/METADATA +95 -36
- specpulse-1.2.0.dist-info/RECORD +50 -0
- specpulse/resources/commands/claude/plan.md +0 -184
- specpulse/resources/commands/claude/pulse.md +0 -91
- specpulse/resources/commands/claude/task.md +0 -237
- specpulse/resources/commands/gemini/plan.toml +0 -59
- specpulse/resources/commands/gemini/spec.toml +0 -45
- specpulse/resources/commands/gemini/task.toml +0 -69
- specpulse/resources/scripts/pulse-init.ps1 +0 -186
- specpulse/resources/scripts/pulse-plan.ps1 +0 -251
- specpulse/resources/scripts/pulse-spec.ps1 +0 -185
- specpulse/resources/scripts/pulse-task.ps1 +0 -263
- specpulse-1.0.6.dist-info/RECORD +0 -41
- {specpulse-1.0.6.dist-info → specpulse-1.2.0.dist-info}/WHEEL +0 -0
- {specpulse-1.0.6.dist-info → specpulse-1.2.0.dist-info}/entry_points.txt +0 -0
- {specpulse-1.0.6.dist-info → specpulse-1.2.0.dist-info}/licenses/LICENSE +0 -0
- {specpulse-1.0.6.dist-info → specpulse-1.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,203 @@
|
|
1
|
+
---
|
2
|
+
name: sp-continue
|
3
|
+
description: Switch context and continue work on a specific feature
|
4
|
+
allowed_tools:
|
5
|
+
- Read
|
6
|
+
- Write
|
7
|
+
- Edit
|
8
|
+
- Bash
|
9
|
+
- TodoWrite
|
10
|
+
---
|
11
|
+
|
12
|
+
# /sp-continue Command
|
13
|
+
|
14
|
+
Switch context to a specific feature and continue work from where you left off.
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
```
|
18
|
+
/sp-continue <feature-name|feature-id>
|
19
|
+
```
|
20
|
+
|
21
|
+
## Implementation
|
22
|
+
|
23
|
+
When called with `/sp-continue $ARGUMENTS`, I will:
|
24
|
+
|
25
|
+
1. **Parse arguments** to extract feature name or ID
|
26
|
+
2. **Find feature directory** using context detection:
|
27
|
+
- Search for matching feature directory (specs/*, plans/*, tasks/*)
|
28
|
+
- Support partial matching (e.g., "auth" matches "001-user-authentication")
|
29
|
+
- Support ID matching (e.g., "001" matches "001-user-authentication")
|
30
|
+
|
31
|
+
3. **Validate feature exists**:
|
32
|
+
- Check if feature directory has any files
|
33
|
+
- Verify feature structure is intact
|
34
|
+
- Report if feature not found
|
35
|
+
|
36
|
+
4. **Update context** in `memory/context.md`:
|
37
|
+
```yaml
|
38
|
+
# Feature Context
|
39
|
+
|
40
|
+
## Current Feature
|
41
|
+
- **ID**: 001
|
42
|
+
- **Name**: user-authentication
|
43
|
+
- **Branch**: 001-user-authentication
|
44
|
+
- **Status**: active
|
45
|
+
- **Created**: 2025-01-09
|
46
|
+
- **Last Updated**: 2025-01-09
|
47
|
+
- **Switched To**: 2025-01-09 (via /continue)
|
48
|
+
```
|
49
|
+
|
50
|
+
5. **Switch git branch** if in git repository:
|
51
|
+
- Checkout feature branch if it exists
|
52
|
+
- Report if branch doesn't exist
|
53
|
+
- Handle branch switching errors gracefully
|
54
|
+
|
55
|
+
6. **Display feature status**:
|
56
|
+
- Show current progress percentage
|
57
|
+
- List next available actions
|
58
|
+
- Highlight any blockers or issues
|
59
|
+
- Show recent activity
|
60
|
+
|
61
|
+
7. **Suggest next steps** based on feature state:
|
62
|
+
- If no spec files: `/spec <description>`
|
63
|
+
- If spec but no plan: `/plan`
|
64
|
+
- If plan but no tasks: `/task`
|
65
|
+
- If tasks exist: Show task completion status and suggest next task
|
66
|
+
|
67
|
+
## Feature Detection Logic
|
68
|
+
|
69
|
+
The command supports multiple ways to identify features:
|
70
|
+
|
71
|
+
### By Name
|
72
|
+
```
|
73
|
+
/sp-continue user-authentication
|
74
|
+
/sp-continue "user authentication"
|
75
|
+
/sp-continue auth
|
76
|
+
```
|
77
|
+
|
78
|
+
### By ID
|
79
|
+
```
|
80
|
+
/sp-continue 001
|
81
|
+
/sp-continue 002
|
82
|
+
```
|
83
|
+
|
84
|
+
### By Partial Match
|
85
|
+
```
|
86
|
+
/sp-continue user # Matches any feature with "user" in name
|
87
|
+
/sp-continue pay # Matches "payment-processing"
|
88
|
+
```
|
89
|
+
|
90
|
+
## Context Switching
|
91
|
+
|
92
|
+
When switching features, the system:
|
93
|
+
|
94
|
+
1. **Saves previous context**:
|
95
|
+
- Stores previous feature state
|
96
|
+
- Notes switch reason and timestamp
|
97
|
+
- Preserves all progress tracking data
|
98
|
+
|
99
|
+
2. **Loads new context**:
|
100
|
+
- Updates `memory/context.md` with new feature
|
101
|
+
- Loads feature metadata
|
102
|
+
- Calculates current progress
|
103
|
+
|
104
|
+
3. **Environment setup**:
|
105
|
+
- Switches git branch if available
|
106
|
+
- Updates working directory context
|
107
|
+
- Prepares for continued development
|
108
|
+
|
109
|
+
## Examples
|
110
|
+
|
111
|
+
### Basic feature switch
|
112
|
+
```
|
113
|
+
User: /sp-continue user-authentication
|
114
|
+
```
|
115
|
+
|
116
|
+
I will:
|
117
|
+
- Find feature: `001-user-authentication`
|
118
|
+
- Update context: Switch from current feature to `001-user-authentication`
|
119
|
+
- Switch git branch: `git checkout 001-user-authentication`
|
120
|
+
- Display status:
|
121
|
+
```
|
122
|
+
## Switched to Feature: 001-user-authentication
|
123
|
+
|
124
|
+
**Progress**: 65% complete
|
125
|
+
**Status**: Active
|
126
|
+
**Last Worked**: 2025-01-09
|
127
|
+
|
128
|
+
### Next Steps
|
129
|
+
- 16 tasks completed, 9 remaining
|
130
|
+
- 1 blocker: T015 (Database schema approval)
|
131
|
+
- Suggested action: /sp-status user-authentication for details
|
132
|
+
```
|
133
|
+
|
134
|
+
### Continue with ID
|
135
|
+
```
|
136
|
+
User: /sp-continue 002
|
137
|
+
```
|
138
|
+
|
139
|
+
I will:
|
140
|
+
- Find feature: `002-payment-processing`
|
141
|
+
- Switch context and display feature status
|
142
|
+
|
143
|
+
### Feature not found
|
144
|
+
```
|
145
|
+
User: /sp-continue non-existent-feature
|
146
|
+
```
|
147
|
+
|
148
|
+
I will:
|
149
|
+
- Search for matching features
|
150
|
+
- Show available features:
|
151
|
+
```
|
152
|
+
Feature "non-existent-feature" not found.
|
153
|
+
|
154
|
+
Available features:
|
155
|
+
- 001-user-authentication (65%)
|
156
|
+
- 002-payment-processing (23%)
|
157
|
+
- 003-user-profile (45%)
|
158
|
+
|
159
|
+
Use /sp-status to see all features.
|
160
|
+
```
|
161
|
+
|
162
|
+
## Integration Features
|
163
|
+
|
164
|
+
- **Intelligent feature matching** with partial name and ID support
|
165
|
+
- **Context preservation** when switching between features
|
166
|
+
- **Git integration** with automatic branch switching
|
167
|
+
- **Progress tracking** across feature switches
|
168
|
+
- **Smart suggestions** for next actions based on feature state
|
169
|
+
- **Error recovery** with helpful fallback options
|
170
|
+
- **Cross-platform compatibility** for any development environment
|
171
|
+
|
172
|
+
## Error Handling
|
173
|
+
|
174
|
+
- Feature not found with suggestions
|
175
|
+
- Git branch switching errors
|
176
|
+
- Context file permission issues
|
177
|
+
- Directory structure validation
|
178
|
+
- Progress calculation errors
|
179
|
+
- Working directory validation
|
180
|
+
|
181
|
+
## Multi-Feature Workflow
|
182
|
+
|
183
|
+
The `/continue` command enables efficient multi-feature development:
|
184
|
+
|
185
|
+
```
|
186
|
+
# Start new feature
|
187
|
+
/sp-pulse new-feature
|
188
|
+
/sp-spec "feature description"
|
189
|
+
/sp-plan
|
190
|
+
/sp-task
|
191
|
+
|
192
|
+
# Switch to existing feature
|
193
|
+
/sp-continue user-authentication
|
194
|
+
|
195
|
+
# Check status and continue work
|
196
|
+
/sp-status user-authentication
|
197
|
+
# ... complete some tasks ...
|
198
|
+
|
199
|
+
# Switch back to new feature
|
200
|
+
/sp-continue new-feature
|
201
|
+
```
|
202
|
+
|
203
|
+
This enables developers to context-switch between multiple active features while maintaining progress tracking and development context.
|
@@ -0,0 +1,227 @@
|
|
1
|
+
---
|
2
|
+
name: sp-decompose
|
3
|
+
description: Decompose large specifications into microservices, APIs, and smaller components
|
4
|
+
allowed_tools:
|
5
|
+
- Read
|
6
|
+
- Write
|
7
|
+
- Edit
|
8
|
+
- Bash
|
9
|
+
- TodoWrite
|
10
|
+
---
|
11
|
+
|
12
|
+
# /sp-decompose Command
|
13
|
+
|
14
|
+
Decompose large specifications into smaller, manageable components with microservice boundaries, API contracts, and interface specifications.
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
```
|
18
|
+
/sp-decompose [spec-id] [options]
|
19
|
+
```
|
20
|
+
|
21
|
+
Options: `--microservices`, `--apis`, `--interfaces`, `--all` (defaults to `--all`)
|
22
|
+
|
23
|
+
## Implementation
|
24
|
+
|
25
|
+
When called with `/sp-decompose $ARGUMENTS`, I will:
|
26
|
+
|
27
|
+
1. **Parse specification to decompose**:
|
28
|
+
- If spec-id provided (e.g., `001` or `001-authentication`), use that specification
|
29
|
+
- Otherwise, detect current feature from `memory/context.md` or git branch
|
30
|
+
- Read the target specification file from `specs/XXX-feature/spec-YYY.md`
|
31
|
+
- Analyze complexity and identify decomposition opportunities
|
32
|
+
|
33
|
+
2. **Analyze decomposition strategy**:
|
34
|
+
- **Domain Analysis**: Identify bounded contexts and aggregate roots
|
35
|
+
- **Responsibility Mapping**: Group related functionalities
|
36
|
+
- **Data Flow Analysis**: Understand data dependencies
|
37
|
+
- **Integration Points**: Identify communication needs between components
|
38
|
+
- **Complexity Assessment**: Measure cognitive load and cyclomatic complexity
|
39
|
+
|
40
|
+
3. **Generate microservice boundaries**:
|
41
|
+
- Apply Domain-Driven Design (DDD) principles
|
42
|
+
- Create service definitions with clear responsibilities:
|
43
|
+
```yaml
|
44
|
+
service: user-authentication
|
45
|
+
responsibility: Handle user identity and access control
|
46
|
+
bounded_context: Identity Management
|
47
|
+
capabilities:
|
48
|
+
- User registration
|
49
|
+
- Authentication (OAuth2, JWT)
|
50
|
+
- Session management
|
51
|
+
- Password reset
|
52
|
+
data_ownership:
|
53
|
+
- users table
|
54
|
+
- sessions table
|
55
|
+
- tokens table
|
56
|
+
```
|
57
|
+
- Define inter-service communication patterns
|
58
|
+
- Specify data consistency requirements
|
59
|
+
|
60
|
+
4. **Create API contracts**:
|
61
|
+
- Generate OpenAPI 3.0 specifications for each service
|
62
|
+
- Define RESTful endpoints with clear semantics:
|
63
|
+
```yaml
|
64
|
+
/api/v1/users:
|
65
|
+
post:
|
66
|
+
summary: Create new user
|
67
|
+
requestBody:
|
68
|
+
$ref: '#/components/schemas/UserCreateRequest'
|
69
|
+
responses:
|
70
|
+
201:
|
71
|
+
$ref: '#/components/schemas/UserResponse'
|
72
|
+
```
|
73
|
+
- Specify request/response schemas
|
74
|
+
- Include authentication and authorization requirements
|
75
|
+
- Define rate limiting and caching strategies
|
76
|
+
|
77
|
+
5. **Design interface specifications**:
|
78
|
+
- Create abstract interfaces for each component:
|
79
|
+
```typescript
|
80
|
+
interface IAuthenticationService {
|
81
|
+
authenticate(credentials: Credentials): Promise<AuthToken>
|
82
|
+
validateToken(token: string): Promise<TokenValidation>
|
83
|
+
refreshToken(refreshToken: string): Promise<AuthToken>
|
84
|
+
revokeToken(token: string): Promise<void>
|
85
|
+
}
|
86
|
+
```
|
87
|
+
- Define data transfer objects (DTOs)
|
88
|
+
- Specify event contracts for event-driven communication
|
89
|
+
- Create adapter patterns for external integrations
|
90
|
+
|
91
|
+
6. **Generate decomposition artifacts using templates**:
|
92
|
+
- Read templates from `templates/decomposition/`
|
93
|
+
- Use template variables for AI processing
|
94
|
+
- Create structured output in `specs/XXX-feature/decomposition/`:
|
95
|
+
- **`microservices.md`**: From template with service boundaries
|
96
|
+
- **`api-contracts/`**: From OpenAPI template
|
97
|
+
- **`interfaces/`**: From interface template
|
98
|
+
- **`integration-map.md`**: Service communication
|
99
|
+
- Update `memory/context.md` with decomposition status
|
100
|
+
|
101
|
+
7. **Validate decomposition**:
|
102
|
+
- Check for circular dependencies
|
103
|
+
- Verify data consistency boundaries
|
104
|
+
- Ensure single responsibility principle
|
105
|
+
- Validate against constitutional principles:
|
106
|
+
- Simplicity (≤3 modules per service)
|
107
|
+
- Clear boundaries
|
108
|
+
- Testability
|
109
|
+
|
110
|
+
8. **Update workflow context**:
|
111
|
+
- Add decomposition results to `memory/context.md`
|
112
|
+
- Create feature-specific plan template with services
|
113
|
+
- Prepare for `/sp-plan generate` with service context
|
114
|
+
- Enable `/sp-task breakdown` per service
|
115
|
+
- Run validation: `python scripts/sp-pulse-decompose.py validate`
|
116
|
+
|
117
|
+
## Examples
|
118
|
+
|
119
|
+
### Basic decomposition
|
120
|
+
```
|
121
|
+
User: /sp-decompose 001
|
122
|
+
```
|
123
|
+
I will analyze spec 001 and create a complete decomposition with microservices, APIs, and interfaces.
|
124
|
+
|
125
|
+
### Microservices only
|
126
|
+
```
|
127
|
+
User: /sp-decompose 002-ecommerce --microservices
|
128
|
+
```
|
129
|
+
I will focus on identifying microservice boundaries for the e-commerce specification.
|
130
|
+
|
131
|
+
### API contracts focus
|
132
|
+
```
|
133
|
+
User: /sp-decompose --apis
|
134
|
+
```
|
135
|
+
I will generate detailed API contracts for the current feature specification.
|
136
|
+
|
137
|
+
## Decomposition Principles
|
138
|
+
|
139
|
+
### Domain-Driven Design
|
140
|
+
- Bounded contexts define service boundaries
|
141
|
+
- Aggregates determine data ownership
|
142
|
+
- Ubiquitous language for clear communication
|
143
|
+
|
144
|
+
### SOLID Principles
|
145
|
+
- **S**ingle Responsibility: Each service has one reason to change
|
146
|
+
- **O**pen/Closed: Services extensible without modification
|
147
|
+
- **L**iskov Substitution: Interfaces are substitutable
|
148
|
+
- **I**nterface Segregation: Focused, specific interfaces
|
149
|
+
- **D**ependency Inversion: Depend on abstractions
|
150
|
+
|
151
|
+
### Communication Patterns
|
152
|
+
- **Synchronous**: REST APIs for request-response
|
153
|
+
- **Asynchronous**: Events for decoupled communication
|
154
|
+
- **Hybrid**: Command Query Responsibility Segregation (CQRS)
|
155
|
+
|
156
|
+
## Output Structure
|
157
|
+
|
158
|
+
```
|
159
|
+
specs/001-authentication/decomposition/
|
160
|
+
├── microservices.md # Service definitions
|
161
|
+
├── api-contracts/
|
162
|
+
│ ├── auth-service.yaml # OpenAPI spec
|
163
|
+
│ ├── user-service.yaml # OpenAPI spec
|
164
|
+
│ └── session-service.yaml # OpenAPI spec
|
165
|
+
├── interfaces/
|
166
|
+
│ ├── IAuthService.ts # TypeScript interface
|
167
|
+
│ ├── IUserRepository.ts # Repository pattern
|
168
|
+
│ └── IEventBus.ts # Event bus interface
|
169
|
+
├── data-models/
|
170
|
+
│ ├── user.schema.json # JSON Schema
|
171
|
+
│ ├── session.proto # Protocol Buffers
|
172
|
+
│ └── events.avsc # Avro schema
|
173
|
+
├── integration-map.md # Service communication
|
174
|
+
└── migration-plan.md # Decomposition strategy
|
175
|
+
```
|
176
|
+
|
177
|
+
## Constitutional Compliance
|
178
|
+
|
179
|
+
**Article I: Simplicity**
|
180
|
+
- Each service limited to 3 core modules
|
181
|
+
- Clear, focused responsibilities
|
182
|
+
- Minimal inter-service dependencies
|
183
|
+
|
184
|
+
**Article V: Single Responsibility**
|
185
|
+
- Services own their data
|
186
|
+
- Clear aggregate boundaries
|
187
|
+
- Independent deployment capability
|
188
|
+
|
189
|
+
**Article VIII: Framework Selection**
|
190
|
+
- Choose appropriate tech stack per service
|
191
|
+
- Leverage existing libraries
|
192
|
+
- Standardize communication protocols
|
193
|
+
|
194
|
+
## Integration with SpecPulse Workflow
|
195
|
+
|
196
|
+
1. **After `/sp-spec create`**:
|
197
|
+
- AI analyzes spec complexity
|
198
|
+
- Suggests decomposition if >3 modules detected
|
199
|
+
- User confirms with `/sp-decompose`
|
200
|
+
|
201
|
+
2. **During decomposition**:
|
202
|
+
- AI reads spec from `specs/XXX-feature/spec-YYY.md`
|
203
|
+
- Applies DDD analysis using spec content
|
204
|
+
- Generates artifacts using templates
|
205
|
+
- Updates memory/context.md
|
206
|
+
|
207
|
+
3. **Before `/sp-plan generate`**:
|
208
|
+
- Plan command detects decomposition
|
209
|
+
- Uses service boundaries for architecture
|
210
|
+
- Creates service-specific phases
|
211
|
+
|
212
|
+
4. **During `/sp-task breakdown`**:
|
213
|
+
- Tasks created per service
|
214
|
+
- Inter-service dependencies mapped
|
215
|
+
- Integration tasks generated
|
216
|
+
|
217
|
+
5. **With `/sp-validate`**:
|
218
|
+
- Validates service boundaries
|
219
|
+
- Checks circular dependencies
|
220
|
+
- Ensures constitutional compliance
|
221
|
+
|
222
|
+
## Error Handling
|
223
|
+
|
224
|
+
- Specification not found: Guide user to create spec first
|
225
|
+
- Circular dependencies detected: Suggest refactoring
|
226
|
+
- Too many services (>7): Recommend consolidation
|
227
|
+
- Missing bounded contexts: Apply DDD analysis
|
@@ -0,0 +1,220 @@
|
|
1
|
+
---
|
2
|
+
name: sp-plan
|
3
|
+
description: Generate or validate implementation plans using AI-optimized templates
|
4
|
+
allowed_tools:
|
5
|
+
- Read
|
6
|
+
- Write
|
7
|
+
- Edit
|
8
|
+
- Bash
|
9
|
+
- TodoWrite
|
10
|
+
---
|
11
|
+
|
12
|
+
# /sp-plan Command
|
13
|
+
|
14
|
+
Generate implementation plans from specifications following SpecPulse methodology with constitutional compliance and AI-optimized templates.
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
```
|
18
|
+
/sp-plan [action] [feature-directory]
|
19
|
+
```
|
20
|
+
|
21
|
+
Actions: `generate`, `validate`, `optimize` (defaults to `generate`)
|
22
|
+
|
23
|
+
## Implementation
|
24
|
+
|
25
|
+
When called with `/sp-plan $ARGUMENTS`, I will:
|
26
|
+
|
27
|
+
1. **Detect current feature context**:
|
28
|
+
- Read `memory/context.md` for current feature metadata
|
29
|
+
- Use git branch name if available (e.g., `001-user-authentication`)
|
30
|
+
- Fall back to most recently created feature directory
|
31
|
+
- If no context found, ask user to specify feature or run `/sp-pulse` first
|
32
|
+
|
33
|
+
2. **Parse arguments** and determine action:
|
34
|
+
- If `validate`: Check plan against constitutional gates
|
35
|
+
- If `optimize`: Improve existing plan complexity
|
36
|
+
- Otherwise: Generate new plan
|
37
|
+
|
38
|
+
3. **For `/sp-plan generate` or `/sp-plan`:**
|
39
|
+
a. **Check for decomposition**: Look for `specs/XXX-feature/decomposition/` directory
|
40
|
+
b. **If decomposed**:
|
41
|
+
- Read decomposition artifacts (microservices.md, api-contracts/, interfaces/)
|
42
|
+
- Generate separate plans for each service
|
43
|
+
- Create integration plan for service coordination
|
44
|
+
- Structure: `plans/XXX-feature/service-A-plan.md`, `integration-plan.md`
|
45
|
+
c. **If not decomposed**:
|
46
|
+
- Show existing spec files and ask user to select
|
47
|
+
- Generate single monolithic plan
|
48
|
+
d. **Find and validate specification** from selected spec file
|
49
|
+
|
50
|
+
d. **Enhanced validation** using cross-platform script:
|
51
|
+
```bash
|
52
|
+
# Cross-platform detection
|
53
|
+
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
|
54
|
+
python scripts/sp-pulse-plan.py "$FEATURE_DIR"
|
55
|
+
else
|
56
|
+
bash scripts/sp-pulse-plan.sh "$FEATURE_DIR" || python scripts/sp-pulse-plan.py "$FEATURE_DIR"
|
57
|
+
fi
|
58
|
+
```
|
59
|
+
|
60
|
+
e. **Run Constitutional Phase Gates** (Article VII):
|
61
|
+
- Simplicity Gate: ≤3 modules justification
|
62
|
+
- Anti-Abstraction Gate: Direct framework usage
|
63
|
+
- Test-First Gate: Tests before implementation
|
64
|
+
- Integration-First Gate: Real services over mocks
|
65
|
+
- Research Gate: Technology choices documented
|
66
|
+
|
67
|
+
f. **Generate AI-optimized plan** using template variables:
|
68
|
+
```markdown
|
69
|
+
# Implementation Plan: {{ feature_name }}
|
70
|
+
## Specification Reference
|
71
|
+
- **Spec ID**: SPEC-{{ feature_id }}
|
72
|
+
- **Spec Version**: {{ spec_version }}
|
73
|
+
- **Plan Version**: {{ plan_version }}
|
74
|
+
- **Generated**: {{ date }}
|
75
|
+
```
|
76
|
+
|
77
|
+
g. **Generate comprehensive sections based on architecture**:
|
78
|
+
- **For decomposed specs**:
|
79
|
+
* Service-specific plans with bounded contexts
|
80
|
+
* Inter-service communication plans
|
81
|
+
* Data consistency strategies
|
82
|
+
* Service deployment order
|
83
|
+
* Integration testing approach
|
84
|
+
- **For monolithic specs**:
|
85
|
+
* Traditional layered architecture
|
86
|
+
* Module boundaries
|
87
|
+
* Single deployment strategy
|
88
|
+
- Common sections:
|
89
|
+
* Technology stack with performance implications
|
90
|
+
* Testing strategy with coverage targets
|
91
|
+
* Security considerations
|
92
|
+
* Deployment strategy with rollback plans
|
93
|
+
|
94
|
+
h. **Complexity tracking** (Article VII):
|
95
|
+
- Document all complexity exceptions with justifications
|
96
|
+
- Create mitigation strategies for each exception
|
97
|
+
- Track optimization opportunities
|
98
|
+
|
99
|
+
i. **Version management**: Check existing plan files and create next version (plan-001.md, plan-002.md, etc.)
|
100
|
+
j. **Write optimized plan** to `plans/XXX-feature/plan-XXX.md`
|
101
|
+
|
102
|
+
4. **For `/sp-plan validate`:**
|
103
|
+
a. **Show existing plan files**: List all plan-XXX.md files in current feature directory
|
104
|
+
b. **Ask user to select**: Which plan file to validate
|
105
|
+
c. **Enhanced validation** using cross-platform script:
|
106
|
+
```bash
|
107
|
+
# Cross-platform detection
|
108
|
+
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
|
109
|
+
python scripts/sp-pulse-plan.py "$FEATURE_DIR"
|
110
|
+
else
|
111
|
+
bash scripts/sp-pulse-plan.sh "$FEATURE_DIR" || python scripts/sp-pulse-plan.py "$FEATURE_DIR"
|
112
|
+
fi
|
113
|
+
```
|
114
|
+
d. Verify all constitutional gates are addressed
|
115
|
+
e. Check complexity exceptions have proper justifications
|
116
|
+
f. Validate test-first approach is documented
|
117
|
+
g. Ensure integration strategy uses real services
|
118
|
+
h. Report detailed validation results
|
119
|
+
|
120
|
+
5. **For `/sp-plan optimize`:**
|
121
|
+
a. **Show existing plan files**: List all plan-XXX.md files in current feature directory
|
122
|
+
b. **Ask user to select**: Which plan file to optimize
|
123
|
+
c. **Read existing plan** from detected context and analyze complexity
|
124
|
+
d. **Identify optimization opportunities**:
|
125
|
+
- Module consolidation opportunities
|
126
|
+
- Abstraction layer removal candidates
|
127
|
+
- Simplification strategies
|
128
|
+
e. **Generate optimization recommendations**
|
129
|
+
f. **Create new version**: Write optimized plan as next version (plan-XXX.md)
|
130
|
+
|
131
|
+
## Constitutional Phase Gates (Phase -1)
|
132
|
+
|
133
|
+
**Must pass before implementation:**
|
134
|
+
|
135
|
+
### Article VII: Simplicity Gate
|
136
|
+
- [ ] Using ≤3 projects/modules for initial implementation
|
137
|
+
- [ ] No future-proofing without documented need
|
138
|
+
- [ ] Direct framework usage (no unnecessary wrappers)
|
139
|
+
- [ ] Single model representation per concept
|
140
|
+
|
141
|
+
### Article VII: Anti-Abstraction Gate
|
142
|
+
- [ ] Using framework features directly
|
143
|
+
- [ ] No unnecessary abstraction layers
|
144
|
+
- [ ] Clear, simple interfaces
|
145
|
+
- [ ] Avoiding premature optimization
|
146
|
+
|
147
|
+
### Article III: Test-First Gate
|
148
|
+
- [ ] Test specifications written
|
149
|
+
- [ ] Tests reviewed and approved
|
150
|
+
- [ ] Tests confirmed to FAIL before implementation
|
151
|
+
- [ ] TDD cycle planned (Red-Green-Refactor)
|
152
|
+
|
153
|
+
### Article VIII: Integration-First Gate
|
154
|
+
- [ ] Contract tests defined
|
155
|
+
- [ ] Using real services over mocks
|
156
|
+
- [ ] Production-like test environment planned
|
157
|
+
- [ ] End-to-end test scenarios identified
|
158
|
+
|
159
|
+
### Article VI: Research Gate
|
160
|
+
- [ ] Library options researched
|
161
|
+
- [ ] Performance implications documented
|
162
|
+
- [ ] Security considerations analyzed
|
163
|
+
- [ ] Trade-offs documented
|
164
|
+
|
165
|
+
## Examples
|
166
|
+
|
167
|
+
### Generate plan for decomposed spec
|
168
|
+
```
|
169
|
+
User: /sp-plan generate
|
170
|
+
```
|
171
|
+
Detecting decomposition in `specs/001-authentication/decomposition/`...
|
172
|
+
I will create:
|
173
|
+
- `plans/001-authentication/auth-service-plan.md`
|
174
|
+
- `plans/001-authentication/user-service-plan.md`
|
175
|
+
- `plans/001-authentication/integration-plan.md`
|
176
|
+
|
177
|
+
### Generate plan for monolithic spec
|
178
|
+
```
|
179
|
+
User: /sp-plan generate
|
180
|
+
```
|
181
|
+
No decomposition found. Creating single plan:
|
182
|
+
- `plans/001-authentication/plan-001.md`
|
183
|
+
|
184
|
+
### Validate existing plan
|
185
|
+
```
|
186
|
+
User: /sp-plan validate
|
187
|
+
```
|
188
|
+
I will run comprehensive validation:
|
189
|
+
```
|
190
|
+
PLAN_FILE=plans/001-user-authentication/plan.md
|
191
|
+
CONSTITUTIONAL_GATES_STATUS=COMPLETED
|
192
|
+
MISSING_SECTIONS=0
|
193
|
+
STATUS=validation_complete
|
194
|
+
```
|
195
|
+
|
196
|
+
### Optimize plan complexity
|
197
|
+
```
|
198
|
+
User: /sp-plan optimize
|
199
|
+
```
|
200
|
+
I will analyze and recommend complexity reductions.
|
201
|
+
|
202
|
+
## Enhanced Features
|
203
|
+
|
204
|
+
- **AI-optimized templates** with Jinja2-style variables
|
205
|
+
- **Cross-platform script execution** with automatic detection
|
206
|
+
- **Enhanced script integration** for Bash and Python
|
207
|
+
- **Constitutional compliance tracking** with gate status
|
208
|
+
- **Complexity exception management** with justifications
|
209
|
+
- **Performance and security considerations** integrated
|
210
|
+
- **Integration-first approach** with real service usage
|
211
|
+
- **Detailed validation reporting** with specific recommendations
|
212
|
+
- **Platform-agnostic operation** for any development environment
|
213
|
+
|
214
|
+
## Error Handling
|
215
|
+
|
216
|
+
- Specification existence validation
|
217
|
+
- Constitutional gate compliance checking
|
218
|
+
- Template structure validation
|
219
|
+
- Directory structure verification
|
220
|
+
- Feature context auto-discovery
|