@polymorphism-tech/morph-spec 4.9.0 → 4.10.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 (164) hide show
  1. package/README.md +2 -2
  2. package/bin/morph-spec.js +30 -0
  3. package/bin/task-manager.js +34 -22
  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 +35 -98
  8. package/framework/agents/backend/api-designer.md +3 -0
  9. package/framework/agents/backend/dotnet-senior.md +3 -0
  10. package/framework/agents/backend/ef-modeler.md +2 -0
  11. package/framework/agents/backend/hangfire-orchestrator.md +2 -0
  12. package/framework/agents/backend/ms-agent-expert.md +2 -0
  13. package/framework/agents/frontend/blazor-builder.md +2 -0
  14. package/framework/agents/frontend/nextjs-expert.md +2 -0
  15. package/framework/agents/infrastructure/azure-architect.md +2 -0
  16. package/framework/agents/infrastructure/azure-deploy-specialist.md +2 -0
  17. package/framework/agents/infrastructure/bicep-architect.md +2 -0
  18. package/framework/agents/infrastructure/container-specialist.md +2 -0
  19. package/framework/agents/infrastructure/devops-engineer.md +3 -0
  20. package/framework/agents/infrastructure/infra-architect.md +3 -0
  21. package/framework/agents/integrations/asaas-financial.md +2 -0
  22. package/framework/agents/integrations/azure-identity.md +2 -0
  23. package/framework/agents/integrations/clerk-auth.md +3 -0
  24. package/framework/agents/integrations/hangfire-integration.md +2 -0
  25. package/framework/agents/integrations/resend-email.md +2 -0
  26. package/framework/agents.json +37 -7
  27. package/framework/commands/commit.md +166 -0
  28. package/framework/commands/morph-apply.md +156 -155
  29. package/framework/commands/morph-archive.md +33 -27
  30. package/framework/commands/morph-infra.md +83 -77
  31. package/framework/commands/morph-preflight.md +97 -55
  32. package/framework/commands/morph-proposal.md +131 -58
  33. package/framework/commands/morph-status.md +36 -30
  34. package/framework/commands/morph-troubleshoot.md +68 -59
  35. package/framework/hooks/claude-code/notification/approval-reminder.js +3 -2
  36. package/framework/hooks/claude-code/post-tool-use/dispatch.js +154 -31
  37. package/framework/hooks/claude-code/post-tool-use/skill-reminder.js +7 -84
  38. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +8 -17
  39. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +16 -3
  40. package/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +4 -3
  41. package/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +3 -2
  42. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +60 -0
  43. package/framework/hooks/claude-code/session-start/inject-morph-context.js +55 -2
  44. package/framework/hooks/claude-code/session-start/post-compact-restore.js +41 -0
  45. package/framework/hooks/claude-code/stop/validate-completion.js +2 -15
  46. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +23 -5
  47. package/framework/hooks/shared/compact-restore.js +100 -0
  48. package/framework/hooks/shared/dispatch-helpers.js +116 -0
  49. package/framework/hooks/shared/phase-utils.js +9 -5
  50. package/framework/hooks/shared/state-reader.js +27 -3
  51. package/framework/phases.json +30 -7
  52. package/framework/rules/csharp-standards.md +3 -0
  53. package/framework/rules/frontend-standards.md +2 -0
  54. package/framework/rules/infrastructure-standards.md +3 -0
  55. package/framework/rules/morph-workflow.md +143 -86
  56. package/framework/rules/nextjs-standards.md +2 -0
  57. package/framework/rules/testing-standards.md +3 -0
  58. package/framework/skills/level-0-meta/mcp-registry.json +86 -51
  59. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +139 -0
  60. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +42 -19
  61. package/framework/skills/level-0-meta/{code-review → morph-code-review}/SKILL.md +8 -5
  62. package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/SKILL.md +8 -6
  63. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +362 -0
  64. package/framework/skills/level-0-meta/morph-init/SKILL.md +114 -20
  65. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +362 -0
  66. package/framework/skills/level-0-meta/morph-replicate/SKILL.md +95 -87
  67. package/framework/skills/level-0-meta/{simulation-checklist → morph-simulation-checklist}/SKILL.md +24 -0
  68. package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/SKILL.md +43 -43
  69. package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/references/tools-per-phase.md +1 -2
  70. package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/SKILL.md +23 -12
  71. package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/scripts/check-phase-outputs.mjs +2 -2
  72. package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +247 -0
  73. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +270 -0
  74. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +499 -0
  75. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +38 -0
  76. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +472 -0
  77. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +50 -0
  78. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +45 -0
  79. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +47 -0
  80. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +246 -0
  81. package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +238 -0
  82. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +14 -0
  83. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +312 -0
  84. package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/scripts/validate-tasks.mjs +3 -3
  85. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +324 -0
  86. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +146 -0
  87. package/framework/standards/integration/mcp/mcp-tools.md +25 -7
  88. package/framework/templates/docs/onboarding.md +2 -2
  89. package/package.json +3 -4
  90. package/src/commands/agents/dispatch-agents.js +50 -3
  91. package/src/commands/mcp/mcp-setup.js +39 -2
  92. package/src/commands/phase/phase-reset.js +74 -0
  93. package/src/commands/project/doctor.js +26 -7
  94. package/src/commands/project/update.js +4 -4
  95. package/src/commands/scope/escalate.js +215 -0
  96. package/src/commands/state/advance-phase.js +27 -53
  97. package/src/commands/state/state.js +1 -1
  98. package/src/commands/task/expand.js +100 -0
  99. package/src/core/paths/output-schema.js +4 -3
  100. package/src/core/state/phase-state-machine.js +7 -4
  101. package/src/core/state/state-manager.js +4 -3
  102. package/src/lib/detectors/claude-config-detector.js +93 -347
  103. package/src/lib/detectors/design-system-detector.js +189 -189
  104. package/src/lib/detectors/index.js +155 -57
  105. package/src/lib/generators/context-generator.js +2 -2
  106. package/src/lib/installers/mcp-installer.js +37 -5
  107. package/src/lib/phase-chain/phase-validator.js +22 -16
  108. package/src/lib/scope/impact-analyzer.js +106 -0
  109. package/src/lib/stack-filter.js +58 -0
  110. package/src/lib/tasks/task-parser.js +1 -1
  111. package/src/lib/validators/shared/emit-validator-dispatch.js +64 -0
  112. package/src/scripts/setup-infra.js +68 -18
  113. package/src/utils/agents-installer.js +51 -17
  114. package/src/utils/claude-md-injector.js +90 -0
  115. package/src/utils/file-copier.js +0 -1
  116. package/src/utils/hooks-installer.js +16 -5
  117. package/src/utils/skills-installer.js +67 -7
  118. package/CLAUDE.md +0 -98
  119. package/framework/memory/patterns-learned.md +0 -766
  120. package/framework/skills/level-0-meta/brainstorming/SKILL.md +0 -137
  121. package/framework/skills/level-0-meta/frontend-review/SKILL.md +0 -359
  122. package/framework/skills/level-0-meta/post-implementation/SKILL.md +0 -362
  123. package/framework/skills/level-0-meta/terminal-title/SKILL.md +0 -61
  124. package/framework/skills/level-0-meta/terminal-title/scripts/set_title.sh +0 -65
  125. package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +0 -216
  126. package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +0 -252
  127. package/framework/skills/level-1-workflows/phase-design/SKILL.md +0 -383
  128. package/framework/skills/level-1-workflows/phase-implement/SKILL.md +0 -492
  129. package/framework/skills/level-1-workflows/phase-setup/SKILL.md +0 -195
  130. package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +0 -271
  131. package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +0 -286
  132. package/src/commands/project/index.js +0 -8
  133. package/src/core/index.js +0 -10
  134. package/src/core/state/index.js +0 -8
  135. package/src/core/templates/index.js +0 -9
  136. package/src/core/templates/template-data-sources.js +0 -325
  137. package/src/core/workflows/index.js +0 -7
  138. package/src/lib/detectors/config-detector.js +0 -223
  139. package/src/lib/detectors/standards-generator.js +0 -335
  140. package/src/lib/detectors/structure-detector.js +0 -275
  141. package/src/lib/monitor/agent-resolver.js +0 -144
  142. package/src/lib/monitor/renderer.js +0 -230
  143. package/src/lib/orchestration/index.js +0 -7
  144. package/src/lib/orchestration/team-orchestrator.js +0 -404
  145. package/src/sanitizer/context-sanitizer.js +0 -221
  146. package/src/sanitizer/patterns.js +0 -163
  147. package/src/writer/file-writer.js +0 -86
  148. /package/framework/skills/level-0-meta/{brainstorming → morph-brainstorming}/references/proposal-example.md +0 -0
  149. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-example.md +0 -0
  150. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-guidelines.md +0 -0
  151. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/scripts/scan-csharp.mjs +0 -0
  152. /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/references/review-example-nextjs.md +0 -0
  153. /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/scripts/scan-nextjs.mjs +0 -0
  154. /package/framework/skills/level-0-meta/{frontend-review → morph-frontend-review}/scripts/scan-accessibility.mjs +0 -0
  155. /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-dev-server.mjs +0 -0
  156. /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-stack.mjs +0 -0
  157. /package/framework/skills/level-1-workflows/{phase-clarify → morph-phase-clarify}/references/clarifications-example.md +0 -0
  158. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/architecture-analysis-guide.md +0 -0
  159. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-authoring-guide.md +0 -0
  160. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-example.md +0 -0
  161. /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/recap-example.md +0 -0
  162. /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/vsa-implementation-guide.md +0 -0
  163. /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/task-planning-patterns.md +0 -0
  164. /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/tasks-example.md +0 -0
@@ -1,8 +1,14 @@
1
+ ---
2
+ description: Manage Azure infrastructure with Bicep templates — provision, update, and monitor cloud resources
3
+ argument-hint: [up|down|plan|status]
4
+ allowed-tools: Read, Write, Edit, Bash, Glob, AskUserQuestion
5
+ ---
6
+
1
7
  # /morph-infra - Infrastructure Management
2
8
 
3
- Gerencia infraestrutura Azure usando Bicep templates.
9
+ Manage Azure infrastructure using Bicep templates.
4
10
 
5
- ## Uso
11
+ ## Usage
6
12
 
7
13
  ```
8
14
  /morph-infra [action] [options]
@@ -10,23 +16,23 @@ Gerencia infraestrutura Azure usando Bicep templates.
10
16
 
11
17
  ### Actions
12
18
 
13
- | Action | Descrição |
14
- |--------|-----------|
15
- | `init` | Inicializa estrutura IaC no projeto |
16
- | `validate` | Valida templates Bicep |
17
- | `plan` | Mostra what-if de mudanças |
18
- | `deploy` | Executa deploy dos recursos |
19
- | `destroy` | Remove todos os recursos |
19
+ | Action | Description |
20
+ |--------|-------------|
21
+ | `init` | Initialize IaC structure in the project |
22
+ | `validate` | Validate Bicep templates |
23
+ | `plan` | Show what-if of changes |
24
+ | `deploy` | Execute resource deployment |
25
+ | `destroy` | Remove all resources |
20
26
 
21
27
  ---
22
28
 
23
29
  ## Workflow
24
30
 
25
- ### 1. INIT - Inicializar IaC
31
+ ### 1. INIT - Initialize IaC
26
32
 
27
- Quando o usuário solicitar `/morph-infra init`:
33
+ When the user requests `/morph-infra init`:
28
34
 
29
- 1. Criar estrutura `infra/` no projeto:
35
+ 1. Create the `infra/` structure in the project:
30
36
  ```
31
37
  infra/
32
38
  ├── main.bicep
@@ -41,42 +47,42 @@ Quando o usuário solicitar `/morph-infra init`:
41
47
  └── app-insights.bicep
42
48
  ```
43
49
 
44
- 2. Copiar templates de `.morph/framework/templates/infrastructure/...`
50
+ 2. Copy templates from `.morph/framework/templates/infrastructure/...`
45
51
 
46
- 3. Substituir placeholders:
47
- - `{{APP_NAME}}` → nome do projeto
48
- - `{{SUBSCRIPTION_ID}}` → solicitar ao usuário
49
- - `{{RESOURCE_GROUP}}` → sugerir padrão `rg-{app}-{env}`
52
+ 3. Replace placeholders:
53
+ - `{{APP_NAME}}` → project name
54
+ - `{{SUBSCRIPTION_ID}}` → request from user
55
+ - `{{RESOURCE_GROUP}}` → suggest default `rg-{app}-{env}`
50
56
 
51
- 4. Documentar no `decisions.md` a estrutura criada
57
+ 4. Document the created structure in `decisions.md`
52
58
 
53
59
  ---
54
60
 
55
- ### 2. VALIDATE - Validar Templates
61
+ ### 2. VALIDATE - Validate Templates
56
62
 
57
- Quando o usuário solicitar `/morph-infra validate`:
63
+ When the user requests `/morph-infra validate`:
58
64
 
59
- 1. Executar validação Bicep:
65
+ 1. Run Bicep validation:
60
66
  ```bash
61
67
  az bicep build --file infra/main.bicep
62
68
  ```
63
69
 
64
- 2. Verificar parâmetros necessários
70
+ 2. Check required parameters
65
71
 
66
- 3. Reportar erros ou sucesso
72
+ 3. Report errors or success
67
73
 
68
74
  ---
69
75
 
70
- ### 3. PLAN - Preview de Mudanças
76
+ ### 3. PLAN - Preview Changes
71
77
 
72
- Quando o usuário solicitar `/morph-infra plan [env]`:
78
+ When the user requests `/morph-infra plan [env]`:
73
79
 
74
- 1. Verificar se Azure CLI está autenticado:
80
+ 1. Check if Azure CLI is authenticated:
75
81
  ```bash
76
82
  az account show
77
83
  ```
78
84
 
79
- 2. Executar what-if:
85
+ 2. Run what-if:
80
86
  ```bash
81
87
  az deployment group what-if \
82
88
  --resource-group rg-{app}-{env} \
@@ -84,28 +90,28 @@ Quando o usuário solicitar `/morph-infra plan [env]`:
84
90
  --parameters @infra/parameters.{env}.json
85
91
  ```
86
92
 
87
- 3. Apresentar resumo de mudanças:
88
- - Recursos a criar
89
- - Recursos a modificar
90
- - Recursos a deletar
91
- - Custos estimados
93
+ 3. Present change summary:
94
+ - Resources to create
95
+ - Resources to modify
96
+ - Resources to delete
97
+ - Estimated costs
92
98
 
93
- 4. **PARE e aguarde aprovação** para deploy
99
+ 4. **STOP and wait for approval** before deploy
94
100
 
95
101
  ---
96
102
 
97
- ### 4. DEPLOY - Executar Deploy
103
+ ### 4. DEPLOY - Execute Deploy
98
104
 
99
- Quando o usuário solicitar `/morph-infra deploy [env]`:
105
+ When the user requests `/morph-infra deploy [env]`:
100
106
 
101
- 1. Verificar aprovação do plan
107
+ 1. Verify plan was approved
102
108
 
103
- 2. Criar resource group se não existir:
109
+ 2. Create resource group if it doesn't exist:
104
110
  ```bash
105
111
  az group create --name rg-{app}-{env} --location brazilsouth
106
112
  ```
107
113
 
108
- 3. Executar deploy:
114
+ 3. Execute deploy:
109
115
  ```bash
110
116
  az deployment group create \
111
117
  --resource-group rg-{app}-{env} \
@@ -113,75 +119,75 @@ Quando o usuário solicitar `/morph-infra deploy [env]`:
113
119
  --parameters @infra/parameters.{env}.json
114
120
  ```
115
121
 
116
- 4. Capturar outputs:
122
+ 4. Capture outputs:
117
123
  - Container App URL
118
124
  - SQL Connection String
119
125
  - Key Vault URI
120
126
 
121
- 5. Atualizar documentação com informações do deploy
127
+ 5. Update documentation with deploy information
122
128
 
123
129
  ---
124
130
 
125
- ### 5. DESTROY - Remover Recursos
131
+ ### 5. DESTROY - Remove Resources
126
132
 
127
- Quando o usuário solicitar `/morph-infra destroy [env]`:
133
+ When the user requests `/morph-infra destroy [env]`:
128
134
 
129
- 1. ⚠️ **ALERTAR** que esta ação é irreversível
135
+ 1. **WARN** that this action is irreversible
130
136
 
131
- 2. Listar recursos que serão deletados
137
+ 2. List resources that will be deleted
132
138
 
133
- 3. **PARE e aguarde confirmação explícita** ("sim, deletar")
139
+ 3. **STOP and wait for explicit confirmation** ("yes, delete")
134
140
 
135
- 4. Executar:
141
+ 4. Execute:
136
142
  ```bash
137
143
  az group delete --name rg-{app}-{env} --yes --no-wait
138
144
  ```
139
145
 
140
146
  ---
141
147
 
142
- ## Regras de Segurança
148
+ ## Security Rules
143
149
 
144
- ### NUNCA:
145
- - Expor secrets em logs
146
- - Commitar arquivos com secrets
147
- - Deletar recursos de produção sem confirmação explícita
148
- - Criar recursos fora do Bicep (zero portal)
150
+ ### NEVER:
151
+ - Expose secrets in logs
152
+ - Commit files with secrets
153
+ - Delete production resources without explicit confirmation
154
+ - Create resources outside Bicep (zero portal)
149
155
 
150
- ### SEMPRE:
151
- - Usar Key Vault para secrets
152
- - Validar Bicep antes de deploy
153
- - Executar what-if antes de deploy
154
- - Documentar custos estimados
155
- - Manter parameters.json separados por ambiente
156
+ ### ALWAYS:
157
+ - Use Key Vault for secrets
158
+ - Validate Bicep before deploy
159
+ - Run what-if before deploy
160
+ - Document estimated costs
161
+ - Keep parameters.json separated by environment
156
162
 
157
163
  ---
158
164
 
159
165
  ## Cost Guardian Integration
160
166
 
161
- Antes de qualquer deploy, verificar com Cost Guardian:
167
+ Before any deploy, check with Cost Guardian:
162
168
 
163
- 1. Estimar custos mensais dos recursos
164
- 2. Verificar se está dentro dos limites aprovados:
165
- - Free tier: sem aprovação
166
- - Até $10/mês: requer confirmação
167
- - Acima de $10: requer ADR
169
+ 1. Estimate monthly resource costs
170
+ 2. Verify it's within approved limits:
171
+ - Free tier: no approval needed
172
+ - Up to $10/month: requires confirmation
173
+ - Above $10: requires ADR
168
174
 
169
175
  ---
170
176
 
171
- ## Exemplo de Uso
177
+ ## Usage Example
172
178
 
173
179
  ```
174
- Usuário: /morph-infra init
175
- Claude: Criando estrutura IaC...
180
+ User: /morph-infra init
181
+ Claude: Creating IaC structure...
176
182
  - infra/main.bicep
177
183
  - infra/parameters.dev.json
178
184
  - infra/modules/*.bicep
179
- Pronto! Execute /morph-infra validate para verificar.
185
+ Done! Run /morph-infra validate to verify.
180
186
 
181
- Usuário: /morph-infra plan dev
182
- Claude: Analisando mudanças para ambiente dev...
187
+ User: /morph-infra plan dev
188
+ Claude: Analyzing changes for dev environment...
183
189
 
184
- CRIAR:
190
+ CREATE:
185
191
  + Container App Environment
186
192
  + Container App
187
193
  + SQL Server (Free)
@@ -189,14 +195,14 @@ Claude: Analisando mudanças para ambiente dev...
189
195
  + Key Vault
190
196
  + Application Insights
191
197
 
192
- CUSTO ESTIMADO: ~$0/mês (Free tier)
198
+ ESTIMATED COST: ~$0/month (Free tier)
193
199
 
194
- Aprovar deploy? (sim/não)
200
+ Approve deploy? (yes/no)
195
201
 
196
- Usuário: sim
197
- Claude: Executando deploy...
198
- ✓ Resource Group criado
199
- ✓ Deploy concluído em 3m 45s
202
+ User: yes
203
+ Claude: Executing deploy...
204
+ ✓ Resource Group created
205
+ ✓ Deploy completed in 3m 45s
200
206
 
201
207
  OUTPUTS:
202
208
  - URL: https://myapp-dev.azurecontainerapps.io
@@ -1,34 +1,76 @@
1
+ ---
2
+ description: Validate project readiness before Azure deploy — checks specs, contracts, tests, and infrastructure
3
+ argument-hint: [feature-name]
4
+ allowed-tools: Read, Bash, Glob, Grep
5
+ ---
6
+
1
7
  # Pre-Flight Check for Azure Deployment
2
8
 
3
9
  Validates project readiness before deploying to Azure.
4
10
 
5
- ## Uso
11
+ ## Usage
6
12
 
7
13
  ```
8
14
  /morph-preflight azure
9
15
  ```
10
16
 
11
- ## Objetivo
17
+ ## Purpose
18
+
19
+ Detect problems **before** deploy that would cause production failures. Saves time and avoids debugging in Azure environment.
20
+
21
+ ---
22
+
23
+ ## MORPH-SPEC Validation (run before all other checks)
24
+
25
+ These checks verify that the morph-spec workflow is complete for the feature being deployed. Skip only if deploying a non-morph-spec project.
26
+
27
+ ```bash
28
+ # Verify implementation is complete
29
+ npx morph-spec state get {feature}
30
+ npx morph-spec approval-status {feature}
31
+ npx morph-spec validate-feature {feature}
32
+ ```
33
+
34
+ | Check | Command | Pass Criteria |
35
+ |-------|---------|---------------|
36
+ | Phase is implement or later | `state get` | phase derived as `implement` |
37
+ | All gates approved | `approval-status` | design, plan, tasks gates all approved |
38
+ | Feature validation passes | `validate-feature` | 100% pass rate |
39
+ | All tasks complete | `state get` → tasks array | 0 tasks in `pending` or `in_progress` |
40
+ | Recap generated | Read `5-implement/recap.md` | File exists and is non-empty |
41
+
42
+ **If any MORPH check fails:** Show which check failed and recommend: `Run /morph-apply {feature} to complete implementation before deploying.`
43
+
44
+ ---
45
+
46
+ ## Test Suite (run before infrastructure checks)
47
+
48
+ ```bash
49
+ dotnet test --verbosity normal
50
+ ```
12
51
 
13
- Detectar problemas **antes** do deploy que causariam falhas em produção. Economiza tempo e evita debugging em ambiente Azure.
52
+ **Pass criteria:** 100% test pass rate. Zero tolerance any failing test blocks deployment. If tests fail, categorize each failure:
53
+ - **Genuine bug** → fix implementation
54
+ - **Flaky/environment test** → isolate and fix
55
+ - **Outdated assertion** → update test to match correct new behavior
14
56
 
15
57
  ---
16
58
 
17
- ## Validações Executadas
59
+ ## Validations Performed
18
60
 
19
61
  ### 1. Package Version Conflicts
20
62
 
21
- **O que verifica:**
22
- - `Azure.Identity` especificado explicitamente
23
- - Sem conflitos de versão (NU1605, NU1608)
24
- - Packages críticos com versões compatíveis
63
+ **What it checks:**
64
+ - `Azure.Identity` explicitly specified
65
+ - No version conflicts (NU1605, NU1608)
66
+ - Critical packages with compatible versions
25
67
 
26
- **Como verificar:**
68
+ **How to check:**
27
69
  ```bash
28
70
  dotnet restore --verbosity normal 2>&1 | grep -E "(NU1605|NU1608|warning)"
29
71
  ```
30
72
 
31
- **Fix comum:**
73
+ **Common fix:**
32
74
  ```xml
33
75
  <PackageReference Include="Azure.Identity" Version="1.14.2" />
34
76
  ```
@@ -37,19 +79,19 @@ dotnet restore --verbosity normal 2>&1 | grep -E "(NU1605|NU1608|warning)"
37
79
 
38
80
  ### 2. EF Core Migrations
39
81
 
40
- **O que verifica:**
41
- - Sem pending model changes
42
- - Migrations aplicáveis existem
43
- - Migration scripts são válidos
82
+ **What it checks:**
83
+ - No pending model changes
84
+ - Applicable migrations exist
85
+ - Migration scripts are valid
44
86
 
45
- **Como verificar:**
87
+ **How to check:**
46
88
  ```bash
47
89
  dotnet ef migrations has-pending-model-changes \
48
90
  --project src/Infrastructure \
49
91
  --startup-project src/Web
50
92
  ```
51
93
 
52
- **Fix comum:**
94
+ **Common fix:**
53
95
  ```bash
54
96
  dotnet ef migrations add <MigrationName> \
55
97
  --project src/Infrastructure \
@@ -58,30 +100,30 @@ dotnet ef migrations add <MigrationName> \
58
100
 
59
101
  ---
60
102
 
61
- ### 3. Dockerfile Validation (se Container Apps)
103
+ ### 3. Dockerfile Validation (if Container Apps)
62
104
 
63
- **O que verifica:**
64
- - Dockerfile existe
65
- - Base image é válida
66
- - Multi-stage build configurado
67
- - EXPOSE ports corretos
68
- - ENTRYPOINT definido
105
+ **What it checks:**
106
+ - Dockerfile exists
107
+ - Base image is valid
108
+ - Multi-stage build configured
109
+ - EXPOSE ports correct
110
+ - ENTRYPOINT defined
69
111
 
70
- **Como verificar:**
112
+ **How to check:**
71
113
  ```bash
72
114
  docker build --check .
73
- # Ou validação manual do Dockerfile
115
+ # Or manual Dockerfile validation
74
116
  ```
75
117
 
76
118
  ---
77
119
 
78
120
  ### 4. Blazor .NET 10 Assets
79
121
 
80
- **O que verifica:**
81
- - `RequiresAspNetWebAssets` está `true` (se Blazor + .NET 10)
82
- - Static web assets configurados corretamente
122
+ **What it checks:**
123
+ - `RequiresAspNetWebAssets` is `true` (if Blazor + .NET 10)
124
+ - Static web assets configured correctly
83
125
 
84
- **Como verificar:**
126
+ **How to check:**
85
127
  ```bash
86
128
  grep -r "RequiresAspNetWebAssets" *.csproj
87
129
  ```
@@ -97,12 +139,12 @@ grep -r "RequiresAspNetWebAssets" *.csproj
97
139
 
98
140
  ### 5. Bicep Syntax Validation
99
141
 
100
- **O que verifica:**
101
- - Arquivos `.bicep` sem erros de sintaxe
102
- - Parâmetros obrigatórios definidos
103
- - Resources com nomes válidos
142
+ **What it checks:**
143
+ - `.bicep` files without syntax errors
144
+ - Required parameters defined
145
+ - Resources with valid names
104
146
 
105
- **Como verificar:**
147
+ **How to check:**
106
148
  ```bash
107
149
  az bicep build --file infra/main.bicep --stdout > /dev/null
108
150
  ```
@@ -111,20 +153,20 @@ az bicep build --file infra/main.bicep --stdout > /dev/null
111
153
 
112
154
  ### 6. Key Vault Configuration
113
155
 
114
- **O que verifica:**
115
- - Key Vault URI configurado em `appsettings.json` ou environment
116
- - Não condiciona Key Vault ao ambiente (bug comum)
117
- - Managed Identity habilitada
156
+ **What it checks:**
157
+ - Key Vault URI configured in `appsettings.json` or environment
158
+ - Key Vault not conditioned on environment (common bug)
159
+ - Managed Identity enabled
118
160
 
119
- **Como verificar:**
161
+ **How to check:**
120
162
  ```bash
121
163
  grep -r "KeyVaultUri\|AzureKeyVault" appsettings*.json
122
164
  grep -r "IsDevelopment()" Program.cs | grep -i keyvault
123
165
  ```
124
166
 
125
- **Anti-pattern a detectar:**
167
+ **Anti-pattern to detect:**
126
168
  ```csharp
127
- // ❌ ERRADO - Não carrega Key Vault em dev!
169
+ // ❌ WRONG - Doesn't load Key Vault in dev!
128
170
  if (!builder.Environment.IsDevelopment())
129
171
  {
130
172
  builder.Configuration.AddAzureKeyVault(...);
@@ -135,20 +177,20 @@ if (!builder.Environment.IsDevelopment())
135
177
 
136
178
  ### 7. Connection Strings Security
137
179
 
138
- **O que verifica:**
139
- - Connection strings não hardcoded em código
140
- - Secrets em Key Vault ou User Secrets
141
- - Sem credentials em `appsettings.json` (exceto Development)
180
+ **What it checks:**
181
+ - Connection strings not hardcoded in code
182
+ - Secrets in Key Vault or User Secrets
183
+ - No credentials in `appsettings.json` (except Development)
142
184
 
143
- **Como verificar:**
185
+ **How to check:**
144
186
  ```bash
145
- # Detectar passwords em appsettings
187
+ # Detect passwords in appsettings
146
188
  grep -rE "(Password=|Pwd=|Secret=)" appsettings*.json | grep -v Development
147
189
  ```
148
190
 
149
191
  ---
150
192
 
151
- ## Output Exemplo
193
+ ## Example Output
152
194
 
153
195
  ```
154
196
  🔍 MORPH Pre-Flight Check: Azure Deployment
@@ -175,15 +217,15 @@ Recommended fixes:
175
217
 
176
218
  ---
177
219
 
178
- ## Workflow de Uso
220
+ ## Usage Workflow
179
221
 
180
- ### Antes de criar PR para produção
222
+ ### Before creating PR for production
181
223
 
182
224
  ```bash
183
225
  /morph-preflight azure
184
226
  ```
185
227
 
186
- ### No pipeline CI/CD
228
+ ### In CI/CD pipeline
187
229
 
188
230
  ```yaml
189
231
  - script: |
@@ -206,9 +248,9 @@ Recommended fixes:
206
248
 
207
249
  ---
208
250
 
209
- ## Validações Futuras (Roadmap)
251
+ ## Future Validations (Roadmap)
210
252
 
211
- - [ ] Cost estimation validation (dentro do budget)
253
+ - [ ] Cost estimation validation (within budget)
212
254
  - [ ] RBAC permissions check
213
255
  - [ ] Network security rules validation
214
256
  - [ ] Health probe endpoint exists
@@ -216,9 +258,9 @@ Recommended fixes:
216
258
 
217
259
  ---
218
260
 
219
- ## Referências
261
+ ## References
220
262
 
221
- - [azure.md](../../standards/azure.md) - Padrões Azure
263
+ - [azure.md](../../standards/azure.md) - Azure Standards
222
264
  - [dotnet10-migration.md](../../standards/dotnet10-migration.md) - Breaking changes .NET 10
223
265
  - [blazor-efcore.md](../../../../framework/standards/blazor-efcore.md) - EF Core patterns
224
266