@polymorphism-tech/morph-spec 4.21.0 → 5.0.1

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 (213) hide show
  1. package/CLAUDE.md +57 -71
  2. package/README.md +2 -2
  3. package/bin/morph-spec.js +224 -491
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/CLAUDE.md +55 -38
  8. package/framework/MORPH.md +244 -0
  9. package/framework/agents.json +127 -1183
  10. package/framework/commands/morph-apply.md +56 -240
  11. package/framework/commands/morph-archive.md +48 -85
  12. package/framework/commands/morph-preflight.md +7 -7
  13. package/framework/commands/morph-proposal.md +35 -191
  14. package/framework/commands/morph-status.md +19 -50
  15. package/framework/commands/morph-troubleshoot.md +2 -2
  16. package/framework/evals/rubrics/README.md +44 -0
  17. package/framework/evals/rubrics/architecture.md +46 -0
  18. package/framework/evals/rubrics/code-quality.md +50 -0
  19. package/framework/evals/rubrics/contracts.md +47 -0
  20. package/framework/evals/rubrics/test-coverage.md +50 -0
  21. package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
  22. package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
  23. package/framework/evals/suites/standard.yaml +5 -0
  24. package/framework/evals/trace-schema.md +67 -0
  25. package/framework/hooks/claude-code/core/README.md +3 -0
  26. package/framework/hooks/claude-code/core/denylist.json +14 -0
  27. package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
  28. package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
  29. package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
  30. package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
  31. package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
  32. package/framework/hooks/shared/phase-utils.js +20 -28
  33. package/framework/hooks/shared/state-reader.js +4 -5
  34. package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -210
  35. package/framework/phases.json +40 -114
  36. package/framework/rubrics/eval-rubric.json +66 -0
  37. package/framework/skills/README.md +39 -64
  38. package/framework/skills/core/README.md +3 -0
  39. package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
  40. package/framework/skills/core/morph-eval/SKILL.md +57 -0
  41. package/framework/skills/core/morph-implement/SKILL.md +83 -0
  42. package/framework/skills/core/morph-plan/SKILL.md +64 -0
  43. package/framework/skills/core/morph-review/SKILL.md +62 -0
  44. package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
  45. package/framework/skills/core/morph-standards/SKILL.md +49 -0
  46. package/framework/standards/STANDARDS.json +32 -0
  47. package/framework/standards/frontend/design-system/ai-image-generation.md +244 -0
  48. package/framework/standards/integration/mcp/mcp-tools.md +48 -0
  49. package/framework/templates/CLAUDE.md.core.guide.md +29 -0
  50. package/framework/templates/CLAUDE.md.core.template +22 -0
  51. package/framework/templates/REGISTRY.json +4 -4
  52. package/framework/workflows/configs/fast-track.json +5 -10
  53. package/framework/workflows/configs/full.json +4 -8
  54. package/framework/workflows/configs/quick.json +32 -0
  55. package/framework/workflows/configs/standard.json +57 -64
  56. package/package.json +7 -6
  57. package/src/commands/mcp/mcp-setup.js +58 -31
  58. package/src/commands/project/doctor.js +69 -70
  59. package/src/commands/project/init.js +26 -5
  60. package/src/commands/project/status.js +18 -19
  61. package/src/commands/state/approve.js +1 -1
  62. package/src/commands/validation/validate-feature.js +18 -112
  63. package/src/core/paths/output-schema.js +133 -151
  64. package/src/core/state/phase-state-machine.js +10 -24
  65. package/src/core/state/state-manager.js +17 -17
  66. package/src/core/workflows/workflow-detector.js +214 -31
  67. package/src/core/workflows/workflow-router.js +204 -0
  68. package/src/dashboard/app/pages/AgentMap.jsx +32 -33
  69. package/src/dashboard/app/pages/LiveState.jsx +1 -1
  70. package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
  71. package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
  72. package/src/dashboard/app/pages/Workflows.jsx +2 -2
  73. package/src/dashboard/scanner/agents-scanner.js +30 -35
  74. package/src/lib/agents/metrics-aggregator.js +1 -1
  75. package/src/lib/agents/output-collector.js +7 -8
  76. package/src/lib/context/context-builder.js +289 -0
  77. package/src/lib/detectors/claude-config-detector.js +19 -3
  78. package/src/lib/generators/context-generator.js +20 -42
  79. package/src/lib/generators/index.js +1 -0
  80. package/src/lib/generators/mandate-generator.js +512 -0
  81. package/src/lib/generators/metadata-extractor.js +1 -1
  82. package/src/lib/generators/recap-generator.js +3 -4
  83. package/src/lib/installers/mcp-installer.js +300 -92
  84. package/src/lib/phase-chain/phase-validator.js +36 -40
  85. package/src/lib/stack/stack-profile.js +74 -91
  86. package/src/lib/tasks/task-parser.js +1 -1
  87. package/src/lib/tasks/wave-resolver.js +353 -0
  88. package/src/lib/validators/checkpoint-persistence.js +2 -2
  89. package/src/lib/validators/content/cross-phase-validator.js +281 -0
  90. package/src/lib/validators/content/index.js +1 -0
  91. package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
  92. package/src/scripts/global-install.js +2 -27
  93. package/src/utils/agents-installer.js +224 -447
  94. package/src/utils/claude-settings-manager.js +57 -15
  95. package/src/utils/file-copier.js +1 -0
  96. package/src/utils/hooks-installer.js +15 -117
  97. package/src/utils/skills-installer.js +12 -18
  98. package/bin/detect-agents.js +0 -226
  99. package/bin/task-manager.js +0 -1036
  100. package/framework/agents/README.md +0 -13
  101. package/framework/agents/ai-agents/ai-system-architect.md +0 -194
  102. package/framework/agents/ai-agents/vector-search-expert.md +0 -247
  103. package/framework/agents/architecture/architecture-expert.md +0 -98
  104. package/framework/agents/architecture/morph-spec-architect.md +0 -66
  105. package/framework/agents/architecture/packages-validator.md +0 -89
  106. package/framework/agents/architecture/security-expert.md +0 -79
  107. package/framework/agents/architecture/seo-growth-hacker.md +0 -168
  108. package/framework/agents/architecture/standards-architect.md +0 -153
  109. package/framework/agents/backend/dotnet-senior.md +0 -163
  110. package/framework/agents/backend/ef-modeler.md +0 -119
  111. package/framework/agents/backend/hangfire-orchestrator.md +0 -133
  112. package/framework/agents/backend/ms-agent-expert.md +0 -55
  113. package/framework/agents/backend/neon-expert.md +0 -379
  114. package/framework/agents/frontend/css-specialist.md +0 -89
  115. package/framework/agents/frontend/design-system-validator.md +0 -100
  116. package/framework/agents/frontend/gsap-animator.md +0 -131
  117. package/framework/agents/frontend/nextjs-component-validator.md +0 -97
  118. package/framework/agents/frontend/nextjs-expert.md +0 -201
  119. package/framework/agents/frontend/ui-designer.md +0 -259
  120. package/framework/agents/infrastructure/infra-architect.md +0 -215
  121. package/framework/agents/integrations/asaas-financial.md +0 -138
  122. package/framework/agents/integrations/neon-auth.md +0 -151
  123. package/framework/agents/integrations/resend-email.md +0 -127
  124. package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
  125. package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
  126. package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
  127. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
  128. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
  129. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
  130. package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
  131. package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
  132. package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
  133. package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
  134. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
  135. package/framework/hooks/shared/compact-restore.js +0 -123
  136. package/framework/hooks/shared/dispatch-helpers.js +0 -147
  137. package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
  138. package/framework/hooks/shared/stale-task-reset.js +0 -57
  139. package/framework/hooks/shared/worktree-helpers.js +0 -75
  140. package/framework/skills/level-0-meta/README.md +0 -7
  141. package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
  142. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
  143. package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
  144. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
  145. package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
  146. package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
  147. package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
  148. package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
  149. package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
  150. package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
  151. package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
  152. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
  153. package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
  154. package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
  155. package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
  156. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -382
  157. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
  158. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
  159. package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
  160. package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
  161. package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
  162. package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
  163. package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
  164. package/framework/skills/level-1-workflows/README.md +0 -7
  165. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
  166. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
  167. package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
  168. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
  169. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
  170. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
  171. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -493
  172. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
  173. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -46
  174. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
  175. package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
  176. package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
  177. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
  178. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
  179. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
  180. package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
  181. package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
  182. package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
  183. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -788
  184. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
  185. package/framework/squad-templates/backend-only.json +0 -47
  186. package/framework/squad-templates/frontend-only.json +0 -56
  187. package/framework/squad-templates/full-stack.json +0 -74
  188. package/src/commands/agents/agent-metrics.js +0 -174
  189. package/src/commands/agents/audit-dispatch.js +0 -82
  190. package/src/commands/agents/detect-agents.js +0 -275
  191. package/src/commands/agents/dispatch-agents.js +0 -461
  192. package/src/commands/agents/index.js +0 -13
  193. package/src/commands/agents/manage-agents.js +0 -352
  194. package/src/commands/agents/project-metrics.js +0 -74
  195. package/src/commands/phase/phase-reset.js +0 -74
  196. package/src/commands/scope/escalate.js +0 -217
  197. package/src/commands/state/advance-phase.js +0 -600
  198. package/src/commands/state/phase-runner.js +0 -215
  199. package/src/commands/state/state.js +0 -444
  200. package/src/commands/task/expand.js +0 -100
  201. package/src/commands/tasks/index.js +0 -4
  202. package/src/commands/tasks/task.js +0 -105
  203. package/src/commands/templates/index.js +0 -5
  204. package/src/commands/templates/template-render.js +0 -93
  205. package/src/commands/trust/trust.js +0 -118
  206. package/src/lib/agents/agents-manager.js +0 -349
  207. package/src/lib/build/build-runner.js +0 -99
  208. package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
  209. package/src/lib/contracts/sprint-contract-generator.js +0 -137
  210. package/src/lib/scope/impact-analyzer.js +0 -106
  211. package/src/lib/trust/trust-manager.js +0 -157
  212. package/src/utils/tier-helpers.js +0 -24
  213. /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
@@ -1,132 +0,0 @@
1
- # Feature Recap: Photo Processing Pipeline
2
-
3
- > Example of a well-structured recap.md. Filled-in reference — not a template.
4
-
5
- ## Summary
6
-
7
- | Field | Value |
8
- |-------|-------|
9
- | **Feature ID** | photo-processing |
10
- | **Completed** | 2025-01-22 |
11
- | **Total Tasks** | 11 / 11 |
12
- | **Time Spent** | ~9h |
13
- | **Agents Used** | dotnet-senior, nextjs-expert, infra-architect |
14
- | **Stack** | blazor-azure |
15
-
16
- ---
17
-
18
- ## Tasks Completed
19
-
20
- | ID | Title | Category | Duration |
21
- |----|-------|----------|----------|
22
- | T001 | Define C# contracts and interfaces | Contract | 25min |
23
- | T002 | Create ProcessingJob entity and enum | Domain | 30min |
24
- | T003 | EF Core migration and DbContext setup | Infrastructure | 50min |
25
- | T004 | Azure Blob Storage service | Infrastructure | 45min |
26
- | T005 | Implement PhotoProcessingService | Service | 65min |
27
- | T006 | Implement Hangfire background job | Job | 70min |
28
- | T007 | Upload and status endpoints | API | 40min |
29
- | T008 | Blazor upload page component | UI | 60min |
30
- | T009 | Blazor status polling page | UI | 65min |
31
- | T010 | Unit tests for PhotoProcessingService | Test | 55min |
32
- | T011 | Integration tests for upload + status API | Test | 70min |
33
-
34
- ---
35
-
36
- ## What Was Delivered
37
-
38
- ### Functionality
39
- - Photo upload via Blazor form (10MB limit, .jpg/.png only)
40
- - Azure Blob Storage integration with `uploads/{jobId}/original.jpg` path structure
41
- - Hangfire background job with 3-retry exponential backoff (5s/30s/120s)
42
- - Real-time status polling page (5s interval, stops on terminal state)
43
- - Download redirect for completed jobs
44
-
45
- ### Backend (.NET)
46
- - Endpoints: `POST /api/upload`, `GET /api/status/{id}`, `GET /api/download/{id}`
47
- - Services: `PhotoProcessingService`, `PhotoProcessingJob`
48
- - Simulation: `FakeBlobStorageService`, `FakePhotoProcessingJob` for dev mode
49
-
50
- ### Frontend (Blazor)
51
- - Pages: `Upload.razor`, `ProcessingStatus.razor`
52
- - Polling via `PeriodicTimer` — no SignalR dependency
53
-
54
- ---
55
-
56
- ## Files Created
57
-
58
- ```
59
- src/Domain/Entities/ProcessingJob.cs
60
- src/Domain/Enums/ProcessingStatus.cs
61
- src/Application/PhotoProcessing/Interfaces/IPhotoProcessingService.cs
62
- src/Application/PhotoProcessing/Commands/UploadPhotoCommand.cs
63
- src/Application/PhotoProcessing/Queries/GetJobStatusQuery.cs
64
- src/Application/PhotoProcessing/DTOs/JobStatusDto.cs
65
- src/Application/PhotoProcessing/PhotoProcessingService.cs
66
- src/Application/PhotoProcessing/PhotoProcessingJob.cs
67
- src/Application/PhotoProcessing/FakePhotoProcessingJob.cs
68
- src/Infrastructure/Storage/IBlobStorageService.cs
69
- src/Infrastructure/Storage/AzureBlobStorageService.cs
70
- src/Infrastructure/Storage/FakeBlobStorageService.cs
71
- src/Infrastructure/Persistence/Configurations/ProcessingJobConfiguration.cs
72
- src/Web/Endpoints/PhotoProcessingEndpoints.cs
73
- src/Web/Pages/Upload.razor + .cs
74
- src/Web/Pages/ProcessingStatus.razor + .cs
75
- tests/Unit/Application/PhotoProcessing/PhotoProcessingServiceTests.cs
76
- tests/Integration/Api/PhotoProcessingEndpointTests.cs
77
- tests/Integration/Fixtures/PhotoProcessingApiFixture.cs
78
- ```
79
-
80
- ## Files Modified
81
-
82
- ```
83
- src/Infrastructure/Persistence/AppDbContext.cs
84
- src/Infrastructure/DependencyInjection.cs
85
- src/Application/DependencyInjection.cs
86
- src/Web/Program.cs
87
- ```
88
-
89
- ---
90
-
91
- ## Architecture Decisions
92
-
93
- | Decision | Rationale |
94
- |----------|-----------|
95
- | PeriodicTimer for polling (not SignalR) | Simpler, no hub overhead, sufficient at MVP scale |
96
- | FakeBlobStorageService as Singleton | Stores in-memory dict; Scoped would lose state between requests |
97
- | Hangfire RetryCount on entity (not Hangfire built-in) | Domain owns retry state; allows custom error messages per attempt |
98
-
99
- See full ADRs in `decisions.md`
100
-
101
- ---
102
-
103
- ## Test Coverage
104
-
105
- | Type | Files | Notes |
106
- |------|-------|-------|
107
- | Unit | `PhotoProcessingServiceTests.cs` | Happy path, invalid type, size limit, 404, all statuses |
108
- | Integration | `PhotoProcessingEndpointTests.cs` | POST /upload, GET /status, GET /download (completed + pending) |
109
-
110
- ---
111
-
112
- ## Issues Encountered
113
-
114
- | Issue | Resolution |
115
- |-------|-----------|
116
- | `FakeBlobStorageService` registered as `Scoped` — lost uploads between requests | Changed to `Singleton` per simulation-checklist.md |
117
- | `PeriodicTimer` not stopping on component dispose | Added `CancellationTokenSource` + dispose pattern in `ProcessingStatus.razor.cs` |
118
-
119
- ---
120
-
121
- ## Metrics
122
-
123
- | Metric | Value |
124
- |--------|-------|
125
- | Tasks Completed | 11 / 11 |
126
- | Checkpoints Passed | 3 (after T003, T006, T009) |
127
- | Bugs Found | 2 |
128
- | Bugs Fixed | 2 |
129
-
130
- ---
131
-
132
- *MORPH-SPEC by Polymorphism Tech*
@@ -1,92 +0,0 @@
1
- # VSA Implementation Guide
2
-
3
- > Guia completo de implementação para Vertical Slice Architecture.
4
- > Referenciado pelo Passo 1.5 de `phase-implement/SKILL.md`.
5
- > **Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
6
-
7
- ---
8
-
9
- ## Estrutura de Arquivos Obrigatória por Slice
10
-
11
- ```
12
- Features/
13
- └── {Entity}Feature/
14
- ├── {Entity}Errors.cs ← 1 arquivo por feature (compartilhado)
15
- ├── Create{Entity}/
16
- │ ├── Create{Entity}Handler.cs ← Request + Response records + Handler
17
- │ ├── Create{Entity}Validator.cs ← AbstractValidator<Request>
18
- │ └── Create{Entity}Endpoint.cs ← IApiEndpoint (internal sealed)
19
- ├── GetAll{Entity}s/
20
- │ ├── GetAll{Entity}sHandler.cs ← sem Validator (sem parâmetros)
21
- │ └── GetAll{Entity}sEndpoint.cs
22
- ├── Get{Entity}ById/
23
- │ ├── Get{Entity}ByIdHandler.cs
24
- │ ├── Get{Entity}ByIdValidator.cs
25
- │ └── Get{Entity}ByIdEndpoint.cs
26
- ├── Update{Entity}/
27
- │ ├── Update{Entity}Handler.cs
28
- │ ├── Update{Entity}Validator.cs
29
- │ └── Update{Entity}Endpoint.cs
30
- └── Delete{Entity}/
31
- ├── Delete{Entity}Handler.cs
32
- ├── Delete{Entity}Validator.cs
33
- └── Delete{Entity}Endpoint.cs
34
- ```
35
-
36
- ---
37
-
38
- ## 9 Regras Obrigatórias por Slice
39
-
40
- 1. `Request` e `Response` records ficam no **mesmo arquivo** que o `Handler`
41
- 2. Tudo `sealed` — handlers, endpoints, validators, records
42
- 3. `Guid.CreateVersion7()` para gerar IDs (não `Guid.NewGuid()`)
43
- 4. Endpoints usam `result.Match(onSuccess, onFailure)` — nunca acesse `result.Value` sem checar `IsSuccess`
44
- 5. Endpoints são `internal sealed` (não public)
45
- 6. `{Entity}Errors` é static e compartilhado entre todos os slices da feature
46
- 7. Handlers de escrita (Create/Update/Delete) injetam `IRepository<T>` + `IUnitOfWork`
47
- 8. Handlers de leitura (GetAll/GetById) injetam apenas `IRepository<T>`
48
- 9. GetAll não tem Validator
49
-
50
- ---
51
-
52
- ## Registrar Entidade no DbContext
53
-
54
- ```csharp
55
- // Database/ApplicationDbContext.cs — adicionar:
56
- public DbSet<{Entity}> {Entities} { get; set; } = null!;
57
- ```
58
-
59
- ---
60
-
61
- ## Criar Migration Após DbContext Atualizado
62
-
63
- ```bash
64
- dotnet ef migrations add Add{Entity}
65
- dotnet ef database update
66
- ```
67
-
68
- ---
69
-
70
- ## Registrar Tag em ApiTags (se necessário)
71
-
72
- ```csharp
73
- // Constants/ApiTags.cs — adicionar:
74
- public const string {Entities} = "{entities}";
75
- ```
76
-
77
- ---
78
-
79
- ## O que NÃO Precisa Fazer (auto-discovery via reflection)
80
-
81
- - ❌ Registrar handler manualmente no Program.cs — `AddHandlersFromAssembly()` faz isso
82
- - ❌ Registrar endpoint manualmente — `RegisterApiEndpointsFromAssembly()` faz isso
83
- - ❌ Registrar validator manualmente — `AddValidatorsFromAssembly()` faz isso
84
- - ❌ Criar Application Service layer — handler acessa IRepository diretamente
85
-
86
- ---
87
-
88
- ## Verificar Build Após Cada Slice
89
-
90
- ```bash
91
- dotnet build
92
- ```
@@ -1,257 +0,0 @@
1
- ---
2
- name: morph-phase-plan
3
- description: MORPH-SPEC Phase 3 (Plan). Generates a detailed implementation plan with exact file paths, TDD code blocks, and execution strategy analysis. Produces plan.md in 3-plan/. Use after design phase to create an actionable implementation plan before task breakdown.
4
- argument-hint: "[feature-name]"
5
- user-invocable: false
6
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.21.0"
8
- ---
9
-
10
- # MORPH Plan — Phase 3
11
-
12
- > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
13
-
14
- Generate a detailed implementation plan with exact paths, TDD code, and execution strategy.
15
-
16
- ## Prerequisites
17
-
18
- - [ ] Phase 2 (Design) completed and approved
19
- - [ ] `spec.md` defined
20
- - [ ] `contracts.cs` or `contracts.ts` defined
21
-
22
- ## Recommended Tools
23
-
24
- > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
25
-
26
- | Action | Tool | Alternative |
27
- |--------|------|-------------|
28
- | Read spec + contracts + decisions | **Read** all outputs | — |
29
- | Analyze existing codebase | **Glob** + **Grep** patterns | — |
30
- | Look up library docs | **Context7 MCP** `query_docs()` | **WebSearch** |
31
- | Dispatch agents for analysis | **Bash** `morph-spec dispatch-agents $ARGUMENTS plan` | — |
32
- | Update state | **Bash** `morph-spec state mark-output $ARGUMENTS plan` | — |
33
-
34
- **Anti-patterns:**
35
- - Generating plan without reading contracts (contracts are the source of truth!)
36
- - Generic paths ("add the file") — always use exact paths
37
- - Incomplete code in plan ("add validation") — always include complete code
38
- - Skipping existing codebase analysis (existing patterns guide the plan)
39
- - Ignoring `config.architecture.style` — VSA and standard architectures have different structures
40
-
41
- ---
42
-
43
- ## Pre-flight
44
-
45
- ### 0. Ensure plan phase
46
-
47
- ```bash
48
- morph-spec state get $ARGUMENTS
49
- ```
50
-
51
- Check the `"phase"` field:
52
- - `"phase": "plan"` → correct phase, proceed
53
- - any other value → run `morph-spec phase advance $ARGUMENTS` and re-check
54
-
55
- > **Rule:** Never write to `3-plan/` until the phase is `plan`.
56
-
57
- ## MANDATORY: Session Tasks
58
-
59
- > **BEFORE reading any files**, analyze the planning workflow and create session tasks.
60
- >
61
- > **Rules:** Minimum 2 tasks, typically 3-5. Mark `in_progress` before starting, `completed` after.
62
- >
63
- > **Typical tasks:** feature analysis, execution strategy, plan.md generation, plan approval
64
-
65
- ### 1. Read all prerequisites in PARALLEL
66
-
67
- ```
68
- Read: .morph/features/{feature}/2-design/spec.md
69
- + Read: .morph/features/{feature}/2-design/contracts.cs (or contracts.ts)
70
- + Read: .morph/features/{feature}/2-design/decisions.md
71
- + Read: .morph/features/{feature}/2-design/decisions.md
72
- + Read: .morph/features/{feature}/2-design/schema-analysis.md (if exists)
73
- + Read: .morph/config/config.json
74
- ```
75
-
76
- ---
77
-
78
- ## Workflow
79
-
80
- ### Step 1: Analyze Feature for Context
81
-
82
- 1. **Scan existing codebase** — Glob to find files that will be modified/created
83
- 2. **Identify patterns** — Grep for patterns similar to what will be implemented
84
- 3. **Check library docs** — Context7 for dependency documentation
85
- 4. **Detect architecture:**
86
-
87
- ```bash
88
- cat .morph/config/config.json | grep -A3 '"architecture"'
89
- ```
90
-
91
- | `config.architecture.style` value | Path structure |
92
- |------------------------------------|---------------|
93
- | `"vertical-slice"` | VSA: `Features/{Entity}Feature/{Operation}/` |
94
- | any other value | Standard layer-based |
95
-
96
- ### Step 2: Determine Execution Strategy
97
-
98
- Run the dispatch analysis:
99
-
100
- ```bash
101
- morph-spec dispatch-agents $ARGUMENTS plan
102
- ```
103
-
104
- **Factors for recommendation:**
105
-
106
- | Factor | Calculation |
107
- |--------|-------------|
108
- | `taskCount` | Number of functional requirements + technical components in spec |
109
- | `domainCount` | Distinct domains in activeAgents (backend, frontend, infra) |
110
- | `agentCount` | Total activeAgents |
111
- | `independence` | % of tasks without cross-domain dependencies |
112
-
113
- **Decision:**
114
-
115
- | Scenario | Recommendation |
116
- |----------|----------------|
117
- | `taskCount < 8` AND `domainCount <= 2` | **Single session** — direct sequential implementation |
118
- | `taskCount 8-20` AND `domainCount 2-3` | **Subagent-Driven** — one subagent per task group |
119
- | `taskCount > 20` OR `domainCount > 3` | **Agent Teams** — multi-domain coordination |
120
-
121
- ### Step 3: Generate `plan.md`
122
-
123
- Create `.morph/features/$ARGUMENTS/3-plan/plan.md` with this structure:
124
-
125
- ```markdown
126
- # {Feature Name} Implementation Plan
127
-
128
- > **For Claude:** Use morph-phase-implement to execute this plan.
129
-
130
- **Goal:** {One sentence describing what will be built}
131
-
132
- **Architecture:** {2-3 sentences about the approach}
133
-
134
- **Tech Stack:** {Key technologies}
135
-
136
- **Execution Strategy:** {single | subagents | agent-teams} (Recommended)
137
-
138
- ---
139
-
140
- ## GROUP {A} — {Group Name}
141
-
142
- {Pattern and context for the group}
143
-
144
- ### {A1} — {Task Name} [FR001, FR003]
145
-
146
- **Spec refs:** FR001 (description), FR003 (description)
147
- **Contracts:** {RelevantRequest}, {RelevantResponse}, {ErrorType}
148
-
149
- **Files:**
150
- - Create: `exact/path/to/file.cs`
151
- - Modify: `exact/path/to/existing.cs:123-145`
152
- - Test: `tests/exact/path/to/test.cs`
153
-
154
- **Step 1: Write the failing test**
155
-
156
- (Complete test code)
157
-
158
- **Step 2: Run test to verify it fails**
159
-
160
- Run: `{exact command}`
161
- Expected: FAIL with "{message}"
162
-
163
- **Step 3: Write minimal implementation**
164
-
165
- (Complete implementation code)
166
-
167
- **Step 4: Run test to verify it passes**
168
-
169
- Run: `{exact command}`
170
- Expected: PASS
171
-
172
- **Step 5: Commit**
173
-
174
- git add {files}
175
- git commit -m "{message}"
176
- ```
177
-
178
- **Mandatory rules:**
179
- - **FR cross-references in EVERY task** — each task MUST reference the spec FRs it implements (e.g., `[FR001, FR003]`). Extract FR IDs from spec.md and map them to task groups. Include `Spec refs:` and `Contracts:` fields.
180
- - Exact paths ALWAYS (never "add the file somewhere")
181
- - COMPLETE code in each step (never "add validation later" or "implement here")
182
- - Exact test commands with expected output (pass/fail message)
183
- - Each task follows the TDD 5-step cycle above — this is what makes the plan actionable
184
- - Keep each step to a 2-5 minute action
185
-
186
- ### Step 4: Update State
187
-
188
- ```bash
189
- morph-spec state mark-output $ARGUMENTS plan
190
- ```
191
-
192
- ---
193
-
194
- ## Mandatory Approval Pause
195
-
196
- Use `AskUserQuestion` to capture approval before advancing. This gate prevents task breakdown from starting with an unapproved plan.
197
-
198
- ```json
199
- {
200
- "questions": [
201
- {
202
- "header": "Approval",
203
- "question": "Implementation plan generated. Approve to start task breakdown?",
204
- "multiSelect": false,
205
- "options": [
206
- { "label": "Approve plan", "description": "Advance to task breakdown phase" },
207
- { "label": "I have feedback", "description": "Type what you want to change" }
208
- ]
209
- },
210
- {
211
- "header": "Execution",
212
- "question": "Which execution strategy for implementation?",
213
- "multiSelect": false,
214
- "options": [
215
- { "label": "{Recommendation} (Recommended)", "description": "{Justification from Step 2 analysis}" },
216
- { "label": "{Alternative 1}", "description": "{Description}" },
217
- { "label": "{Alternative 2}", "description": "{Description}" }
218
- ]
219
- }
220
- ]
221
- }
222
- ```
223
-
224
- > The first "Execution" option should be the context-aware recommendation from Step 2. Alternatives are the other strategies.
225
-
226
- - **"Approve plan"** →
227
- ```bash
228
- morph-spec approve $ARGUMENTS plan
229
- morph-spec phase advance $ARGUMENTS
230
- ```
231
- - **"I have feedback" or "Other"** → apply the feedback and repeat this PAUSE
232
-
233
- ---
234
-
235
- ## Phase Outputs
236
-
237
- <!-- morph-outputs:plan -->
238
- | Output | Path |
239
- |--------|------|
240
- | `plan` | `.morph/features/{feature}/3-plan/plan.md` |
241
- <!-- /morph-outputs -->
242
-
243
- ---
244
-
245
- ## Advancement Criteria
246
-
247
- - [x] `plan.md` created with all groups and tasks
248
- - [x] Exact paths for all files
249
- - [x] Complete code in each step
250
- - [x] Test commands with expected output
251
- - [x] Execution strategy defined and approved
252
- - [x] State updated (`mark-output plan`)
253
- - [x] User approved plan via `AskUserQuestion`
254
-
255
- ---
256
-
257
- After approval: proceed automatically to Phase 5 (Tasks).
@@ -1,14 +0,0 @@
1
- {
2
- "sessionId": "",
3
- "feature": "",
4
- "phase": "",
5
- "hooks": [
6
- {
7
- "name": "set-terminal-title",
8
- "event": "UserPromptSubmit",
9
- "result": "failed",
10
- "ts": "16:38:44"
11
- }
12
- ],
13
- "skills": []
14
- }