specpulse 1.4.0__py3-none-any.whl → 1.4.2__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 (31) hide show
  1. specpulse/__init__.py +1 -1
  2. specpulse/cli/main.py +30 -8
  3. specpulse/core/specpulse.py +328 -3
  4. specpulse/core/validator.py +115 -5
  5. specpulse/resources/commands/gemini/sp-pulse.toml +80 -23
  6. specpulse/resources/commands/gemini/sp-spec.toml +90 -45
  7. specpulse/resources/scripts/sp-pulse-decompose.ps1 +74 -0
  8. specpulse/resources/scripts/sp-pulse-execute.ps1 +177 -0
  9. specpulse/resources/scripts/sp-pulse-init.ps1 +36 -11
  10. specpulse/resources/scripts/sp-pulse-init.sh +29 -8
  11. specpulse/resources/scripts/sp-pulse-plan.sh +42 -17
  12. specpulse/resources/scripts/sp-pulse-spec.sh +49 -25
  13. specpulse/resources/scripts/sp-pulse-task.sh +49 -17
  14. specpulse/resources/templates/decomposition/api-contract.yaml +344 -12
  15. specpulse/resources/templates/decomposition/integration-plan.md +249 -97
  16. specpulse/resources/templates/decomposition/interface.ts +244 -13
  17. specpulse/resources/templates/decomposition/microservice.md +151 -0
  18. specpulse/resources/templates/decomposition/service-plan.md +187 -155
  19. specpulse/resources/templates/plan.md +134 -225
  20. specpulse/resources/templates/spec.md +94 -125
  21. specpulse/resources/templates/task.md +216 -161
  22. specpulse/utils/console.py +54 -6
  23. specpulse/utils/git_utils.py +47 -4
  24. specpulse/utils/version_check.py +15 -2
  25. {specpulse-1.4.0.dist-info → specpulse-1.4.2.dist-info}/METADATA +36 -17
  26. {specpulse-1.4.0.dist-info → specpulse-1.4.2.dist-info}/RECORD +30 -28
  27. specpulse/resources/templates/decomposition/microservices.md +0 -35
  28. {specpulse-1.4.0.dist-info → specpulse-1.4.2.dist-info}/WHEEL +0 -0
  29. {specpulse-1.4.0.dist-info → specpulse-1.4.2.dist-info}/entry_points.txt +0 -0
  30. {specpulse-1.4.0.dist-info → specpulse-1.4.2.dist-info}/licenses/LICENSE +0 -0
  31. {specpulse-1.4.0.dist-info → specpulse-1.4.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,151 @@
1
+ # Microservice: {{service_name}}
2
+
3
+ ## Service Overview
4
+ - **Name**: {{service_name}}
5
+ - **Domain**: {{domain}}
6
+ - **Type**: [API|Worker|Gateway|Database|Cache]
7
+ - **Parent Spec**: SPEC-{{spec_id}}
8
+ - **Created**: {{date}}
9
+
10
+ ## Service Responsibilities
11
+ ### Primary Responsibilities
12
+ - {{primary_responsibility_1}}
13
+ - {{primary_responsibility_2}}
14
+ - {{primary_responsibility_3}}
15
+
16
+ ### Secondary Responsibilities
17
+ - {{secondary_responsibility_1}}
18
+ - {{secondary_responsibility_2}}
19
+
20
+ ## Boundaries
21
+ ### What This Service DOES
22
+ - Manages {{entity}} lifecycle
23
+ - Handles {{operation}} operations
24
+ - Provides {{capability}} capabilities
25
+
26
+ ### What This Service DOES NOT DO
27
+ - Does not manage {{excluded_entity}}
28
+ - Does not handle {{excluded_operation}}
29
+ - Delegates {{delegated_capability}} to {{other_service}}
30
+
31
+ ## API Specification
32
+
33
+ ### REST Endpoints
34
+ ```
35
+ GET /api/v1/{{resource}} # List all {{resource}}
36
+ GET /api/v1/{{resource}}/{id} # Get specific {{resource}}
37
+ POST /api/v1/{{resource}} # Create new {{resource}}
38
+ PUT /api/v1/{{resource}}/{id} # Update {{resource}}
39
+ DELETE /api/v1/{{resource}}/{id} # Delete {{resource}}
40
+ ```
41
+
42
+ ### Event Publishing
43
+ - `{{entity}}.created` - When new {{entity}} is created
44
+ - `{{entity}}.updated` - When {{entity}} is modified
45
+ - `{{entity}}.deleted` - When {{entity}} is removed
46
+
47
+ ### Event Subscriptions
48
+ - `{{dependency}}.changed` - React to {{dependency}} changes
49
+ - `{{trigger}}.occurred` - Handle {{trigger}} events
50
+
51
+ ## Data Model
52
+
53
+ ### Primary Entities
54
+ ```json
55
+ {
56
+ "{{entity}}": {
57
+ "id": "uuid",
58
+ "name": "string",
59
+ "status": "enum",
60
+ "created_at": "timestamp",
61
+ "updated_at": "timestamp"
62
+ }
63
+ }
64
+ ```
65
+
66
+ ### Database Schema
67
+ - **Database Type**: {{database_type}}
68
+ - **Collections/Tables**: {{collections}}
69
+ - **Indexes**: {{indexes}}
70
+
71
+ ## Dependencies
72
+
73
+ ### Internal Services
74
+ - **{{service_1}}**: For {{purpose_1}}
75
+ - **{{service_2}}**: For {{purpose_2}}
76
+
77
+ ### External Services
78
+ - **{{external_1}}**: {{external_purpose_1}}
79
+ - **{{external_2}}**: {{external_purpose_2}}
80
+
81
+ ### Libraries & Frameworks
82
+ - {{framework}}: Core framework
83
+ - {{library_1}}: {{library_purpose_1}}
84
+ - {{library_2}}: {{library_purpose_2}}
85
+
86
+ ## Configuration
87
+
88
+ ### Environment Variables
89
+ ```bash
90
+ SERVICE_NAME={{service_name}}
91
+ SERVICE_PORT={{port}}
92
+ DATABASE_URL={{database_url}}
93
+ CACHE_URL={{cache_url}}
94
+ MESSAGE_BROKER_URL={{broker_url}}
95
+ ```
96
+
97
+ ### Secrets
98
+ - `API_KEY`: For external service authentication
99
+ - `JWT_SECRET`: For token generation
100
+ - `DATABASE_PASSWORD`: Database access
101
+
102
+ ## Scalability Considerations
103
+
104
+ ### Horizontal Scaling
105
+ - **Min Instances**: {{min_instances}}
106
+ - **Max Instances**: {{max_instances}}
107
+ - **Auto-scaling Metric**: {{scaling_metric}}
108
+
109
+ ### Performance Targets
110
+ - **Response Time**: < {{response_time}}ms
111
+ - **Throughput**: {{throughput}} req/s
112
+ - **Availability**: {{availability}}%
113
+
114
+ ## Monitoring & Observability
115
+
116
+ ### Key Metrics
117
+ - Request rate and latency
118
+ - Error rate and types
119
+ - Database query performance
120
+ - Cache hit ratio
121
+
122
+ ### Health Checks
123
+ - `/health` - Basic liveness check
124
+ - `/ready` - Readiness with dependency checks
125
+
126
+ ### Logging
127
+ - Structured JSON logging
128
+ - Correlation ID tracking
129
+ - Error stack traces
130
+
131
+ ## Security Considerations
132
+ - Authentication: {{auth_method}}
133
+ - Authorization: {{authz_method}}
134
+ - Rate Limiting: {{rate_limit}} req/min
135
+ - Input Validation: All inputs validated
136
+ - Output Sanitization: Prevent data leaks
137
+
138
+ ## Testing Strategy
139
+ - Unit Tests: {{unit_test_coverage}}% coverage
140
+ - Integration Tests: With mocked dependencies
141
+ - Contract Tests: API contract validation
142
+ - Load Tests: {{load_test_target}} concurrent users
143
+
144
+ ## Deployment
145
+ - **Container**: Docker image
146
+ - **Orchestration**: Kubernetes
147
+ - **CI/CD**: Automated pipeline
148
+ - **Rollback**: Blue-green deployment
149
+
150
+ ## Notes
151
+ <!-- Additional implementation notes -->
@@ -1,169 +1,201 @@
1
- # Service Plan: {{ service_name }}
1
+ # Service Implementation Plan: {{service_name}}
2
2
 
3
- ## Metadata
4
- - **Service**: {{ service_name }}
5
- - **Bounded Context**: {{ bounded_context }}
6
- - **Spec Reference**: {{ spec_id }}
7
- - **Generated**: {{ date }}
8
- - **Version**: {{ version }}
3
+ ## Service Context
4
+ - **Parent Spec**: SPEC-{{spec_id}}
5
+ - **Service Type**: {{service_type}}
6
+ - **Priority**: {{priority}}
7
+ - **Dependencies**: {{dependencies}}
9
8
 
10
- ## Service Overview
11
-
12
- ### Responsibility
13
- {{ service_responsibility }}
14
-
15
- ### Capabilities
16
- {{ service_capabilities }}
17
-
18
- ### Data Ownership
19
- {{ data_ownership }}
20
-
21
- ## Architecture
22
-
23
- ### Internal Structure
9
+ ## Architecture Overview
24
10
  ```
25
- {{ service_name }}/
26
- ├── domain/ # Business logic
27
- ├── application/ # Use cases
28
- ├── infrastructure/ # External interfaces
29
- └── presentation/ # API layer
11
+ ┌──────────────────────────────┐
12
+ │ {{service_name}} │
13
+ ├──────────────────────────────┤
14
+ API Layer │
15
+ │ ├── REST Controllers │
16
+ │ └── GraphQL Resolvers │
17
+ ├──────────────────────────────┤
18
+ │ Business Logic │
19
+ │ ├── Services │
20
+ │ └── Domain Models │
21
+ ├──────────────────────────────┤
22
+ │ Data Access Layer │
23
+ │ ├── Repositories │
24
+ │ └── Database Connection │
25
+ └──────────────────────────────┘
30
26
  ```
31
27
 
32
- ### Technology Stack
33
- - **Language**: {{ language }}
34
- - **Framework**: {{ framework }}
35
- - **Database**: {{ database }}
36
- - **Cache**: {{ cache }}
37
- - **Message Queue**: {{ queue }}
38
-
39
- ## API Design
40
-
41
- ### REST Endpoints
42
- {{ rest_endpoints }}
43
-
44
- ### Event Publications
45
- {{ event_publications }}
46
-
47
- ### Event Subscriptions
48
- {{ event_subscriptions }}
49
-
50
- ## Data Model
51
-
52
- ### Entities
53
- {{ entities }}
54
-
55
- ### Value Objects
56
- {{ value_objects }}
57
-
58
- ### Aggregates
59
- {{ aggregates }}
60
-
61
28
  ## Implementation Phases
62
29
 
63
- ### Phase 1: Domain Layer
64
- **Duration**: {{ phase1_duration }}
65
- - Domain entities
66
- - Business rules
67
- - Domain events
68
- - Value objects
69
-
70
- ### Phase 2: Application Layer
71
- **Duration**: {{ phase2_duration }}
72
- - Use cases
73
- - Application services
74
- - DTOs
75
- - Mappers
76
-
77
- ### Phase 3: Infrastructure Layer
78
- **Duration**: {{ phase3_duration }}
79
- - Database repositories
80
- - External service clients
81
- - Message handlers
82
- - Cache implementation
83
-
84
- ### Phase 4: API Layer
85
- **Duration**: {{ phase4_duration }}
86
- - REST controllers
87
- - Request/Response models
88
- - Validation
89
- - Error handling
90
-
91
- ## Testing Strategy
92
-
93
- ### Unit Tests
94
- - Domain logic: {{ domain_coverage }}%
95
- - Use cases: {{ usecase_coverage }}%
96
- - Infrastructure: {{ infra_coverage }}%
97
-
98
- ### Integration Tests
99
- {{ integration_tests }}
100
-
101
- ### Contract Tests
102
- {{ contract_tests }}
103
-
104
- ## Service Configuration
105
-
106
- ### Environment Variables
107
- ```yaml
108
- {{ env_variables }}
109
- ```
110
-
111
- ### Feature Flags
112
- {{ feature_flags }}
113
-
114
- ### Secrets Management
115
- {{ secrets }}
116
-
117
- ## Deployment
118
-
119
- ### Container Configuration
120
- ```dockerfile
121
- {{ dockerfile_snippet }}
122
- ```
123
-
124
- ### Resource Requirements
125
- - CPU: {{ cpu_requirements }}
126
- - Memory: {{ memory_requirements }}
127
- - Storage: {{ storage_requirements }}
30
+ ### Phase 1: Foundation (2-3 days)
31
+ **Goal**: Set up service structure and basic infrastructure
32
+
33
+ #### Tasks
34
+ - [ ] Create service project structure
35
+ - [ ] Set up development environment
36
+ - [ ] Configure database connection
37
+ - [ ] Set up logging and monitoring
38
+ - [ ] Create health check endpoint
39
+ - [ ] Configure CI/CD pipeline
40
+
41
+ #### Success Criteria
42
+ - Service starts successfully
43
+ - Health check returns 200
44
+ - Logs are being collected
45
+ - CI/CD pipeline runs
46
+
47
+ ### Phase 2: Core Features (5-7 days)
48
+ **Goal**: Implement primary business logic and APIs
49
+
50
+ #### Tasks
51
+ - [ ] Define domain models
52
+ - [ ] Implement data repositories
53
+ - [ ] Create service layer with business logic
54
+ - [ ] Implement REST API endpoints
55
+ - [ ] Add request/response validation
56
+ - [ ] Write unit tests for business logic
57
+
58
+ #### Success Criteria
59
+ - All CRUD operations working
60
+ - Business rules enforced
61
+ - Unit tests passing (>80% coverage)
62
+ - API documentation generated
63
+
64
+ ### Phase 3: Integration (3-4 days)
65
+ **Goal**: Connect with other services and external systems
66
+
67
+ #### Tasks
68
+ - [ ] Implement event publishing
69
+ - [ ] Set up event subscriptions
70
+ - [ ] Add external service clients
71
+ - [ ] Implement circuit breakers
72
+ - [ ] Add retry logic
73
+ - [ ] Create integration tests
74
+
75
+ #### Success Criteria
76
+ - Events published successfully
77
+ - Can consume events from other services
78
+ - External service calls working
79
+ - Integration tests passing
80
+
81
+ ### Phase 4: Enhancement (2-3 days)
82
+ **Goal**: Optimize performance and add advanced features
83
+
84
+ #### Tasks
85
+ - [ ] Add caching layer
86
+ - [ ] Optimize database queries
87
+ - [ ] Implement batch operations
88
+ - [ ] Add rate limiting
89
+ - [ ] Enhance error handling
90
+ - [ ] Performance testing
91
+
92
+ #### Success Criteria
93
+ - Response time < {{target_response_time}}ms
94
+ - Can handle {{target_throughput}} req/s
95
+ - Cache hit ratio > {{target_cache_ratio}}%
96
+ - All performance tests passing
97
+
98
+ ### Phase 5: Production Readiness (2 days)
99
+ **Goal**: Prepare for production deployment
100
+
101
+ #### Tasks
102
+ - [ ] Security audit
103
+ - [ ] Load testing
104
+ - [ ] Documentation review
105
+ - [ ] Deployment scripts
106
+ - [ ] Rollback plan
107
+ - [ ] Monitoring dashboards
108
+
109
+ #### Success Criteria
110
+ - Security scan passes
111
+ - Load tests meet targets
112
+ - Documentation complete
113
+ - Deployment automated
114
+ - Monitoring in place
115
+
116
+ ## Technical Decisions
128
117
 
129
- ### Scaling Strategy
130
- {{ scaling_strategy }}
131
-
132
- ## Monitoring
133
-
134
- ### Metrics
135
- {{ metrics }}
136
-
137
- ### Logs
138
- {{ logging_strategy }}
139
-
140
- ### Alerts
141
- {{ alert_rules }}
118
+ ### Technology Stack
119
+ - **Language**: {{programming_language}}
120
+ - **Framework**: {{framework}}
121
+ - **Database**: {{database}}
122
+ - **Cache**: {{cache}}
123
+ - **Message Queue**: {{message_queue}}
124
+
125
+ ### Key Design Patterns
126
+ 1. **Repository Pattern**: For data access abstraction
127
+ 2. **Service Layer**: For business logic encapsulation
128
+ 3. **DTO Pattern**: For API contracts
129
+ 4. **Event Sourcing**: For audit trail
130
+ 5. **Circuit Breaker**: For resilience
131
+
132
+ ### Database Design
133
+ - **Type**: {{database_type}}
134
+ - **Main Tables/Collections**:
135
+ - {{entity_1}}: Core entity
136
+ - {{entity_2}}: Related entity
137
+ - {{entity_3}}: Audit log
138
+
139
+ ### API Design
140
+ - **Style**: RESTful / GraphQL
141
+ - **Versioning**: URL-based (v1, v2)
142
+ - **Authentication**: JWT / API Key
143
+ - **Rate Limiting**: {{rate_limit}} req/min
144
+
145
+ ## Risk Management
146
+
147
+ ### Technical Risks
148
+ | Risk | Impact | Probability | Mitigation |
149
+ |------|--------|------------|------------|
150
+ | Database performance issues | High | Medium | Indexing, query optimization, caching |
151
+ | Service dependencies failure | High | Low | Circuit breakers, fallback mechanisms |
152
+ | Data inconsistency | High | Low | Transactions, event sourcing |
153
+ | Security vulnerabilities | High | Medium | Security scanning, code reviews |
154
+
155
+ ### Schedule Risks
156
+ - **Risk**: Integration complexity
157
+ - **Mitigation**: Early integration testing, mocked services
158
+
159
+ ## Resource Requirements
160
+ - **Developer(s)**: {{developer_count}}
161
+ - **Total Estimate**: {{total_days}} days
162
+ - **Tools Required**:
163
+ - IDE with {{language}} support
164
+ - Database client
165
+ - API testing tool
166
+ - Monitoring access
167
+
168
+ ## Success Metrics
169
+ - **Performance**:
170
+ - p95 latency < {{p95_latency}}ms
171
+ - Availability > {{availability}}%
172
+ - Error rate < {{error_rate}}%
173
+
174
+ - **Quality**:
175
+ - Code coverage > {{coverage}}%
176
+ - Zero critical vulnerabilities
177
+ - All acceptance criteria met
178
+
179
+ - **Business**:
180
+ - Supports {{concurrent_users}} concurrent users
181
+ - Processes {{transactions_per_second}} transactions/second
182
+ - Reduces {{business_metric}} by {{improvement}}%
142
183
 
143
184
  ## Dependencies
144
185
 
145
- ### Internal Services
146
- {{ internal_dependencies }}
147
-
148
- ### External Services
149
- {{ external_dependencies }}
150
-
151
- ### Libraries
152
- {{ libraries }}
186
+ ### Upstream Dependencies
187
+ - {{upstream_service_1}}: Provides {{data_1}}
188
+ - {{upstream_service_2}}: Provides {{data_2}}
153
189
 
154
- ## SDD Compliance
155
- - [ ] Service specifications clear (Principle 1: Specification First)
156
- - [ ] Phased implementation plan (Principle 2: Incremental Planning)
157
- - [ ] Tasks properly decomposed (Principle 3: Task Decomposition)
158
- - [ ] Test strategy defined (Principle 6: Quality Assurance)
159
- - [ ] Architecture documented (Principle 7: Architecture Documentation)
190
+ ### Downstream Dependencies
191
+ - {{downstream_service_1}}: Consumes {{api_1}}
192
+ - {{downstream_service_2}}: Consumes {{event_1}}
160
193
 
161
- ## Risk Assessment
162
- {{ risks }}
194
+ ### External Dependencies
195
+ - {{external_service_1}}: {{external_purpose_1}}
196
+ - {{external_service_2}}: {{external_purpose_2}}
163
197
 
164
- ## Success Criteria
165
- - [ ] All endpoints functional
166
- - [ ] Test coverage > {{ test_target }}%
167
- - [ ] Performance targets met
168
- - [ ] Zero security vulnerabilities
169
- - [ ] Documentation complete
198
+ ## Notes
199
+ - Follow team coding standards
200
+ - Update service registry after deployment
201
+ - Coordinate with DevOps for production setup