specpulse 1.1.0__tar.gz → 1.2.1__tar.gz

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 (60) hide show
  1. {specpulse-1.1.0/specpulse.egg-info → specpulse-1.2.1}/PKG-INFO +75 -16
  2. {specpulse-1.1.0 → specpulse-1.2.1}/README.md +74 -15
  3. {specpulse-1.1.0 → specpulse-1.2.1}/pyproject.toml +5 -1
  4. {specpulse-1.1.0 → specpulse-1.2.1}/setup.py +5 -1
  5. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/cli/main.py +214 -3
  6. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/core/specpulse.py +30 -0
  7. specpulse-1.2.1/specpulse/resources/commands/claude/sp-decompose.md +227 -0
  8. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/claude/sp-plan.md +39 -18
  9. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/claude/sp-task.md +68 -10
  10. specpulse-1.2.1/specpulse/resources/commands/gemini/sp-decompose.toml +54 -0
  11. specpulse-1.2.1/specpulse/resources/memory/context.md +79 -0
  12. specpulse-1.2.1/specpulse/resources/scripts/sp-pulse-decompose.py +66 -0
  13. specpulse-1.2.1/specpulse/resources/scripts/sp-pulse-decompose.sh +56 -0
  14. specpulse-1.2.1/specpulse/resources/templates/decomposition/api-contract.yaml +22 -0
  15. specpulse-1.2.1/specpulse/resources/templates/decomposition/integration-plan.md +134 -0
  16. specpulse-1.2.1/specpulse/resources/templates/decomposition/interface.ts +20 -0
  17. specpulse-1.2.1/specpulse/resources/templates/decomposition/microservices.md +34 -0
  18. specpulse-1.2.1/specpulse/resources/templates/decomposition/service-plan.md +168 -0
  19. {specpulse-1.1.0 → specpulse-1.2.1/specpulse.egg-info}/PKG-INFO +75 -16
  20. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse.egg-info/SOURCES.txt +9 -0
  21. specpulse-1.1.0/specpulse/resources/memory/context.md +0 -38
  22. {specpulse-1.1.0 → specpulse-1.2.1}/LICENSE +0 -0
  23. {specpulse-1.1.0 → specpulse-1.2.1}/MANIFEST.in +0 -0
  24. {specpulse-1.1.0 → specpulse-1.2.1}/requirements.txt +0 -0
  25. {specpulse-1.1.0 → specpulse-1.2.1}/setup.cfg +0 -0
  26. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/__init__.py +0 -0
  27. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/cli/__init__.py +0 -0
  28. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/core/__init__.py +0 -0
  29. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/core/validator.py +0 -0
  30. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/claude/sp-continue.md +0 -0
  31. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/claude/sp-pulse.md +0 -0
  32. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/claude/sp-spec.md +0 -0
  33. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/claude/sp-status.md +0 -0
  34. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/gemini/sp-continue.toml +0 -0
  35. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/gemini/sp-plan.toml +0 -0
  36. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/gemini/sp-pulse.toml +0 -0
  37. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/gemini/sp-spec.toml +0 -0
  38. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/gemini/sp-status.toml +0 -0
  39. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/commands/gemini/sp-task.toml +0 -0
  40. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/memory/constitution.md +0 -0
  41. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/memory/decisions.md +0 -0
  42. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/scripts/sp-pulse-init.py +0 -0
  43. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/scripts/sp-pulse-init.sh +0 -0
  44. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/scripts/sp-pulse-plan.py +0 -0
  45. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/scripts/sp-pulse-plan.sh +0 -0
  46. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/scripts/sp-pulse-spec.py +0 -0
  47. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/scripts/sp-pulse-spec.sh +0 -0
  48. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/scripts/sp-pulse-task.py +0 -0
  49. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/scripts/sp-pulse-task.sh +0 -0
  50. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/templates/plan.md +0 -0
  51. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/templates/spec.md +0 -0
  52. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/resources/templates/task.md +0 -0
  53. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/utils/__init__.py +0 -0
  54. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/utils/console.py +0 -0
  55. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse/utils/git_utils.py +0 -0
  56. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse.egg-info/dependency_links.txt +0 -0
  57. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse.egg-info/entry_points.txt +0 -0
  58. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse.egg-info/not-zip-safe +0 -0
  59. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse.egg-info/requires.txt +0 -0
  60. {specpulse-1.1.0 → specpulse-1.2.1}/specpulse.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: specpulse
3
- Version: 1.1.0
3
+ Version: 1.2.1
4
4
  Summary: Specification-Driven Development Framework
5
5
  Home-page: https://github.com/specpulse
6
6
  Author: SpecPulse
@@ -66,13 +66,13 @@ Dynamic: requires-python
66
66
 
67
67
  SpecPulse revolutionizes AI-assisted development by enforcing a **specification-first approach**. Instead of jumping straight into code, SpecPulse ensures every feature starts with clear specifications, validated plans, and tracked tasks - guaranteeing quality from day one.
68
68
 
69
- > **Latest Update (v1.1.0)**:
70
- > - 🔧 **Command Prefix System**: All commands now use `sp-` prefix to avoid conflicts
71
- > - 📋 **Multi-Spec Workflow**: Support for multiple specs/plans/tasks per feature
72
- > - 🗂️ **Versioned File System**: Automatic spec-001.md, plan-001.md, task-001.md naming
73
- > - 🎯 **Context Detection**: Automatic feature detection using git branches
74
- > - 🤖 **Enhanced AI Integration**: Improved manual workflow control
75
- > - **Improved Error Handling**: Better resource path resolution and script copying operations
69
+ > **Latest Update (v1.2.0)**:
70
+ > - 🔀 **Microservice Decomposition**: New `/sp-decompose` command to break large specs into services
71
+ > - 🏗️ **Service-Based Planning**: Automatic service-specific plans and integration plans
72
+ > - 📊 **Service Task Management**: Task prefixes per service (AUTH-T001, USER-T001, INT-T001)
73
+ > - 🎯 **Smart Workflow Detection**: Automatic monolithic vs decomposed architecture handling
74
+ > - 📝 **Rich Templates**: New templates for services, APIs, interfaces, and integration
75
+ > - 🔧 **Previous (v1.1.0)**: Command prefix system, multi-spec workflow, versioned files
76
76
 
77
77
  ### Why SpecPulse?
78
78
 
@@ -134,14 +134,19 @@ specpulse init --ai gemini
134
134
  /sp-spec create user login with OAuth2 and email/password
135
135
  # Or just: /sp-spec (for interactive mode)
136
136
 
137
+ # [NEW] Decompose large specs into microservices (optional)
138
+ /sp-decompose 001
139
+ # Creates service boundaries, API contracts, and interfaces
140
+
137
141
  # Generate implementation plan
138
142
  /sp-plan generate
139
- # Or: /sp-plan validate (to check existing plan)
143
+ # For decomposed: Creates service-specific plans + integration plan
144
+ # For monolithic: Creates single comprehensive plan
140
145
 
141
146
  # Break down into tasks
142
147
  /sp-task breakdown
143
- # Or: /sp-task update (to update task status)
144
- # Or: /sp-task status (to see progress)
148
+ # For decomposed: Creates AUTH-T001, USER-T001, INT-T001 tasks
149
+ # For monolithic: Creates T001, T002, T003 tasks
145
150
  ```
146
151
 
147
152
  ### Step 4: Validate & Ship
@@ -150,6 +155,13 @@ specpulse init --ai gemini
150
155
  # Validate everything
151
156
  specpulse validate
152
157
 
158
+ # [NEW] Decompose specifications
159
+ specpulse decompose 001
160
+ # Or with options:
161
+ specpulse decompose --microservices
162
+ specpulse decompose --apis
163
+ specpulse decompose --interfaces
164
+
153
165
  # Run diagnostics
154
166
  specpulse doctor
155
167
 
@@ -269,11 +281,13 @@ Claude and Gemini use slash commands that accept arguments via `$ARGUMENTS`:
269
281
  /sp-spec create OAuth2 login # Create specification with description
270
282
  /sp-spec update # Update existing specification
271
283
  /sp-spec validate # Validate specification completeness
272
- /sp-plan generate # Generate plan from specification
284
+ /sp-decompose 001 # [NEW] Decompose spec into microservices
285
+ /sp-plan generate # Generate plan(s) - detects decomposition
273
286
  /sp-plan validate # Validate plan against constitution
274
- /sp-task breakdown # Create task list from plan
287
+ /sp-task breakdown # Create task list(s) - per service if decomposed
275
288
  /sp-task update # Update task statuses
276
289
  /sp-task status # Show current progress
290
+ /sp-task execute AUTH-T001 # [NEW] Execute service-specific task
277
291
  ```
278
292
 
279
293
  **Behind the Scenes:**
@@ -309,6 +323,39 @@ Claude and Gemini use slash commands that accept arguments via `$ARGUMENTS`:
309
323
  | **Technical Debt** | Accumulates | **Tracked & Managed** |
310
324
  | **Documentation** | Often outdated | **Always current** |
311
325
 
326
+ ## 🎯 Microservice Decomposition (NEW)
327
+
328
+ For large, complex specifications, SpecPulse can automatically decompose them into microservices:
329
+
330
+ ```bash
331
+ # Decompose a specification
332
+ /sp-decompose 001
333
+ ```
334
+
335
+ This creates:
336
+ - **Service Boundaries**: Using Domain-Driven Design principles
337
+ - **API Contracts**: OpenAPI 3.0 specifications for each service
338
+ - **Interface Definitions**: TypeScript/Java/Go interfaces
339
+ - **Integration Map**: Service communication architecture
340
+ - **Migration Plan**: Strategy for breaking down monoliths
341
+
342
+ ### Workflow Adaptation
343
+
344
+ SpecPulse automatically adapts based on architecture:
345
+
346
+ **Monolithic Flow:**
347
+ ```
348
+ spec-001.md → plan-001.md → task-001.md (T001, T002...)
349
+ ```
350
+
351
+ **Decomposed Flow:**
352
+ ```
353
+ spec-001.md → decomposition/ → service plans → service tasks
354
+ ├── microservices.md ├── auth-service-plan.md ├── AUTH-T001
355
+ ├── api-contracts/ ├── user-service-plan.md ├── USER-T001
356
+ └── interfaces/ └── integration-plan.md └── INT-T001
357
+ ```
358
+
312
359
  ## 🏗️ Project Structure
313
360
 
314
361
  ```
@@ -325,13 +372,25 @@ my-project/
325
372
  │ └── decisions.md # Architecture Decision Records
326
373
  ├── specs/ # Feature specifications
327
374
  │ └── 001-feature/
328
- └── spec-001.md
375
+ ├── spec-001.md
376
+ │ └── decomposition/ # [NEW] Microservice decomposition
377
+ │ ├── microservices.md
378
+ │ ├── api-contracts/
379
+ │ └── interfaces/
329
380
  ├── plans/ # Implementation plans
330
381
  │ └── 001-feature/
331
- └── plan-001.md
382
+ ├── plan-001.md # Monolithic plan
383
+ │ # OR for decomposed:
384
+ │ ├── auth-service-plan.md
385
+ │ ├── user-service-plan.md
386
+ │ └── integration-plan.md
332
387
  ├── tasks/ # Task breakdowns
333
388
  │ └── 001-feature/
334
- └── task-001.md
389
+ ├── task-001.md # Monolithic tasks
390
+ │ # OR for decomposed:
391
+ │ ├── auth-service-tasks.md
392
+ │ ├── user-service-tasks.md
393
+ │ └── integration-tasks.md
335
394
  ├── templates/ # Customizable templates
336
395
  ├── scripts/ # Shell scripts for AI execution
337
396
  │ ├── sp-pulse-init.sh # Feature initialization
@@ -21,13 +21,13 @@
21
21
 
22
22
  SpecPulse revolutionizes AI-assisted development by enforcing a **specification-first approach**. Instead of jumping straight into code, SpecPulse ensures every feature starts with clear specifications, validated plans, and tracked tasks - guaranteeing quality from day one.
23
23
 
24
- > **Latest Update (v1.1.0)**:
25
- > - 🔧 **Command Prefix System**: All commands now use `sp-` prefix to avoid conflicts
26
- > - 📋 **Multi-Spec Workflow**: Support for multiple specs/plans/tasks per feature
27
- > - 🗂️ **Versioned File System**: Automatic spec-001.md, plan-001.md, task-001.md naming
28
- > - 🎯 **Context Detection**: Automatic feature detection using git branches
29
- > - 🤖 **Enhanced AI Integration**: Improved manual workflow control
30
- > - **Improved Error Handling**: Better resource path resolution and script copying operations
24
+ > **Latest Update (v1.2.0)**:
25
+ > - 🔀 **Microservice Decomposition**: New `/sp-decompose` command to break large specs into services
26
+ > - 🏗️ **Service-Based Planning**: Automatic service-specific plans and integration plans
27
+ > - 📊 **Service Task Management**: Task prefixes per service (AUTH-T001, USER-T001, INT-T001)
28
+ > - 🎯 **Smart Workflow Detection**: Automatic monolithic vs decomposed architecture handling
29
+ > - 📝 **Rich Templates**: New templates for services, APIs, interfaces, and integration
30
+ > - 🔧 **Previous (v1.1.0)**: Command prefix system, multi-spec workflow, versioned files
31
31
 
32
32
  ### Why SpecPulse?
33
33
 
@@ -89,14 +89,19 @@ specpulse init --ai gemini
89
89
  /sp-spec create user login with OAuth2 and email/password
90
90
  # Or just: /sp-spec (for interactive mode)
91
91
 
92
+ # [NEW] Decompose large specs into microservices (optional)
93
+ /sp-decompose 001
94
+ # Creates service boundaries, API contracts, and interfaces
95
+
92
96
  # Generate implementation plan
93
97
  /sp-plan generate
94
- # Or: /sp-plan validate (to check existing plan)
98
+ # For decomposed: Creates service-specific plans + integration plan
99
+ # For monolithic: Creates single comprehensive plan
95
100
 
96
101
  # Break down into tasks
97
102
  /sp-task breakdown
98
- # Or: /sp-task update (to update task status)
99
- # Or: /sp-task status (to see progress)
103
+ # For decomposed: Creates AUTH-T001, USER-T001, INT-T001 tasks
104
+ # For monolithic: Creates T001, T002, T003 tasks
100
105
  ```
101
106
 
102
107
  ### Step 4: Validate & Ship
@@ -105,6 +110,13 @@ specpulse init --ai gemini
105
110
  # Validate everything
106
111
  specpulse validate
107
112
 
113
+ # [NEW] Decompose specifications
114
+ specpulse decompose 001
115
+ # Or with options:
116
+ specpulse decompose --microservices
117
+ specpulse decompose --apis
118
+ specpulse decompose --interfaces
119
+
108
120
  # Run diagnostics
109
121
  specpulse doctor
110
122
 
@@ -224,11 +236,13 @@ Claude and Gemini use slash commands that accept arguments via `$ARGUMENTS`:
224
236
  /sp-spec create OAuth2 login # Create specification with description
225
237
  /sp-spec update # Update existing specification
226
238
  /sp-spec validate # Validate specification completeness
227
- /sp-plan generate # Generate plan from specification
239
+ /sp-decompose 001 # [NEW] Decompose spec into microservices
240
+ /sp-plan generate # Generate plan(s) - detects decomposition
228
241
  /sp-plan validate # Validate plan against constitution
229
- /sp-task breakdown # Create task list from plan
242
+ /sp-task breakdown # Create task list(s) - per service if decomposed
230
243
  /sp-task update # Update task statuses
231
244
  /sp-task status # Show current progress
245
+ /sp-task execute AUTH-T001 # [NEW] Execute service-specific task
232
246
  ```
233
247
 
234
248
  **Behind the Scenes:**
@@ -264,6 +278,39 @@ Claude and Gemini use slash commands that accept arguments via `$ARGUMENTS`:
264
278
  | **Technical Debt** | Accumulates | **Tracked & Managed** |
265
279
  | **Documentation** | Often outdated | **Always current** |
266
280
 
281
+ ## 🎯 Microservice Decomposition (NEW)
282
+
283
+ For large, complex specifications, SpecPulse can automatically decompose them into microservices:
284
+
285
+ ```bash
286
+ # Decompose a specification
287
+ /sp-decompose 001
288
+ ```
289
+
290
+ This creates:
291
+ - **Service Boundaries**: Using Domain-Driven Design principles
292
+ - **API Contracts**: OpenAPI 3.0 specifications for each service
293
+ - **Interface Definitions**: TypeScript/Java/Go interfaces
294
+ - **Integration Map**: Service communication architecture
295
+ - **Migration Plan**: Strategy for breaking down monoliths
296
+
297
+ ### Workflow Adaptation
298
+
299
+ SpecPulse automatically adapts based on architecture:
300
+
301
+ **Monolithic Flow:**
302
+ ```
303
+ spec-001.md → plan-001.md → task-001.md (T001, T002...)
304
+ ```
305
+
306
+ **Decomposed Flow:**
307
+ ```
308
+ spec-001.md → decomposition/ → service plans → service tasks
309
+ ├── microservices.md ├── auth-service-plan.md ├── AUTH-T001
310
+ ├── api-contracts/ ├── user-service-plan.md ├── USER-T001
311
+ └── interfaces/ └── integration-plan.md └── INT-T001
312
+ ```
313
+
267
314
  ## 🏗️ Project Structure
268
315
 
269
316
  ```
@@ -280,13 +327,25 @@ my-project/
280
327
  │ └── decisions.md # Architecture Decision Records
281
328
  ├── specs/ # Feature specifications
282
329
  │ └── 001-feature/
283
- └── spec-001.md
330
+ ├── spec-001.md
331
+ │ └── decomposition/ # [NEW] Microservice decomposition
332
+ │ ├── microservices.md
333
+ │ ├── api-contracts/
334
+ │ └── interfaces/
284
335
  ├── plans/ # Implementation plans
285
336
  │ └── 001-feature/
286
- └── plan-001.md
337
+ ├── plan-001.md # Monolithic plan
338
+ │ # OR for decomposed:
339
+ │ ├── auth-service-plan.md
340
+ │ ├── user-service-plan.md
341
+ │ └── integration-plan.md
287
342
  ├── tasks/ # Task breakdowns
288
343
  │ └── 001-feature/
289
- └── task-001.md
344
+ ├── task-001.md # Monolithic tasks
345
+ │ # OR for decomposed:
346
+ │ ├── auth-service-tasks.md
347
+ │ ├── user-service-tasks.md
348
+ │ └── integration-tasks.md
290
349
  ├── templates/ # Customizable templates
291
350
  ├── scripts/ # Shell scripts for AI execution
292
351
  │ ├── sp-pulse-init.sh # Feature initialization
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "specpulse"
7
- version = "1.1.0"
7
+ version = "1.2.1"
8
8
  description = "Specification-Driven Development Framework"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -81,11 +81,15 @@ packages = [
81
81
  "specpulse.resources.memory",
82
82
  "specpulse.resources.scripts",
83
83
  "specpulse.resources.templates",
84
+ "specpulse.resources.templates.decomposition",
84
85
  ]
85
86
 
86
87
  [tool.setuptools.package-data]
87
88
  specpulse = [
88
89
  "resources/templates/*.md",
90
+ "resources/templates/decomposition/*.md",
91
+ "resources/templates/decomposition/*.yaml",
92
+ "resources/templates/decomposition/*.ts",
89
93
  "resources/memory/*.md",
90
94
  "resources/scripts/*.sh",
91
95
  "resources/scripts/*.py",
@@ -11,7 +11,7 @@ long_description = (this_directory / "README.md").read_text(encoding="utf-8")
11
11
 
12
12
  setup(
13
13
  name="specpulse",
14
- version="1.1.0",
14
+ version="1.2.1",
15
15
  author="SpecPulse",
16
16
  author_email="",
17
17
  description="Next-Generation Specification-Driven Development Framework",
@@ -59,8 +59,12 @@ setup(
59
59
  package_data={
60
60
  "specpulse": [
61
61
  "resources/templates/*.md",
62
+ "resources/templates/decomposition/*.md",
63
+ "resources/templates/decomposition/*.yaml",
64
+ "resources/templates/decomposition/*.ts",
62
65
  "resources/memory/*.md",
63
66
  "resources/scripts/*.sh",
67
+ "resources/scripts/*.py",
64
68
  "resources/commands/claude/*.md",
65
69
  "resources/commands/gemini/*.toml",
66
70
  ],
@@ -291,9 +291,10 @@ This project uses SpecPulse for specification-driven development.
291
291
  1. Open in your AI assistant (Claude or Gemini)
292
292
  2. Use `/sp-pulse <feature>` to start a new feature
293
293
  3. Use `/sp-spec create` to generate specifications
294
- 4. Use `/sp-plan generate` to create implementation plans
295
- 5. Use `/sp-task breakdown` to create task lists
296
- 6. Use `/validate all` before implementation
294
+ 4. Use `/sp-decompose <spec-id>` to break down large specs
295
+ 5. Use `/sp-plan generate` to create implementation plans
296
+ 6. Use `/sp-task breakdown` to create task lists
297
+ 7. Use `/validate all` before implementation
297
298
 
298
299
  ## Project Structure
299
300
  - `specs/` - Feature specifications
@@ -306,6 +307,7 @@ This project uses SpecPulse for specification-driven development.
306
307
  ## Commands
307
308
  - `/sp-pulse <feature>` - Initialize new feature
308
309
  - `/sp-spec create <description>` - Create specification
310
+ - `/sp-decompose <spec-id>` - Decompose specs into microservices/APIs
309
311
  - `/sp-plan generate` - Generate implementation plan
310
312
  - `/sp-task breakdown` - Create task list
311
313
  - `/validate [component]` - Validate project
@@ -410,6 +412,206 @@ Generated with SpecPulse v1.0.0
410
412
 
411
413
  return all(r["status"] != "error" for r in results)
412
414
 
415
+ def decompose(self, spec_id: Optional[str] = None,
416
+ microservices: bool = False,
417
+ apis: bool = False,
418
+ interfaces: bool = False):
419
+ """Decompose large specifications into smaller components"""
420
+ self.console.show_banner(mini=True)
421
+ self.console.header("Specification Decomposition", style="bright_yellow")
422
+
423
+ project_path = Path.cwd()
424
+ specs_dir = project_path / "specs"
425
+
426
+ # Find target specification
427
+ if spec_id:
428
+ # Handle both "001" and "001-feature" formats
429
+ spec_id_num = spec_id.split('-')[0] if '-' in spec_id else spec_id
430
+ spec_dirs = list(specs_dir.glob(f"{spec_id_num}*"))
431
+ else:
432
+ # Try to detect from context or most recent
433
+ spec_dirs = sorted(specs_dir.glob("*"), reverse=True)
434
+
435
+ if not spec_dirs:
436
+ self.console.error("No specifications found. Run /sp-spec create first.")
437
+ return False
438
+
439
+ target_dir = spec_dirs[0]
440
+ spec_files = list(target_dir.glob("spec-*.md"))
441
+
442
+ if not spec_files:
443
+ self.console.error(f"No specification files found in {target_dir}")
444
+ return False
445
+
446
+ # Use most recent spec file
447
+ spec_file = sorted(spec_files)[-1]
448
+
449
+ self.console.info(f"Decomposing: {spec_file.name}")
450
+ self.console.spinner("Analyzing specification complexity")
451
+
452
+ # Create decomposition directory
453
+ decomp_dir = target_dir / "decomposition"
454
+ decomp_dir.mkdir(exist_ok=True)
455
+
456
+ # Determine what to generate
457
+ if not any([microservices, apis, interfaces]):
458
+ # Default to all
459
+ microservices = apis = interfaces = True
460
+
461
+ decomp_items = []
462
+
463
+ if microservices:
464
+ # Use template from SpecPulse core
465
+ ms_template = self.specpulse.get_decomposition_template("microservices")
466
+ ms_content = ms_template.replace("{{ feature_name }}", target_dir.name)
467
+ ms_content = ms_content.replace("{{ spec_id }}", target_dir.name.split('-')[0])
468
+ ms_content = ms_content.replace("{{ date }}", datetime.now().isoformat())
469
+ ms_content = ms_content.replace("{{ version }}", "1.0.0")
470
+
471
+ # Placeholder content for services (AI will fill this)
472
+ ms_content = ms_content.replace("{{ services }}", """### Authentication Service
473
+ - **Responsibility**: User identity and access control
474
+ - **Bounded Context**: Identity Management
475
+
476
+ ### User Management Service
477
+ - **Responsibility**: User profiles and preferences
478
+ - **Bounded Context**: User Domain""")
479
+
480
+ ms_content = ms_content.replace("{{ communication_patterns }}", """- REST APIs for synchronous
481
+ - Event Bus for asynchronous""")
482
+ ms_content = ms_content.replace("{{ data_boundaries }}", """- Each service owns its data
483
+ - No shared databases""")
484
+ ms_content = ms_content.replace("{{ integration_points }}", """- API Gateway
485
+ - Message Queue""")
486
+
487
+ # Simplified microservices content
488
+ ms_content = """# Microservice Decomposition
489
+
490
+ ## Services Identified
491
+
492
+ ### Authentication Service
493
+ - **Responsibility**: User identity and access control
494
+ - **Bounded Context**: Identity Management
495
+ - **Data Ownership**: users, sessions, tokens
496
+
497
+ ### User Management Service
498
+ - **Responsibility**: User profile and preferences
499
+ - **Bounded Context**: User Domain
500
+ - **Data Ownership**: profiles, preferences, settings
501
+
502
+ ## Communication Patterns
503
+ - Synchronous: REST APIs
504
+ - Asynchronous: Event Bus
505
+ - Hybrid: CQRS for read/write separation
506
+ """
507
+ with open(decomp_dir / "microservices.md", 'w', encoding='utf-8') as f:
508
+ f.write(ms_content)
509
+ decomp_items.append(("Microservices", "Generated"))
510
+
511
+ if apis:
512
+ # Generate API contracts using template
513
+ api_dir = decomp_dir / "api-contracts"
514
+ api_dir.mkdir(exist_ok=True)
515
+
516
+ # Use template from SpecPulse core
517
+ api_template = self.specpulse.get_decomposition_template("api")
518
+
519
+ # Basic API content (AI will expand this)
520
+ api_content = """openapi: 3.0.0
521
+ info:
522
+ title: Authentication Service API
523
+ version: 1.0.0
524
+ paths:
525
+ /api/v1/auth/login:
526
+ post:
527
+ summary: Authenticate user
528
+ requestBody:
529
+ required: true
530
+ content:
531
+ application/json:
532
+ schema:
533
+ type: object
534
+ properties:
535
+ username:
536
+ type: string
537
+ password:
538
+ type: string
539
+ responses:
540
+ 200:
541
+ description: Successful authentication
542
+ """
543
+ with open(api_dir / "auth-service.yaml", 'w', encoding='utf-8') as f:
544
+ f.write(api_content)
545
+ decomp_items.append(("API Contracts", "Generated"))
546
+
547
+ if interfaces:
548
+ # Generate interface specifications using template
549
+ iface_dir = decomp_dir / "interfaces"
550
+ iface_dir.mkdir(exist_ok=True)
551
+
552
+ # Use template from SpecPulse core
553
+ iface_template = self.specpulse.get_decomposition_template("interface")
554
+
555
+ # Basic interface content (AI will expand this)
556
+ iface_content = """// Authentication Service Interface
557
+ export interface IAuthenticationService {
558
+ authenticate(credentials: Credentials): Promise<AuthToken>;
559
+ validateToken(token: string): Promise<TokenValidation>;
560
+ refreshToken(refreshToken: string): Promise<AuthToken>;
561
+ revokeToken(token: string): Promise<void>;
562
+ }
563
+
564
+ export interface Credentials {
565
+ username: string;
566
+ password: string;
567
+ }
568
+
569
+ export interface AuthToken {
570
+ accessToken: string;
571
+ refreshToken: string;
572
+ expiresIn: number;
573
+ }
574
+ """
575
+ with open(iface_dir / "IAuthService.ts", 'w', encoding='utf-8') as f:
576
+ f.write(iface_content)
577
+ decomp_items.append(("Interfaces", "Generated"))
578
+
579
+ # Generate integration map
580
+ map_content = """# Integration Map
581
+
582
+ ## Service Communication
583
+
584
+ ```mermaid
585
+ graph LR
586
+ A[API Gateway] --> B[Auth Service]
587
+ A --> C[User Service]
588
+ B --> D[Session Store]
589
+ C --> E[Profile DB]
590
+ B -.->|Events| F[Event Bus]
591
+ C -.->|Events| F
592
+ ```
593
+
594
+ ## Data Flow
595
+ 1. Client → API Gateway
596
+ 2. Gateway → Authentication
597
+ 3. Auth → Session Store
598
+ 4. Success → User Service
599
+ 5. User → Profile Data
600
+ """
601
+ with open(decomp_dir / "integration-map.md", 'w', encoding='utf-8') as f:
602
+ f.write(map_content)
603
+ decomp_items.append(("Integration Map", "Created"))
604
+
605
+ import time
606
+ time.sleep(1) # Visual effect
607
+
608
+ # Display results
609
+ self.console.status_panel("Decomposition Complete", decomp_items)
610
+ self.console.animated_success(f"Specification decomposed into {len(decomp_items)} components")
611
+ self.console.info(f"Output: {decomp_dir}")
612
+
613
+ return True
614
+
413
615
  def sync(self):
414
616
  """Synchronize project state"""
415
617
  self.console.show_banner(mini=True)
@@ -560,6 +762,13 @@ def main():
560
762
  validate_parser.add_argument("--fix", action="store_true", help="Attempt to fix issues")
561
763
  validate_parser.add_argument("--verbose", action="store_true", help="Verbose output")
562
764
 
765
+ # Decompose command
766
+ decompose_parser = subparsers.add_parser("decompose", help="Decompose specifications into smaller components")
767
+ decompose_parser.add_argument("spec_id", nargs="?", help="Specification ID (e.g., 001 or 001-feature)")
768
+ decompose_parser.add_argument("--microservices", action="store_true", help="Generate microservice boundaries")
769
+ decompose_parser.add_argument("--apis", action="store_true", help="Generate API contracts")
770
+ decompose_parser.add_argument("--interfaces", action="store_true", help="Generate interface specifications")
771
+
563
772
  # Sync command
564
773
  sync_parser = subparsers.add_parser("sync", help="Synchronize project state")
565
774
 
@@ -582,6 +791,8 @@ def main():
582
791
  cli.update()
583
792
  elif args.command == "validate":
584
793
  cli.validate(args.component, args.fix, args.verbose)
794
+ elif args.command == "decompose":
795
+ cli.decompose(args.spec_id, args.microservices, args.apis, args.interfaces)
585
796
  elif args.command == "sync":
586
797
  cli.sync()
587
798
  elif args.command == "doctor":
@@ -537,6 +537,36 @@ Last Updated: [AI updates this automatically]
537
537
  - **[Term]**: [Definition]
538
538
  """
539
539
 
540
+ def get_decomposition_template(self, template_type: str = "microservices") -> str:
541
+ """Get decomposition template"""
542
+ template_map = {
543
+ "microservices": "microservices.md",
544
+ "api": "api-contract.yaml",
545
+ "interface": "interface.ts"
546
+ }
547
+
548
+ template_file = template_map.get(template_type, "microservices.md")
549
+ template_path = self.resources_dir / "templates" / "decomposition" / template_file
550
+
551
+ if template_path.exists():
552
+ with open(template_path, 'r', encoding='utf-8') as f:
553
+ return f.read()
554
+
555
+ # Fallback for microservices template
556
+ if template_type == "microservices":
557
+ return """# Microservice Decomposition: {{ feature_name }}
558
+
559
+ ## Service Boundaries
560
+ {{ services }}
561
+
562
+ ## Communication Patterns
563
+ {{ communication }}
564
+
565
+ ## Data Ownership
566
+ {{ data_boundaries }}
567
+ """
568
+ return ""
569
+
540
570
  def get_decisions_template(self) -> str:
541
571
  """Get architectural decisions template from file"""
542
572
  template_path = self.resources_dir / "memory" / "decisions.md"