@polymorphism-tech/morph-spec 2.3.0 → 3.0.0

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 (166) hide show
  1. package/CLAUDE.md +446 -1730
  2. package/README.md +515 -516
  3. package/bin/morph-spec.js +366 -294
  4. package/bin/task-manager.js +429 -368
  5. package/bin/validate.js +369 -268
  6. package/content/.claude/commands/morph-apply.md +221 -158
  7. package/content/.claude/commands/morph-deploy.md +529 -0
  8. package/content/.claude/commands/morph-preflight.md +227 -0
  9. package/content/.claude/commands/morph-proposal.md +122 -101
  10. package/content/.claude/commands/morph-status.md +86 -86
  11. package/content/.claude/commands/morph-troubleshoot.md +122 -0
  12. package/content/.claude/skills/infra/azure-deploy-specialist.md +699 -0
  13. package/content/.claude/skills/level-0-meta/README.md +7 -0
  14. package/content/.claude/skills/level-0-meta/code-review.md +226 -0
  15. package/content/.claude/skills/level-0-meta/morph-checklist.md +117 -0
  16. package/content/.claude/skills/level-0-meta/simulation-checklist.md +77 -0
  17. package/content/.claude/skills/level-1-workflows/README.md +7 -0
  18. package/content/.claude/skills/level-1-workflows/morph-replicate.md +213 -0
  19. package/content/.claude/{commands/morph-clarify.md → skills/level-1-workflows/phase-clarify.md} +131 -184
  20. package/content/.claude/{commands/morph-design.md → skills/level-1-workflows/phase-design.md} +213 -275
  21. package/content/.claude/skills/level-1-workflows/phase-setup.md +106 -0
  22. package/content/.claude/skills/level-1-workflows/phase-tasks.md +164 -0
  23. package/content/.claude/{commands/morph-uiux.md → skills/level-1-workflows/phase-uiux.md} +169 -211
  24. package/content/.claude/skills/level-2-domains/README.md +14 -0
  25. package/content/.claude/skills/level-2-domains/ai-agents/ai-system-architect.md +192 -0
  26. package/content/.claude/skills/{specialists → level-2-domains/architecture}/po-pm-advisor.md +197 -197
  27. package/content/.claude/skills/level-2-domains/architecture/standards-architect.md +156 -0
  28. package/content/.claude/skills/level-2-domains/backend/dotnet-senior.md +287 -0
  29. package/content/.claude/skills/level-2-domains/backend/ef-modeler.md +113 -0
  30. package/content/.claude/skills/level-2-domains/backend/hangfire-orchestrator.md +126 -0
  31. package/content/.claude/skills/level-2-domains/backend/ms-agent-expert.md +109 -0
  32. package/content/.claude/skills/level-2-domains/frontend/blazor-builder.md +210 -0
  33. package/content/.claude/skills/level-2-domains/frontend/nextjs-expert.md +154 -0
  34. package/content/.claude/skills/level-2-domains/frontend/ui-ux-designer.md +191 -0
  35. package/content/.claude/skills/{specialists → level-2-domains/infrastructure}/azure-architect.md +142 -142
  36. package/content/.claude/skills/level-2-domains/infrastructure/bicep-architect.md +126 -0
  37. package/content/.claude/skills/level-2-domains/infrastructure/container-specialist.md +131 -0
  38. package/content/.claude/skills/level-2-domains/infrastructure/devops-engineer.md +119 -0
  39. package/content/.claude/skills/level-2-domains/integrations/asaas-financial.md +130 -0
  40. package/content/.claude/skills/level-2-domains/integrations/azure-identity.md +142 -0
  41. package/content/.claude/skills/level-2-domains/integrations/clerk-auth.md +108 -0
  42. package/content/.claude/skills/level-2-domains/integrations/resend-email.md +119 -0
  43. package/content/.claude/skills/level-2-domains/quality/code-analyzer.md +235 -0
  44. package/content/.claude/skills/level-2-domains/quality/testing-specialist.md +126 -0
  45. package/content/.claude/skills/level-3-technologies/README.md +7 -0
  46. package/content/.claude/skills/level-4-patterns/README.md +7 -0
  47. package/content/.claude/skills/specialists/prompt-engineer.md +189 -0
  48. package/content/.claude/skills/specialists/seo-growth-hacker.md +320 -0
  49. package/content/.morph/config/agents.json +762 -242
  50. package/content/.morph/config/config.template.json +122 -108
  51. package/content/.morph/docs/workflows/design-impl.md +37 -0
  52. package/content/.morph/docs/workflows/enforcement-pipeline.md +668 -0
  53. package/content/.morph/docs/workflows/fast-track.md +29 -0
  54. package/content/.morph/docs/workflows/full-morph.md +76 -0
  55. package/content/.morph/docs/workflows/standard.md +44 -0
  56. package/content/.morph/docs/workflows/ui-refresh.md +39 -0
  57. package/content/.morph/examples/scheduled-reports/decisions.md +158 -0
  58. package/content/.morph/examples/scheduled-reports/proposal.md +95 -0
  59. package/content/.morph/examples/scheduled-reports/spec.md +267 -0
  60. package/content/.morph/hooks/README.md +348 -239
  61. package/content/.morph/hooks/pre-commit-agents.sh +24 -24
  62. package/content/.morph/hooks/task-completed.js +73 -0
  63. package/content/.morph/hooks/teammate-idle.js +68 -0
  64. package/content/.morph/schemas/tasks.schema.json +220 -0
  65. package/content/.morph/standards/agent-framework-blazor-ui.md +359 -0
  66. package/content/.morph/standards/agent-framework-production.md +410 -0
  67. package/content/.morph/standards/agent-framework-setup.md +413 -453
  68. package/content/.morph/standards/agent-framework-workflows.md +349 -0
  69. package/content/.morph/standards/agent-teams-workflow.md +474 -0
  70. package/content/.morph/standards/architecture.md +325 -325
  71. package/content/.morph/standards/azure.md +605 -379
  72. package/content/.morph/standards/dotnet10-migration.md +520 -494
  73. package/content/.morph/templates/CONTEXT-FEATURE.md +276 -0
  74. package/content/.morph/templates/CONTEXT.md +170 -0
  75. package/content/.morph/templates/agent.cs +163 -172
  76. package/content/.morph/templates/clarify-questions.md +159 -0
  77. package/content/.morph/templates/contracts/Commands.cs +74 -0
  78. package/content/.morph/templates/contracts/Entities.cs +25 -0
  79. package/content/.morph/templates/contracts/Queries.cs +74 -0
  80. package/content/.morph/templates/contracts/README.md +74 -0
  81. package/content/.morph/templates/decisions.md +123 -106
  82. package/content/.morph/templates/infra/azure-pipelines-deploy.yml +480 -0
  83. package/content/.morph/templates/infra/deploy-checklist.md +426 -0
  84. package/content/.morph/templates/proposal.md +141 -155
  85. package/content/.morph/templates/recap.md +94 -105
  86. package/content/.morph/templates/simulation.md +353 -0
  87. package/content/.morph/templates/spec.md +149 -148
  88. package/content/.morph/templates/state.template.json +222 -222
  89. package/content/.morph/templates/tasks.md +257 -235
  90. package/content/.morph/templates/ui-components.md +362 -276
  91. package/content/CLAUDE.md +150 -442
  92. package/detectors/structure-detector.js +245 -250
  93. package/docs/README.md +144 -149
  94. package/docs/getting-started.md +301 -302
  95. package/docs/installation.md +361 -361
  96. package/docs/validation-checklist.md +265 -266
  97. package/package.json +80 -80
  98. package/src/commands/advance-phase.js +266 -0
  99. package/src/commands/analyze-blazor-concurrency.js +193 -0
  100. package/src/commands/deploy.js +780 -0
  101. package/src/commands/detect-agents.js +167 -0
  102. package/src/commands/doctor.js +356 -280
  103. package/src/commands/generate-context.js +40 -0
  104. package/src/commands/init.js +258 -245
  105. package/src/commands/lint-fluent.js +352 -0
  106. package/src/commands/rollback-phase.js +185 -0
  107. package/src/commands/session-summary.js +291 -0
  108. package/src/commands/task.js +78 -75
  109. package/src/commands/troubleshoot.js +222 -0
  110. package/src/commands/update.js +192 -159
  111. package/src/commands/validate-blazor-state.js +210 -0
  112. package/src/commands/validate-blazor.js +156 -0
  113. package/src/commands/validate-css.js +84 -0
  114. package/src/commands/validate-phase.js +221 -0
  115. package/src/lib/blazor-concurrency-analyzer.js +288 -0
  116. package/src/lib/blazor-state-validator.js +291 -0
  117. package/src/lib/blazor-validator.js +374 -0
  118. package/src/lib/complexity-analyzer.js +441 -292
  119. package/src/lib/context-generator.js +513 -0
  120. package/src/lib/continuous-validator.js +421 -440
  121. package/src/lib/css-validator.js +352 -0
  122. package/src/lib/decision-constraint-loader.js +109 -0
  123. package/src/lib/design-system-detector.js +187 -0
  124. package/src/lib/design-system-scaffolder.js +299 -0
  125. package/src/lib/hook-executor.js +256 -0
  126. package/src/lib/recap-generator.js +205 -0
  127. package/src/lib/spec-validator.js +258 -0
  128. package/src/lib/standards-context-injector.js +287 -0
  129. package/src/lib/state-manager.js +397 -340
  130. package/src/lib/team-orchestrator.js +322 -0
  131. package/src/lib/troubleshoot-grep.js +194 -0
  132. package/src/lib/troubleshoot-index.js +144 -0
  133. package/src/lib/validation-runner.js +283 -0
  134. package/src/lib/validators/contract-compliance-validator.js +273 -0
  135. package/src/lib/validators/design-system-validator.js +231 -0
  136. package/src/utils/file-copier.js +187 -139
  137. package/content/.claude/commands/morph-costs.md +0 -206
  138. package/content/.claude/commands/morph-setup.md +0 -100
  139. package/content/.claude/commands/morph-tasks.md +0 -319
  140. package/content/.claude/skills/infra/bicep-architect.md +0 -419
  141. package/content/.claude/skills/infra/container-specialist.md +0 -437
  142. package/content/.claude/skills/infra/devops-engineer.md +0 -405
  143. package/content/.claude/skills/integrations/asaas-financial.md +0 -333
  144. package/content/.claude/skills/integrations/azure-identity.md +0 -309
  145. package/content/.claude/skills/integrations/clerk-auth.md +0 -290
  146. package/content/.claude/skills/specialists/ai-system-architect.md +0 -604
  147. package/content/.claude/skills/specialists/cost-guardian.md +0 -110
  148. package/content/.claude/skills/specialists/ef-modeler.md +0 -211
  149. package/content/.claude/skills/specialists/hangfire-orchestrator.md +0 -255
  150. package/content/.claude/skills/specialists/ms-agent-expert.md +0 -263
  151. package/content/.claude/skills/specialists/standards-architect.md +0 -78
  152. package/content/.claude/skills/specialists/ui-ux-designer.md +0 -1100
  153. package/content/.claude/skills/stacks/dotnet-blazor.md +0 -606
  154. package/content/.claude/skills/stacks/dotnet-nextjs.md +0 -402
  155. package/content/.claude/skills/stacks/shopify.md +0 -445
  156. package/content/.morph/config/azure-pricing.json +0 -70
  157. package/content/.morph/config/azure-pricing.schema.json +0 -50
  158. package/content/.morph/hooks/pre-commit-costs.sh +0 -91
  159. package/docs/api/cost-calculator.js.html +0 -513
  160. package/docs/api/design-system-generator.js.html +0 -382
  161. package/docs/api/global.html +0 -5263
  162. package/docs/api/index.html +0 -96
  163. package/docs/api/state-manager.js.html +0 -423
  164. package/src/commands/cost.js +0 -181
  165. package/src/commands/update-pricing.js +0 -206
  166. package/src/lib/cost-calculator.js +0 -429
@@ -1,206 +0,0 @@
1
- # /morph-costs - Cost Estimation and Reporting
2
-
3
- Estima e reporta custos de recursos Azure.
4
-
5
- ## Uso
6
-
7
- ```
8
- /morph-costs [action]
9
- ```
10
-
11
- ### Actions
12
-
13
- | Action | Descrição |
14
- |--------|-----------|
15
- | `estimate` | Estima custos da feature atual |
16
- | `report` | Gera relatório de custos do projeto |
17
- | `compare` | Compara custos entre ambientes |
18
-
19
- ---
20
-
21
- ## Workflow
22
-
23
- ### 1. ESTIMATE - Estimar Custos
24
-
25
- Quando o usuário solicitar `/morph-costs estimate`:
26
-
27
- 1. Ler spec.md da feature atual para identificar recursos
28
-
29
- 2. Para cada recurso Azure, calcular custo mensal:
30
-
31
- | Recurso | SKU | Custo/Mês |
32
- |---------|-----|-----------|
33
- | Container Apps | Consumption (scale-to-zero) | ~$0 |
34
- | Azure SQL | Free (32GB) | $0 |
35
- | Azure SQL | Basic (5 DTU) | ~$5 |
36
- | Storage | Standard LRS (1GB) | ~$0.02 |
37
- | Key Vault | Standard | ~$0.03/10k ops |
38
- | App Insights | Free (5GB/mês) | $0 |
39
- | Service Bus | Basic | ~$0.05 |
40
-
41
- 3. Apresentar estimativa:
42
- ```markdown
43
- ## Estimativa de Custos - {Feature}
44
-
45
- | Recurso | SKU | Custo/Mês |
46
- |---------|-----|-----------|
47
- | Container Apps | Consumption | ~$0 |
48
- | SQL Database | Free | $0 |
49
- | Storage | LRS 1GB | $0.02 |
50
- | **TOTAL** | | **$0.02/mês** |
51
-
52
- ### Aprovação
53
- ✅ Free tier - nenhuma aprovação necessária
54
- ```
55
-
56
- 4. Verificar contra limites do Cost Guardian:
57
- - Free tier apenas: ✅ Aprovado automaticamente
58
- - Até $10/mês: ⚠️ Requer confirmação
59
- - Acima de $10: ❌ Requer ADR
60
-
61
- ---
62
-
63
- ### 2. REPORT - Relatório de Custos
64
-
65
- Quando o usuário solicitar `/morph-costs report`:
66
-
67
- 1. Analisar todos os recursos definidos em `infra/`
68
-
69
- 2. Gerar relatório consolidado:
70
-
71
- ```markdown
72
- ## Relatório de Custos - {Projeto}
73
-
74
- ### Por Ambiente
75
-
76
- | Ambiente | Recursos | Custo/Mês |
77
- |----------|----------|-----------|
78
- | dev | 6 | ~$0 |
79
- | prod | 6 | ~$15 |
80
- | **Total** | | **~$15/mês** |
81
-
82
- ### Por Tipo de Recurso
83
-
84
- | Recurso | Dev | Prod |
85
- |---------|-----|------|
86
- | Container Apps | $0 | $5 |
87
- | SQL Database | $0 | $5 |
88
- | Storage | $0.02 | $2 |
89
- | Key Vault | $0 | $0.50 |
90
- | App Insights | $0 | $2.50 |
91
-
92
- ### Recomendações
93
- 1. ✅ Dev usa free tier corretamente
94
- 2. ⚠️ Considerar Reserved Capacity para prod (-30%)
95
- ```
96
-
97
- 3. Salvar relatório em `.morph/outputs/costs-report.md`
98
-
99
- ---
100
-
101
- ### 3. COMPARE - Comparar Ambientes
102
-
103
- Quando o usuário solicitar `/morph-costs compare`:
104
-
105
- 1. Analisar `parameters.dev.json` e `parameters.prod.json`
106
-
107
- 2. Gerar comparativo:
108
-
109
- ```markdown
110
- ## Comparativo de Custos
111
-
112
- | Recurso | Dev | Prod | Diferença |
113
- |---------|-----|------|-----------|
114
- | SQL SKU | Free | Basic | +$5 |
115
- | Storage SKU | LRS | GRS | +$1 |
116
- | Min Replicas | 0 | 1 | +$3 |
117
- | **Total** | $0 | $15 | +$15 |
118
-
119
- ### Por que prod custa mais?
120
- - SQL Basic: melhor performance, SLA 99.99%
121
- - Storage GRS: redundância geográfica
122
- - Min replicas 1: sem cold start
123
- ```
124
-
125
- ---
126
-
127
- ## Pricing Reference
128
-
129
- ### Free Tier Resources
130
-
131
- | Recurso | Limite Grátis |
132
- |---------|---------------|
133
- | Azure SQL | 32GB, 100k vCore seconds |
134
- | Container Apps | Scale-to-zero, 180k vCPU-sec |
135
- | Storage | 5GB LRS |
136
- | App Insights | 5GB/mês |
137
- | Cosmos DB | 1000 RU/s, 25GB |
138
- | Functions | 1M execuções |
139
-
140
- ### Costs by Region (Brazil South)
141
-
142
- | Recurso | SKU | Preço |
143
- |---------|-----|-------|
144
- | Container Apps | Consumption | $0.000012/vCPU-sec |
145
- | SQL | Basic | $4.99/mês |
146
- | SQL | S0 | $14.72/mês |
147
- | Storage | LRS | $0.0184/GB |
148
- | Storage | GRS | $0.046/GB |
149
-
150
- ---
151
-
152
- ## Cost Guardian Rules
153
-
154
- ### Aprovação Automática (Free Tier)
155
- - Container Apps com scale-to-zero
156
- - SQL Free tier
157
- - Storage Standard LRS até 5GB
158
- - App Insights free tier
159
-
160
- ### Requer Confirmação (até $10/mês)
161
- - SQL Basic
162
- - Storage adicional
163
- - Service Bus Basic
164
-
165
- ### Requer ADR (acima de $10/mês)
166
- - Recursos Premium
167
- - Multiple replicas
168
- - Reserved capacity
169
- - Qualquer recurso não essencial
170
-
171
- ---
172
-
173
- ## Exemplo de Uso
174
-
175
- ```
176
- Usuário: /morph-costs estimate
177
- Claude: Analisando feature "scheduled-reports"...
178
-
179
- ## Estimativa de Custos
180
-
181
- | Recurso | SKU | Custo/Mês |
182
- |---------|-----|-----------|
183
- | Container Apps | Consumption | ~$0 |
184
- | SQL Database | Free | $0 |
185
- | Storage | LRS 1GB | $0.02 |
186
- | Hangfire | In-process | $0 |
187
-
188
- **TOTAL: ~$0.02/mês**
189
-
190
- ✅ Dentro do free tier - aprovado automaticamente!
191
-
192
- Usuário: /morph-costs report
193
- Claude: ## Relatório de Custos - MyProject
194
-
195
- | Ambiente | Custo/Mês |
196
- |----------|-----------|
197
- | dev | $0.02 |
198
- | prod | $12.50 |
199
-
200
- ⚠️ Prod excede $10/mês.
201
- Deseja criar um ADR para justificar? (sim/não)
202
- ```
203
-
204
- ---
205
-
206
- *MORPH-SPEC by Polymorphism Tech*
@@ -1,100 +0,0 @@
1
- # MORPH Setup - FASE 1
2
-
3
- Inicialize o contexto e prepare o ambiente para uma feature aprovada.
4
-
5
- ## Uso
6
-
7
- ```
8
- /morph-setup {feature-name}
9
- ```
10
-
11
- ## Pré-requisitos
12
-
13
- - [ ] Feature tem `proposal.md` criado (FASE 0 concluída)
14
- - [ ] Proposal foi aprovado pelo usuário
15
- - [ ] Agentes foram detectados e registrados no state
16
-
17
- ## Workflow
18
-
19
- ### Passo 1: Verificar State
20
-
21
- Confirme que a feature existe no state:
22
-
23
- ```bash
24
- node bin/state-manager.js get {feature-name}
25
- ```
26
-
27
- Se não existir, volte para `/morph-proposal`.
28
-
29
- ### Passo 2: Carregar Contexto do Projeto
30
-
31
- Leia os seguintes arquivos para entender o projeto:
32
-
33
- 1. **Contexto geral**:
34
- - `.morph/project/context/README.md` - Overview do projeto
35
- - `.morph/config.json` - Configurações
36
-
37
- 2. **Standards do framework**:
38
- - `framework/standards/coding.md` - Padrões de código
39
- - `framework/standards/architecture.md` - Padrões de arquitetura
40
- - `framework/standards/azure.md` - Padrões Azure e IaC
41
-
42
- 3. **Standards do projeto** (sobrescrevem framework se existirem):
43
- - `.morph/project/standards/coding.md`
44
- - `.morph/project/standards/architecture.md`
45
- - `.morph/project/standards/inferred.md` - Standards detectados
46
-
47
- ### Passo 3: Confirmar Stack
48
-
49
- Baseado no proposal e contexto, confirme:
50
- - Stack tecnológica (Blazor Server, Next.js, Shopify, etc.)
51
- - Padrões arquiteturais aplicáveis
52
- - Componentes reutilizáveis existentes
53
-
54
- ### Passo 4: Listar Agentes Ativos
55
-
56
- Mostre os agentes detectados no proposal:
57
-
58
- ```bash
59
- node bin/state-manager.js get {feature-name}
60
- ```
61
-
62
- Parse o JSON e liste os `activeAgents` com seus emojis e responsabilidades (consulte `.morph/config/agents.json`).
63
-
64
- ### Passo 5: Atualizar State
65
-
66
- Marque a feature como na fase SETUP:
67
-
68
- ```bash
69
- node bin/state-manager.js set {feature-name} phase setup
70
- node bin/state-manager.js set {feature-name} status in_progress
71
- ```
72
-
73
- ## Outputs
74
-
75
- **Apresente ao usuário:**
76
-
77
- 1. **Contexto carregado**:
78
- - Nome do projeto
79
- - Stack confirmado
80
- - Standards aplicáveis
81
-
82
- 2. **Agentes ativos**:
83
- - Lista de agentes com emojis
84
- - Responsabilidades de cada um
85
-
86
- 3. **Próximos passos**:
87
- - Se feature tem UI/UX keywords → `/morph-uiux` (FASE 1.5)
88
- - Se NÃO tem UI/UX → `/morph-design` (FASE 2)
89
-
90
- ## Critérios de Avanço
91
-
92
- - [x] Contexto do projeto carregado
93
- - [x] Standards identificados (framework + project)
94
- - [x] Stack confirmado
95
- - [x] Agentes listados
96
- - [x] State atualizado para phase: setup
97
-
98
- ---
99
-
100
- **Feature:** $ARGUMENTS
@@ -1,319 +0,0 @@
1
- # MORPH Tasks - FASE 4
2
-
3
- Quebre a especificação em tasks executáveis, defina ordem de execução e estabeleça checkpoints.
4
-
5
- ## Uso
6
-
7
- ```
8
- /morph-tasks {feature-name}
9
- ```
10
-
11
- ## Pré-requisitos
12
-
13
- - [ ] FASE 3 (Clarify) concluída
14
- - [ ] `spec.md` atualizado com clarificações
15
- - [ ] Todos os edge cases documentados
16
-
17
- ## Workflow
18
-
19
- ### Passo 1: Analisar Spec
20
-
21
- Leia `.morph/project/outputs/{feature}/spec.md` e identifique:
22
-
23
- 1. **Requisitos funcionais** (FR001, FR002, ...)
24
- 2. **Componentes técnicos** (Entities, Services, Controllers, Pages)
25
- 3. **Infraestrutura** (Bicep, migrations, configs)
26
- 4. **Testes** (Unit tests, integration tests)
27
-
28
- ### Passo 2: Quebrar em Tasks
29
-
30
- Crie tasks no formato **T{NNN}** seguindo ordem lógica de implementação.
31
-
32
- #### 2.1. Estrutura de Task
33
-
34
- ```json
35
- {
36
- "id": "T001",
37
- "title": "Criar Entity {Nome}",
38
- "description": "Implementar entity {Nome} com propriedades X, Y, Z seguindo padrões EF Core",
39
- "category": "domain",
40
- "dependencies": [],
41
- "estimatedMinutes": 30,
42
- "status": "pending",
43
- "files": [
44
- "Domain/Entities/{Nome}.cs",
45
- "Infrastructure/Data/Configurations/{Nome}Configuration.cs"
46
- ]
47
- }
48
- ```
49
-
50
- #### 2.2. Categorias de Tasks
51
-
52
- | Categoria | Descrição | Exemplos |
53
- |-----------|-----------|----------|
54
- | **domain** | Entities, Value Objects, Enums | Entity, DomainException |
55
- | **application** | Services, DTOs, Interfaces | Service, Validator, Mapper |
56
- | **infrastructure** | DbContext, Repositories, External APIs | EF Config, Repository impl |
57
- | **presentation** | Controllers, Pages, Components | API endpoint, Blazor page |
58
- | **tests** | Unit tests, Integration tests | Service tests, API tests |
59
- | **infra** | Bicep, Migrations, Scripts | Azure resources, DB migration |
60
- | **docs** | README, API docs, Swagger | OpenAPI spec, README update |
61
-
62
- #### 2.3. Ordem de Implementação
63
-
64
- **Bottom-up approach:**
65
- ```
66
- 1. Domain (Entities, Enums, Value Objects)
67
-
68
- 2. Infrastructure (Repositories, DbContext configs)
69
-
70
- 3. Application (Services, DTOs, Business logic)
71
-
72
- 4. Presentation (Controllers, Pages, Components)
73
-
74
- 5. Tests (Unit → Integration)
75
-
76
- 6. Infra (Bicep, Migrations, Deploy scripts)
77
-
78
- 7. Docs (README, Swagger, Comments)
79
- ```
80
-
81
- ### Passo 3: Definir Dependências
82
-
83
- Para cada task, especifique dependências:
84
-
85
- ```json
86
- {
87
- "id": "T005",
88
- "title": "Criar {Nome}Service",
89
- "dependencies": ["T001", "T002"], // Precisa de Entities primeiro
90
- "status": "pending"
91
- }
92
- ```
93
-
94
- **Regra:** Task só pode ser executada quando todas as dependências estão `completed`.
95
-
96
- ### Passo 4: Estabelecer Checkpoints
97
-
98
- Defina checkpoints a cada **3 tasks** ou **marcos significativos**:
99
-
100
- ```json
101
- {
102
- "id": "CHECKPOINT_001",
103
- "title": "Domain Layer Completo",
104
- "afterTasks": ["T001", "T002", "T003"],
105
- "validations": [
106
- "Todas as entities criadas",
107
- "Migrations aplicadas",
108
- "Testes de domain passando"
109
- ]
110
- }
111
- ```
112
-
113
- **Checkpoints obrigatórios:**
114
- - Após domain layer
115
- - Após infrastructure layer
116
- - Após application layer
117
- - Após presentation layer
118
- - Antes de deploy (final)
119
-
120
- ### Passo 5: Estimar Esforço
121
-
122
- Para cada task, estime tempo em minutos:
123
-
124
- | Complexidade | Tempo Estimado |
125
- |--------------|----------------|
126
- | Trivial (CRUD básico) | 15-30 min |
127
- | Simples (Service, Controller) | 30-60 min |
128
- | Média (Business logic, validações) | 60-120 min |
129
- | Complexa (Integrações, AI) | 120-240 min |
130
-
131
- **Total:** Some todos os tempos para estimar esforço total da feature.
132
-
133
- ### Passo 6: Gerar `tasks.json`
134
-
135
- Crie `.morph/project/outputs/{feature}/tasks.json`:
136
-
137
- ```json
138
- {
139
- "feature": "{feature-name}",
140
- "totalTasks": 15,
141
- "estimatedHours": 8.5,
142
- "checkpoints": [
143
- {
144
- "id": "CHECKPOINT_001",
145
- "title": "Domain Layer Completo",
146
- "afterTasks": ["T001", "T002", "T003"]
147
- },
148
- {
149
- "id": "CHECKPOINT_002",
150
- "title": "Application Layer Completo",
151
- "afterTasks": ["T006", "T007", "T008"]
152
- }
153
- ],
154
- "tasks": [
155
- {
156
- "id": "T001",
157
- "title": "Criar Entity {Nome}",
158
- "description": "...",
159
- "category": "domain",
160
- "dependencies": [],
161
- "estimatedMinutes": 30,
162
- "status": "pending",
163
- "files": ["Domain/Entities/{Nome}.cs"]
164
- },
165
- {
166
- "id": "T002",
167
- "title": "Configurar EF para {Nome}",
168
- "description": "...",
169
- "category": "infrastructure",
170
- "dependencies": ["T001"],
171
- "estimatedMinutes": 20,
172
- "status": "pending",
173
- "files": ["Infrastructure/Data/Configurations/{Nome}Configuration.cs"]
174
- }
175
- // ... mais tasks
176
- ]
177
- }
178
- ```
179
-
180
- ### Passo 7: Incluir Tasks de IaC (se necessário)
181
-
182
- Se houver recursos Azure:
183
-
184
- ```json
185
- {
186
- "id": "T050",
187
- "title": "Criar Bicep para Azure SQL",
188
- "description": "Bicep module para Azure SQL Database Basic tier",
189
- "category": "infra",
190
- "dependencies": ["T001", "T002"], // Domain entities devem existir
191
- "estimatedMinutes": 45,
192
- "status": "pending",
193
- "files": [
194
- "infra/modules/sql-database.bicep",
195
- "infra/parameters.dev.json"
196
- ]
197
- },
198
- {
199
- "id": "T051",
200
- "title": "Criar migration inicial",
201
- "description": "EF Core migration com todas as entities",
202
- "category": "infra",
203
- "dependencies": ["T002", "T003"],
204
- "estimatedMinutes": 15,
205
- "status": "pending",
206
- "files": ["Infrastructure/Data/Migrations/"]
207
- }
208
- ```
209
-
210
- ### Passo 8: Atualizar State
211
-
212
- ```bash
213
- # Marcar fase como tasks
214
- node bin/state-manager.js set {feature-name} phase tasks
215
-
216
- # Definir total de tasks
217
- node bin/state-manager.js set {feature-name} tasks.total {N}
218
-
219
- # Marcar output tasks criado
220
- node bin/state-manager.js mark-output {feature-name} tasks
221
- ```
222
-
223
- ## Outputs Gerados
224
-
225
- - `.morph/project/outputs/{feature}/tasks.json` - Breakdown completo de tasks
226
-
227
- **Resumo em formato texto:**
228
-
229
- Gere também um resumo visual em `.morph/project/outputs/{feature}/tasks-summary.md`:
230
-
231
- ```markdown
232
- # Tasks Breakdown - {Feature Name}
233
-
234
- ## Overview
235
- - **Total Tasks:** 15
236
- - **Estimated Time:** 8.5 hours
237
- - **Checkpoints:** 3
238
-
239
- ## Tasks by Category
240
-
241
- ### Domain (3 tasks, 1.5h)
242
- - T001: Criar Entity {Nome} (30min)
243
- - T002: Configurar EF para {Nome} (20min)
244
- - T003: Criar Enum {Status} (15min)
245
-
246
- ### Infrastructure (4 tasks, 2h)
247
- - T004: Criar Repository interface (30min)
248
- - T005: Implementar Repository (60min)
249
- - ...
250
-
251
- ### Application (5 tasks, 3h)
252
- - T006: Criar {Nome}Service (90min)
253
- - T007: Criar DTOs (45min)
254
- - ...
255
-
256
- ### Presentation (3 tasks, 2h)
257
- - T010: Criar API Controller (60min)
258
- - T011: Criar Blazor Page (60min)
259
- - ...
260
-
261
- ## Checkpoints
262
-
263
- ### CHECKPOINT_001: Domain Layer Completo
264
- **After:** T001, T002, T003
265
- **Validations:**
266
- - [ ] Entities criadas
267
- - [ ] EF configurations ok
268
- - [ ] Compile sem erros
269
-
270
- ### CHECKPOINT_002: Application Layer Completo
271
- **After:** T006, T007, T008
272
- **Validations:**
273
- - [ ] Services implementados
274
- - [ ] DTOs validados
275
- - [ ] Testes unitários passando
276
-
277
- ## Execution Order
278
-
279
- ```
280
- T001 → T002 → T003 → CHECKPOINT_001
281
-
282
- T004 → T005
283
-
284
- T006 → T007 → T008 → CHECKPOINT_002
285
-
286
- T010 → T011 → T012
287
-
288
- T013 → T014 → T015 → CHECKPOINT_003
289
- ```
290
- ```
291
-
292
- ## ⛔ PAUSA OBRIGATÓRIA
293
-
294
- Apresente ao usuário 3 ações sugeridas:
295
-
296
- 1. ✅ **Aprovar breakdown e iniciar implementação**
297
- Prosseguir para `/morph-apply` (FASE 5)
298
-
299
- 2. 🔀 **Repriorizar tasks**
300
- Mudar ordem de execução se necessário
301
-
302
- 3. ➕ **Adicionar/remover tasks**
303
- Ajustar escopo se alguma task foi esquecida ou é desnecessária
304
-
305
- ## Critérios de Avanço
306
-
307
- - [x] `tasks.json` criado com todas as tasks
308
- - [x] Tasks categorizadas corretamente
309
- - [x] Dependências mapeadas
310
- - [x] Checkpoints definidos (a cada 3 tasks)
311
- - [x] Esforço estimado por task
312
- - [x] Ordem de execução clara
313
- - [x] Tasks de IaC incluídas (se aplicável)
314
- - [x] State atualizado com total de tasks
315
- - [x] Usuário aprovou breakdown
316
-
317
- ---
318
-
319
- **Feature:** $ARGUMENTS