@polymorphism-tech/morph-spec 4.2.0 → 4.3.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 (132) hide show
  1. package/bin/morph-spec.js +283 -8
  2. package/bin/validate.js +4 -4
  3. package/docs/{v3.0 → next-generation}/AGENTS.md +1 -1
  4. package/docs/next-generation/CONTEXT-OPTIMIZATION.md +267 -0
  5. package/docs/next-generation/EXECUTION-FLOW.md +274 -0
  6. package/docs/next-generation/META-PROMPTS.md +235 -0
  7. package/docs/next-generation/MIGRATION-GUIDE.md +253 -0
  8. package/docs/next-generation/THREAD-MANAGEMENT.md +240 -0
  9. package/package.json +5 -5
  10. package/src/commands/agents/agents-fuse.js +96 -0
  11. package/src/commands/agents/micro-agent.js +112 -0
  12. package/src/commands/agents/spawn-team.js +69 -4
  13. package/src/commands/agents/squad-template.js +146 -0
  14. package/src/commands/analytics/analytics.js +176 -0
  15. package/src/commands/context/context-prime.js +63 -0
  16. package/src/commands/context/core-four.js +54 -0
  17. package/src/commands/mcp/mcp.js +102 -0
  18. package/src/commands/project/detect-agents.js +1 -1
  19. package/src/commands/project/doctor.js +573 -356
  20. package/src/commands/project/init.js +1 -1
  21. package/src/commands/project/update.js +1 -1
  22. package/src/commands/state/advance-phase.js +433 -416
  23. package/src/commands/templates/template-render.js +80 -1
  24. package/src/commands/threads/thread-template.js +103 -0
  25. package/src/commands/threads/threads.js +261 -0
  26. package/src/commands/trust/trust.js +205 -0
  27. package/src/{orchestrator.js → core/orchestrator.js} +8 -8
  28. package/src/core/state/state-manager.js +18 -2
  29. package/src/core/workflows/workflow-detector.js +100 -2
  30. package/src/lib/agents/micro-agent-factory.js +161 -0
  31. package/src/lib/analytics/analytics-engine.js +345 -0
  32. package/src/lib/checkpoints/checkpoint-hooks.js +293 -258
  33. package/src/lib/context/context-bundler.js +240 -0
  34. package/src/lib/context/context-optimizer.js +212 -0
  35. package/src/lib/context/context-tracker.js +273 -0
  36. package/src/lib/context/core-four-tracker.js +201 -0
  37. package/src/lib/context/mcp-optimizer.js +200 -0
  38. package/src/lib/execution/fusion-executor.js +304 -0
  39. package/src/lib/execution/parallel-executor.js +270 -0
  40. package/src/lib/generators/context-generator.js +3 -3
  41. package/src/lib/generators/recap-generator.js +2 -2
  42. package/src/lib/hooks/hook-executor.js +169 -0
  43. package/src/lib/hooks/stop-hook-executor.js +286 -0
  44. package/src/lib/hops/hop-composer.js +221 -0
  45. package/src/lib/threads/thread-coordinator.js +238 -0
  46. package/src/lib/threads/thread-manager.js +317 -0
  47. package/src/lib/tracking/artifact-trail.js +202 -0
  48. package/src/lib/trust/trust-manager.js +269 -0
  49. package/src/lib/validators/design-system/design-system-validator.js +2 -2
  50. package/src/lib/validators/validation-runner.js +6 -6
  51. package/stacks/blazor-azure/.morph/config/agents.json +72 -3
  52. package/stacks/nextjs-supabase/.morph/config/agents.json +3 -3
  53. package/CLAUDE.md +0 -993
  54. package/docs/llm-interaction-config.md +0 -735
  55. package/docs/v3.0/EXECUTION-FLOW.md +0 -1304
  56. package/src/commands/utils/migrate-state.js +0 -158
  57. package/src/commands/utils/upgrade.js +0 -346
  58. package/src/lib/validators/architecture-validator.js +0 -60
  59. package/src/lib/validators/content-validator.js +0 -164
  60. package/src/lib/validators/package-validator.js +0 -61
  61. package/src/lib/validators/ui-contrast-validator.js +0 -44
  62. package/stacks/blazor-azure/.claude/commands/morph-apply.md +0 -221
  63. package/stacks/blazor-azure/.claude/commands/morph-archive.md +0 -79
  64. package/stacks/blazor-azure/.claude/commands/morph-deploy.md +0 -529
  65. package/stacks/blazor-azure/.claude/commands/morph-infra.md +0 -209
  66. package/stacks/blazor-azure/.claude/commands/morph-preflight.md +0 -227
  67. package/stacks/blazor-azure/.claude/commands/morph-proposal.md +0 -122
  68. package/stacks/blazor-azure/.claude/commands/morph-status.md +0 -86
  69. package/stacks/blazor-azure/.claude/commands/morph-troubleshoot.md +0 -122
  70. package/stacks/blazor-azure/.claude/skills/level-0-meta/README.md +0 -7
  71. package/stacks/blazor-azure/.claude/skills/level-0-meta/code-review.md +0 -226
  72. package/stacks/blazor-azure/.claude/skills/level-0-meta/morph-checklist.md +0 -117
  73. package/stacks/blazor-azure/.claude/skills/level-0-meta/simulation-checklist.md +0 -77
  74. package/stacks/blazor-azure/.claude/skills/level-1-workflows/README.md +0 -7
  75. package/stacks/blazor-azure/.claude/skills/level-1-workflows/morph-replicate.md +0 -213
  76. package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-clarify.md +0 -131
  77. package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-design.md +0 -213
  78. package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-setup.md +0 -106
  79. package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-tasks.md +0 -164
  80. package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-uiux.md +0 -169
  81. package/stacks/blazor-azure/.claude/skills/level-2-domains/README.md +0 -14
  82. package/stacks/blazor-azure/.claude/skills/level-2-domains/ai-agents/ai-system-architect.md +0 -192
  83. package/stacks/blazor-azure/.claude/skills/level-2-domains/architecture/po-pm-advisor.md +0 -197
  84. package/stacks/blazor-azure/.claude/skills/level-2-domains/architecture/prompt-engineer.md +0 -189
  85. package/stacks/blazor-azure/.claude/skills/level-2-domains/architecture/seo-growth-hacker.md +0 -320
  86. package/stacks/blazor-azure/.claude/skills/level-2-domains/architecture/standards-architect.md +0 -156
  87. package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/api-designer.md +0 -59
  88. package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/dotnet-senior.md +0 -77
  89. package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/ef-modeler.md +0 -58
  90. package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/hangfire-orchestrator.md +0 -126
  91. package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/ms-agent-expert.md +0 -45
  92. package/stacks/blazor-azure/.claude/skills/level-2-domains/frontend/blazor-builder.md +0 -210
  93. package/stacks/blazor-azure/.claude/skills/level-2-domains/frontend/nextjs-expert.md +0 -154
  94. package/stacks/blazor-azure/.claude/skills/level-2-domains/frontend/ui-ux-designer.md +0 -191
  95. package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/azure-architect.md +0 -142
  96. package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/azure-deploy-specialist.md +0 -699
  97. package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/bicep-architect.md +0 -126
  98. package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/container-specialist.md +0 -131
  99. package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/devops-engineer.md +0 -119
  100. package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/asaas-financial.md +0 -130
  101. package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/azure-identity.md +0 -142
  102. package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/clerk-auth.md +0 -108
  103. package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/hangfire-orchestrator.md +0 -64
  104. package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/resend-email.md +0 -119
  105. package/stacks/blazor-azure/.claude/skills/level-2-domains/quality/code-analyzer.md +0 -235
  106. package/stacks/blazor-azure/.claude/skills/level-2-domains/quality/testing-specialist.md +0 -126
  107. package/stacks/blazor-azure/.claude/skills/level-3-technologies/README.md +0 -7
  108. package/stacks/blazor-azure/.claude/skills/level-4-patterns/README.md +0 -7
  109. package/stacks/blazor-azure/.morph/archive/.gitkeep +0 -25
  110. package/stacks/blazor-azure/.morph/features/.gitkeep +0 -25
  111. package/stacks/blazor-azure/.morph/schemas/agent.schema.json +0 -296
  112. package/stacks/blazor-azure/.morph/schemas/tasks.schema.json +0 -220
  113. package/stacks/blazor-azure/.morph/specs/.gitkeep +0 -20
  114. package/stacks/blazor-azure/.morph/test-infra/example.bicep +0 -59
  115. package/stacks/nextjs-supabase/.claude/commands/morph-apply.md +0 -221
  116. package/stacks/nextjs-supabase/.claude/commands/morph-archive.md +0 -79
  117. package/stacks/nextjs-supabase/.claude/commands/morph-deploy.md +0 -529
  118. package/stacks/nextjs-supabase/.claude/commands/morph-infra.md +0 -209
  119. package/stacks/nextjs-supabase/.claude/commands/morph-preflight.md +0 -227
  120. package/stacks/nextjs-supabase/.claude/commands/morph-proposal.md +0 -122
  121. package/stacks/nextjs-supabase/.claude/commands/morph-status.md +0 -86
  122. package/stacks/nextjs-supabase/.claude/commands/morph-troubleshoot.md +0 -122
  123. package/stacks/nextjs-supabase/.claude/settings.local.json +0 -6
  124. package/stacks/nextjs-supabase/.claude/skills/level-2-domains/backend/dotnet-supabase.md +0 -244
  125. package/stacks/nextjs-supabase/.claude/skills/level-2-domains/frontend/nextjs-supabase.md +0 -335
  126. package/stacks/nextjs-supabase/.claude/skills/level-2-domains/infrastructure/easypanel-deployer.md +0 -189
  127. package/stacks/nextjs-supabase/.claude/skills/level-2-domains/integrations/supabase-expert.md +0 -50
  128. /package/docs/{v3.0 → next-generation}/ANALYSIS.md +0 -0
  129. /package/docs/{v3.0 → next-generation}/ARCHITECTURE.md +0 -0
  130. /package/docs/{v3.0 → next-generation}/FEATURES.md +0 -0
  131. /package/docs/{v3.0 → next-generation}/README.md +0 -0
  132. /package/docs/{v3.0 → next-generation}/ROADMAP.md +0 -0
package/CLAUDE.md DELETED
@@ -1,993 +0,0 @@
1
- # MORPH-SPEC - Instruções para Claude Code (Consumer)
2
-
3
- > by Polymorphism Tech
4
-
5
- Sistema de desenvolvimento orientado por especificações. Hub de agentes especializados em multi-stack com Infrastructure as Code.
6
-
7
- ---
8
-
9
- ## STACKS DISPONÍVEIS
10
-
11
- | Stack | Backend | Frontend | Database | Deploy | CLAUDE.md |
12
- |-------|---------|----------|----------|--------|-----------|
13
- | **blazor-azure** | .NET 10 Blazor Server | Blazor (C#) | Azure SQL | Azure Container Apps (Bicep) | `stacks/blazor-azure/CLAUDE.md` |
14
- | **nextjs-supabase** | .NET 10 Minimal API | Next.js 15 | Supabase (PostgreSQL) | EasyPanel (Docker) | `stacks/nextjs-supabase/CLAUDE.md` |
15
-
16
- Para novos projetos, copie os arquivos da stack desejada:
17
- ```bash
18
- cp -r stacks/{stack}/.morph/ seu-projeto/.morph/
19
- cp -r stacks/{stack}/.claude/ seu-projeto/.claude/
20
- cp stacks/{stack}/CLAUDE.md seu-projeto/CLAUDE.md
21
- ```
22
-
23
- ---
24
-
25
- ## REGRAS CRÍTICAS
26
-
27
- ### NUNCA:
28
- - Pular direto para código sem especificação
29
- - Implementar sem aprovação do design
30
- - Ignorar padrões em `.morph/standards/`
31
- - Criar recursos de infra manualmente (use IaC)
32
- - Gerar código sem contracts definidos
33
-
34
- ### SEMPRE:
35
- - Seguir as 5 fases obrigatórias
36
- - Gerar outputs em `.morph/features/{feature}/`
37
- - Documentar decisões em `decisions.md`
38
- - Checkpoint a cada 3 tasks implementadas
39
- - Usar Infrastructure as Code
40
-
41
- ---
42
-
43
- ## WORKFLOW (5 Fases)
44
-
45
- | Fase | Gatilho | Ações | Output | Pausa? |
46
- |------|---------|-------|--------|--------|
47
- | **1. SETUP** | Feature request | Ler project.md, identificar stack, ativar agentes, criar pasta | proposal.md | Não |
48
- | **2. DESIGN** | Setup concluído | Spec + contracts + decisions + custos + IaC | spec.md, contracts, decisions.md | **Sim** |
49
- | **3. CLARIFY** | Design aprovado | Ambiguidades, perguntas, edge cases | Spec atualizado | Não |
50
- | **4. TASKS** | Clarificações resolvidas | Quebrar em tasks, ordem, checkpoints, dependências | tasks.md | **Sim** |
51
- | **5. IMPLEMENT** | Tasks aprovadas | Task por task, checkpoint a cada 3, recap | Código + recap.md | Não |
52
-
53
- ---
54
-
55
- ## WORKFLOW DETECTION SYSTEM (Detecção Automática de Complexidade)
56
-
57
- O framework agora detecta **AUTOMATICAMENTE** o workflow apropriado baseado na análise do pedido do usuário.
58
-
59
- ### 5 Tipos de Workflow
60
-
61
- | Workflow | Complexidade | Arquivos | Linhas | Keywords Exemplo |
62
- |----------|--------------|----------|--------|------------------|
63
- | **fast-track** | Trivial | ≤3 | ≤50 | bug, fix, corrigir, css, typo |
64
- | **standard** | Média | 3-10 | 50-500 | paginação, filtro, refactor, export |
65
- | **full-morph** | Alta | >10 | >500 | sistema, autenticação, integração, cqrs |
66
- | **design-impl** | N/A | N/A | N/A | prototype, figma, html para, replicar |
67
- | **ui-refresh** | N/A | N/A | N/A | redesign, modernizar, aesthetic, bonito |
68
-
69
- ### Como Funciona
70
-
71
- **1. Quando Criar Feature:**
72
-
73
- ```bash
74
- # Detecção automática
75
- npx morph-spec feature create user-pagination \
76
- --request "add pagination to users table"
77
-
78
- # Output:
79
- 🔍 Analyzing request...
80
- ✓ Detected workflow: standard (85% confidence)
81
- Matched keyword: "paginação"
82
- Estimated: 5 files, ~200 lines
83
-
84
- 📋 Created feature: user-pagination
85
- Phase: proposal
86
- Workflow: standard
87
- ```
88
-
89
- **2. Análise Manual (Opcional):**
90
-
91
- ```bash
92
- npx morph-spec detect-workflow "implement complete authentication system"
93
-
94
- # Output:
95
- Detected Workflow: full-morph (92% confidence)
96
-
97
- Criteria Match:
98
- ✓ Keywords: "authentication", "complete", "system"
99
- ✓ Estimated: 15 files, ~800 lines
100
- ✓ Infrastructure: detected
101
-
102
- Phases to Run:
103
- 1. CONTEXT
104
- 2. PROPOSAL - ⏸️ Pause for approval
105
- 3. SETUP
106
- 4. UI/UX - ⏸️ Pause for approval
107
- 5. DESIGN - ⏸️ Pause for approval
108
- 6. CLARIFY
109
- 7. TASKS - ⏸️ Pause for approval
110
- 8. IMPLEMENT
111
- 9. SYNC - ⏸️ Pause for approval
112
-
113
- Phases Skipped: None (all mandatory for full-morph)
114
-
115
- Alternative Workflows:
116
- - standard (15%): If scope reduced to basic login only
117
- ```
118
-
119
- ### Workflow Behaviors
120
-
121
- #### fast-track (Trivial)
122
- - **Objetivo:** Correções rápidas, ajustes CSS, edge cases
123
- - **Fases:** Quick Analysis (proposal+setup+design combinados) → Implement
124
- - **Fases Puladas:** UIUX, CLARIFY, TASKS, SYNC
125
- - **Outputs:** Apenas commit message (sem .md files)
126
- - **Exemplo:** "fix typo in login button"
127
-
128
- #### standard (Média Complexidade)
129
- - **Objetivo:** Features simples, refatorações, otimizações
130
- - **Fases:** PROPOSAL (simplificado) → DESIGN (conciso) → TASKS (se >5 tasks) → IMPLEMENT
131
- - **Fases Puladas:** SETUP (contexto já carregado), UIUX (sem frontend significativo), CLARIFY (spec claro), SYNC (decisões táticas)
132
- - **Outputs:** proposal.md, spec.md, recap.md (minimal)
133
- - **Exemplo:** "add pagination to users table"
134
-
135
- #### full-morph (Alta Complexidade)
136
- - **Objetivo:** Sistemas completos, arquitetura, integrações
137
- - **Fases:** TODAS (9 fases obrigatórias)
138
- - **Fases Puladas:** Nenhuma
139
- - **Outputs:** Completo (proposal, ui-*, spec, contracts, tasks, decisions, recap)
140
- - **Exemplo:** "implement complete authentication system with OAuth"
141
-
142
- #### design-impl (Prototipo → Código)
143
- - **Objetivo:** Converter HTML, Figma, mockups para código funcional
144
- - **Fases:** ANÁLISE DO PROTÓTIPO → TASKS (lista de telas) → IMPLEMENT (por tela)
145
- - **Fases Puladas:** PROPOSAL, DESIGN técnico, CLARIFY, SYNC
146
- - **Outputs:** recap.md, .razor code, CSS
147
- - **Exemplo:** "convert HTML prototype to Blazor components"
148
-
149
- #### ui-refresh (Redesign Visual)
150
- - **Objetivo:** Mudanças apenas visuais, sem lógica de negócio
151
- - **Fases:** ANÁLISE VISUAL → DESIGN SYSTEM (simplificado) → IMPLEMENT (por página)
152
- - **Fases Puladas:** SETUP completo, CONTRACTS, TASKS detalhadas, INFRA, CLARIFY, SYNC
153
- - **Outputs:** design-refresh-checklist.md, CSS, .razor pages, recap.md
154
- - **Exemplo:** "redesign dashboard to look more modern"
155
-
156
- ### Algoritmo de Detecção
157
-
158
- O sistema usa 4 fatores ponderados:
159
-
160
- 1. **Keywords (40%):** Matching de palavras-chave (PT + EN)
161
- 2. **Complexity (30%):** Estimativa de arquivos/linhas/componentes
162
- 3. **Priority (20%):** Workflows específicos > genéricos
163
- 4. **Context (10%):** Condições especiais (has prototype? existing pages?)
164
-
165
- **Penalties:**
166
- - -50% para workflows sem keyword match (exceto full-morph)
167
-
168
- **Boosts:**
169
- - +20% para workflows com 3+ keywords matched
170
-
171
- ### Override Manual
172
-
173
- ```bash
174
- # Forçar workflow específico
175
- npx morph-spec state set user-auth workflow full-morph
176
-
177
- # Re-detectar após mudanças no pedido
178
- npx morph-spec state detect-workflow user-auth \
179
- "implement basic login only (no OAuth)"
180
-
181
- # Output:
182
- 🔄 Re-analyzing request...
183
- ✓ New workflow: standard (78% confidence)
184
- Previous: full-morph
185
- Reason: Scope reduced - no OAuth, no registration
186
- ```
187
-
188
- ### Configurações de Workflow
189
-
190
- Workflows são definidos em `framework/workflows/configs/*.json`:
191
-
192
- ```json
193
- {
194
- "id": "standard",
195
- "criteria": {
196
- "minFiles": 3,
197
- "maxFiles": 10,
198
- "minLines": 50,
199
- "maxLines": 500
200
- },
201
- "keywords": ["paginação", "pagination", "filtro", "filter"],
202
- "phases": {
203
- "run": ["proposal", "design", "tasks", "implement"],
204
- "skip": ["setup", "uiux", "clarify", "sync"]
205
- },
206
- "priority": 2
207
- }
208
- ```
209
-
210
- ### Documentação Completa
211
-
212
- Veja `framework/workflows/` para:
213
- - **docs/STORY-DRIVEN-DEVELOPMENT.md:** Filosofia do sistema
214
- - **docs/{workflow}.md:** Detalhes de cada workflow (5 arquivos)
215
- - **configs/{workflow}.json:** Configurações executáveis (5 arquivos)
216
- - **README.md:** Guia completo do sistema de workflows
217
-
218
- **REGRA CRÍTICA:** Confie na detecção automática. Override manual apenas se houver contexto que o sistema não detectou (ex: "parece grande mas já temos 80% do código pronto").
219
-
220
- ---
221
-
222
- ## APPROVAL GATES (Portões de Aprovação)
223
-
224
- O sistema agora rastreia aprovações explícitas para cada fase crítica em `state.json`.
225
-
226
- ### Gates Obrigatórios
227
-
228
- | Gate | Quando | Bloqueio | Comando |
229
- |------|--------|----------|---------|
230
- | **design** | Após DESIGN concluído | Impede `design → clarify` | `npx morph-spec approve {feature} design` |
231
- | **tasks** | Após TASKS concluído | Impede `tasks → implement` | `npx morph-spec approve {feature} tasks` |
232
-
233
- ### Workflow com Approval Gates
234
-
235
- ```bash
236
- # 1. Completar fase DESIGN
237
- # Sistema gera: spec.md, contracts, decisions.md
238
-
239
- # 2. PAUSAR e apresentar ao usuário
240
- # Use AskUserQuestion: "Approve design to proceed to clarify phase?"
241
-
242
- # 3. Se aprovado pelo usuário:
243
- npx morph-spec approve {feature} design
244
-
245
- # 4. Avançar fase (agora permitido)
246
- npx morph-spec advance-phase {feature} clarify
247
-
248
- # 5. Mesmo processo para TASKS → IMPLEMENT
249
- ```
250
-
251
- ### Comandos de Approval
252
-
253
- ```bash
254
- # Aprovar gate
255
- npx morph-spec approve {feature} {gate}
256
-
257
- # Rejeitar com motivo
258
- npx morph-spec reject {feature} {gate} "Reason here"
259
-
260
- # Ver status de todas as aprovações
261
- npx morph-spec approval-status {feature}
262
- ```
263
-
264
- ### Overrides (Usar com Cuidado)
265
-
266
- ```bash
267
- # Pular verificação de aprovação (não recomendado)
268
- npx morph-spec advance-phase {feature} {next-phase} --skip-approval
269
-
270
- # Forçar transição inválida (emergências apenas)
271
- npx morph-spec advance-phase {feature} {next-phase} --force
272
- ```
273
-
274
- **REGRA CRÍTICA:** SEMPRE apresente outputs ao usuário e obtenha aprovação explícita antes de avançar de DESIGN ou TASKS.
275
-
276
- ---
277
-
278
- ## AUTOMATIC CHECKPOINTS (Validação Automática)
279
-
280
- A cada 3 tasks completadas, o sistema executa validação automática.
281
-
282
- ### O Que é Validado
283
-
284
- | Validator | O Que Verifica | Falha Bloqueia? |
285
- |-----------|----------------|-----------------|
286
- | **architecture** | DI patterns, Blazor lifecycle, async/await | ✅ Sim |
287
- | **packages** | Conflitos NuGet, versões incompatíveis | ✅ Sim |
288
- | **design-system** | CSS compliance, color palette, spacing | ⚠️ Warning |
289
- | **security** | Secrets expostos, SQL injection, XSS | ✅ Sim |
290
-
291
- ### Comportamento no Checkpoint
292
-
293
- ```bash
294
- # Task 3, 6, 9, 12... completadas
295
- 🔍 Running CHECKPOINT 1...
296
- ✅ Architecture: 0 violations
297
- ✅ Packages: 0 conflicts
298
- ⚠️ Design System: 2 warnings (non-blocking)
299
- ✅ Security: 0 issues
300
-
301
- ✅ Checkpoint 1 passed
302
-
303
- # Se checkpoint FALHAR:
304
- ❌ Checkpoint 2 failed!
305
- - Architecture: DbContext injected directly in component
306
- - Security: API key hardcoded in appsettings.json
307
-
308
- ❌ Task NOT marked done. Fix violations before proceeding.
309
- ```
310
-
311
- ### Configuração
312
-
313
- Edite `.morph/config/llm-interaction.json`:
314
-
315
- ```json
316
- {
317
- "checkpoints": {
318
- "frequency": 3,
319
- "autoValidate": true,
320
- "validators": {
321
- "enabled": ["architecture", "packages", "security"]
322
- },
323
- "onFailure": {
324
- "blockProgress": true,
325
- "maxRetries": 3
326
- }
327
- }
328
- }
329
- ```
330
-
331
- **IMPORTANTE:** Se checkpoint falha 3 vezes, use `AskUserQuestion` para decidir: simplificar implementação, pular validador (arriscado), ou escalar para troubleshooting-expert.
332
-
333
- ---
334
-
335
- ## PHASE VALIDATION RULES (Validação Estrita)
336
-
337
- O sistema agora impede transições de fase inválidas com **state machine**.
338
-
339
- ### Transições Válidas
340
-
341
- ```
342
- proposal → setup
343
- setup → uiux | design
344
- uiux → design
345
- design → clarify
346
- clarify → tasks
347
- tasks → implement
348
- implement → sync | archived
349
- sync → archived
350
- ```
351
-
352
- ### 5 Gates de Validação
353
-
354
- Ao avançar fase, o sistema verifica (em ordem):
355
-
356
- 1. **State Machine:** Transição é válida? (`proposal → implement` ❌)
357
- 2. **Approval Gates:** Gate foi aprovado? (`design` ou `tasks` gates)
358
- 3. **Output Requirements:** Arquivos obrigatórios existem? (spec.md, tasks.json)
359
- 4. **Spec Content:** `spec.md` tem todas as seções? (Overview, Requirements, Technical Design, Data Model, API Contracts)
360
- 5. **Tasks Content:** `tasks.json` tem estrutura válida? (IDs, descriptions, dependencies válidas, sem ciclos)
361
-
362
- ### Exemplo de Bloqueio
363
-
364
- ```bash
365
- npx morph-spec advance-phase user-auth implement
366
-
367
- ❌ Invalid phase transition: design → implement
368
- Valid next phases: clarify
369
-
370
- ❌ Approval gate 'design' not approved
371
- Run: npx morph-spec approve user-auth design
372
-
373
- ❌ Spec validation failed:
374
- - Missing section: ## Data Model
375
- - Missing section: ## API Contracts
376
-
377
- Fix these issues before proceeding.
378
- ```
379
-
380
- **REGRA:** Nunca pule fases. Se precisa pular (ex: feature simples sem UIUX), documente em `decisions.md` ADR e use `--force`.
381
-
382
- ---
383
-
384
- ## CLAUDE CODE HOOKS (Validação em Hooks)
385
-
386
- O framework integra com o sistema de hooks do Claude Code para validação automática em eventos Git e Agent Teams.
387
-
388
- ### Arquitetura de Hooks
389
-
390
- **Universal (framework/hooks/):** Hooks compartilhados por todas as stacks
391
- - **pre-commit/**: `agents.sh`, `specs.sh`, `orchestrator.sh`
392
- - **commit-msg/**: `conventional-commits.sh` (Conventional Commits format)
393
- - **pre-push/**: `run-tests.sh` (executa test suite completo)
394
- - **agent-teams/**: `teammate-idle.js`, `task-completed.js`, `phase-advanced.js`
395
-
396
- **Stack-Specific (stacks/{stack}/.morph/hooks/):** Hooks específicos de cada stack
397
- - **pre-commit/**: `tests-csharp.sh` (blazor-azure), `tests-typescript.sh` (nextjs-supabase)
398
-
399
- ### Instalação de Git Hooks
400
-
401
- ```bash
402
- # No diretório .git/hooks do projeto
403
- cd .git/hooks
404
-
405
- # Pre-commit (valida agents.json, spec.md, executa testes)
406
- ln -sf ../../framework/hooks/pre-commit/orchestrator.sh pre-commit
407
- chmod +x pre-commit
408
-
409
- # Commit-msg (valida formato Conventional Commits)
410
- ln -sf ../../framework/hooks/commit-msg/conventional-commits.sh commit-msg
411
- chmod +x commit-msg
412
-
413
- # Pre-push (executa suite de testes antes de push)
414
- ln -sf ../../framework/hooks/pre-push/run-tests.sh pre-push
415
- chmod +x pre-push
416
- ```
417
-
418
- ### Configuração de Agent Teams Hooks
419
-
420
- Adicione em `.claude/settings.local.json`:
421
-
422
- ```json
423
- {
424
- "hooks": {
425
- "TeammateIdle": "node framework/hooks/agent-teams/teammate-idle.js {feature}",
426
- "TaskCompleted": "node framework/hooks/agent-teams/task-completed.js {feature} {taskId}",
427
- "PhaseAdvanced": "node framework/hooks/agent-teams/phase-advanced.js {feature} {fromPhase} {toPhase}"
428
- }
429
- }
430
- ```
431
-
432
- ### Validators com Hook Behavior
433
-
434
- 5 validators tier-4 configurados em `agents.json` com `hook_behavior`:
435
-
436
- | Validator | Hook Triggers | Valida | Bloqueia? |
437
- |-----------|---------------|--------|-----------|
438
- | **security-expert** | TeammateIdle, TaskCompleted | SQL injection, XSS, Secrets | ✅ Sim |
439
- | **architecture-expert** | TeammateIdle, TaskCompleted | DbContext injection, async/await, DI order | ✅ Sim |
440
- | **packages-validator** | TaskCompleted | NuGet conflicts, .NET 10 compatibility | ✅ Sim |
441
- | **design-system-validator** | TeammateIdle | CSS palette, spacing, typography | ⚠️ Warning |
442
- | **blazor-concurrency-validator** | TaskCompleted | DbContext lifecycle, async void, JSInterop | ✅ Sim |
443
-
444
- ### Como Funciona
445
-
446
- **Git Hooks:**
447
- ```
448
- git commit → pre-commit hook → orchestrator.sh
449
- ├─ Executa framework/hooks/pre-commit/*.sh (universal)
450
- └─ Executa .morph/hooks/pre-commit/*.sh (stack-specific)
451
-
452
- commit-msg hook → valida formato Conventional Commits
453
-
454
- git push → pre-push hook → executa test suite
455
- ```
456
-
457
- **Agent Teams Hooks:**
458
- ```
459
- Teammate idle → TeammateIdle hook
460
- ├─ Carrega agents.json
461
- ├─ Filtra validators com hook_triggers: ["TeammateIdle"]
462
- ├─ Executa validators via hook-executor.js
463
- └─ Bloqueia se errors > 0 e blocks_on_fail: true
464
- ```
465
-
466
- ### Bypass (Não Recomendado)
467
-
468
- ```bash
469
- # Pular hooks Git
470
- git commit --no-verify
471
- git push --no-verify
472
-
473
- # Pular validação de task
474
- npx morph-spec task done feature-name task-id --skip-validation
475
- ```
476
-
477
- **IMPORTANTE:** Veja `framework/hooks/README.md` para documentação completa de hooks.
478
-
479
- ---
480
-
481
- ## AGENT INVOCATION PATTERNS (Spawning de Agentes)
482
-
483
- Use **Task tool** para spawnar subagentes quando apropriado.
484
-
485
- ### Quando Spawnar Agentes
486
-
487
- Spawnar subagentes quando:
488
-
489
- - **5+ agentes ativos** (conforme state.activeAgents)
490
- - **Multi-domínio** (backend + frontend + infra)
491
- - **15+ arquivos** a modificar
492
- - **Complexidade: high ou critical**
493
-
494
- ### Pattern 1: Squad Leader Spawning
495
-
496
- ```typescript
497
- // Use Task tool
498
- {
499
- subagent_type: "general-purpose",
500
- description: "Implement backend API layer",
501
- prompt: `You are the Backend Squad Leader (dotnet-senior)...
502
-
503
- Your Domain Leaders:
504
- - ef-modeler: Database/EF Core layer
505
- - api-designer: REST endpoints + DTOs
506
- - event-architect: Domain events + Hangfire jobs
507
-
508
- Your Mission: Implement user authentication API
509
-
510
- Feature Spec: [Include spec.md summary]
511
-
512
- Standards:
513
- - .morph/standards/coding.md
514
- - .morph/standards/architecture.md
515
- - .morph/standards/dotnet10-compatibility.md
516
-
517
- Your Tasks (from tasks.json):
518
- - T001: Create User entity + DbContext
519
- - T002: Implement UserService with password hashing
520
- - T003: Create AuthController with login/register endpoints
521
-
522
- Deliverables:
523
- - Entities/User.cs
524
- - Data/AppDbContext.cs
525
- - Services/UserService.cs
526
- - Controllers/AuthController.cs
527
- - DTOs (LoginRequest, RegisterRequest, AuthResponse)
528
- - Migrations
529
-
530
- Constraints:
531
- - Use IDbContextFactory (not direct DbContext injection)
532
- - BCrypt for password hashing
533
- - JWT tokens (not sessions)
534
-
535
- Report back when complete with file list + any blockers.`
536
- }
537
- ```
538
-
539
- ### Pattern 2: Get Team Hierarchy Helper
540
-
541
- ```bash
542
- # Gera configurações prontas para Task tool
543
- npx morph-spec spawn-team {feature}
544
-
545
- # Output: JSON configs para cada squadmate
546
- {
547
- "teammates": [
548
- {
549
- "agent": "dotnet-senior",
550
- "role": "Backend Squad Leader",
551
- "taskConfig": { ... }
552
- },
553
- {
554
- "agent": "ef-modeler",
555
- "role": "Database Layer",
556
- "taskConfig": { ... }
557
- }
558
- ]
559
- }
560
- ```
561
-
562
- ### Pattern 3: Sequential Handoff
563
-
564
- ```typescript
565
- // 1. Backend squad gera API contracts
566
- Task tool → dotnet-senior → generates contracts.cs
567
-
568
- // 2. AGUARDAR conclusão (não spawnar frontend ainda)
569
-
570
- // 3. Frontend squad usa contracts no contexto
571
- Task tool → nextjs-senior → uses contracts.cs for type generation
572
- ```
573
-
574
- ### Agent Context Template
575
-
576
- Use `.morph/templates/agent-context.md` para gerar contexto consistente:
577
-
578
- ```bash
579
- node bin/render-template.js agent-context \
580
- --feature=user-auth \
581
- --agent=dotnet-senior \
582
- --output=.morph/temp/agent-context.txt
583
- ```
584
-
585
- **REGRA:** Sempre inclua spec.md summary, standards relevantes, e tasks específicas no prompt do agente.
586
-
587
- ---
588
-
589
- ## METADATA & QUICK ACCESS (Acesso Rápido)
590
-
591
- Para features grandes, use `metadata.json` para acesso rápido (reduz uso de tokens em 60-80%).
592
-
593
- ### Quando Usar metadata.json
594
-
595
- **USE metadata.json para:**
596
- - Quick status (fase atual, progresso %)
597
- - Lista de agentes ativos
598
- - Resumo de decisões (ADRs com links)
599
- - Histórico de checkpoints
600
-
601
- **USE arquivos .md completos para:**
602
- - Spec técnico detalhado
603
- - User stories completas
604
- - Diagramas e arquitetura
605
-
606
- ### Estrutura do metadata.json
607
-
608
- ```json
609
- {
610
- "version": "1.0.0",
611
- "feature": "user-authentication",
612
- "status": "active",
613
- "phase": "implement",
614
-
615
- "spec": {
616
- "id": "user-auth",
617
- "status": "Approved",
618
- "complexity": "Medium",
619
- "summary": {
620
- "problem": "Users need secure login/register...",
621
- "solution": "JWT-based auth with BCrypt...",
622
- "tags": ["security", "authentication", "jwt"]
623
- },
624
- "requirements": ["REQ1: JWT tokens", "REQ2: BCrypt hashing"],
625
- "dataModel": ["User entity", "RefreshToken entity"]
626
- },
627
-
628
- "decisions": {
629
- "decisions": [
630
- {
631
- "id": "ADR-001",
632
- "title": "JWT vs Sessions",
633
- "summary": "Chose JWT for stateless auth...",
634
- "fullPath": ".morph/features/user-auth/decisions.md#adr-001"
635
- }
636
- ]
637
- },
638
-
639
- "tasks": {
640
- "total": 12,
641
- "completed": 8,
642
- "progress": "67%"
643
- },
644
-
645
- "agents": ["dotnet-senior", "ef-modeler", "api-designer"],
646
-
647
- "checkpoints": [
648
- { "num": 1, "passed": true, "timestamp": "2026-02-14T10:30:00Z" },
649
- { "num": 2, "passed": true, "timestamp": "2026-02-14T11:45:00Z" }
650
- ],
651
-
652
- "quickLinks": {
653
- "spec": ".morph/features/user-auth/spec.md",
654
- "tasks": ".morph/features/user-auth/tasks.json",
655
- "decisions": ".morph/features/user-auth/decisions.md"
656
- }
657
- }
658
- ```
659
-
660
- ### Workflow
661
-
662
- ```bash
663
- # 1. Antes de trabalhar na feature, leia metadata.json
664
- cat .morph/project/outputs/user-auth/metadata.json
665
-
666
- # 2. Metadata é auto-atualizado após cada task
667
- # (Configurado em llm-interaction.json: "updateFrequency": "on_task_done")
668
- # NOTA: Não há comando manual para gerar metadata - sempre auto-gerado
669
- ```
670
-
671
- ### Configuração
672
-
673
- ```json
674
- {
675
- "metadata": {
676
- "autoGenerate": true,
677
- "updateFrequency": "on_task_done"
678
- }
679
- }
680
- ```
681
-
682
- ---
683
-
684
- ## LEARNING SYSTEM (Biblioteca de Patterns)
685
-
686
- Capture e reutilize patterns bem-sucedidos em `.morph/memory/patterns-learned.md`.
687
-
688
- ### Antes de Começar Nova Feature
689
-
690
- ```bash
691
- # Buscar patterns relevantes
692
- npx morph-spec search-patterns "blazor state"
693
- npx morph-spec search-patterns "background job"
694
- npx morph-spec search-patterns "bicep naming"
695
-
696
- # Output:
697
- 🔍 Found 3 pattern(s) for: "blazor state"
698
-
699
- 1. Blazor DbContext Lifecycle
700
- Category: Anti-Pattern to Avoid
701
- Source: Framework standard
702
-
703
- Problem: Directly injecting DbContext in Blazor components...
704
-
705
- Correct Approach:
706
- [Inject] IDbContextFactory<AppDbContext> DbFactory { get; set; }
707
- ...
708
- ```
709
-
710
- ### Após Completar Feature
711
-
712
- ```bash
713
- # Capturar pattern bem-sucedido
714
- npx morph-spec capture-pattern user-auth success "JWT refresh token rotation"
715
-
716
- # Capturar anti-pattern (o que evitar)
717
- npx morph-spec capture-pattern user-auth avoid "Storing tokens in localStorage"
718
-
719
- # Capturar otimização
720
- npx morph-spec capture-pattern user-auth optimization "EF Core query splitting for N+1"
721
- ```
722
-
723
- ### Categorias de Patterns
724
-
725
- | Categoria | Quando Usar |
726
- |-----------|-------------|
727
- | `success` | Abordagens comprovadas para replicar |
728
- | `avoid` | Anti-patterns e erros cometidos |
729
- | `optimization` | Melhorias de performance |
730
- | `security` | Best practices de segurança |
731
- | `convention` | Convenções do projeto (naming, estrutura) |
732
- | `best-practice` | Práticas gerais recomendadas |
733
-
734
- ### Pattern Library Pré-Seeded
735
-
736
- O framework já vem com 11 patterns em `.morph/memory/patterns-learned.md`:
737
-
738
- - Blazor DbContext Lifecycle (anti-pattern)
739
- - Background Job Retry Strategy (best practice)
740
- - Azure Bicep Resource Naming (convention)
741
- - API Versioning Strategy (architecture)
742
- - EF Core Migration Naming (convention)
743
- - Blazor DI Registration Order (best practice)
744
- - Component Parameter Validation (best practice)
745
- - Async Method Naming (convention)
746
- - Error Handling Strategy (best practice)
747
- - Bicep Output Exports (convention)
748
- - Azure Key Vault Secrets (security)
749
-
750
- **REGRA:** Sempre busque patterns antes de começar. Capture patterns após completar. Biblioteca cresce com o tempo.
751
-
752
- ---
753
-
754
- ## INTERACTIVE DECISIONS (Decisões Estruturadas)
755
-
756
- Use **AskUserQuestion** com templates estruturados em `.morph/templates/decision-prompts.md`.
757
-
758
- ### Quando Usar AskUserQuestion
759
-
760
- **SEMPRE use para:**
761
- - Escolhas arquiteturais (múltiplas abordagens válidas)
762
- - Clarificação de escopo (requisitos ambíguos)
763
- - Override de validators (checkpoint failures)
764
- - Pular fases (features simples sem UIUX)
765
- - Breaking changes (API versioning, migrations)
766
-
767
- ### Pattern 1: Arquitetura Choice
768
-
769
- ```markdown
770
- I've designed two approaches for "user-authentication":
771
-
772
- **Option A: JWT with HttpOnly Cookies**
773
- - Pros: XSS protection, automatic CSRF with SameSite
774
- - Cons: Harder CORS, mobile app compatibility
775
- - Cost: +2 tasks (CSRF middleware)
776
-
777
- **Option B: JWT in Authorization Header**
778
- - Pros: Simpler CORS, better mobile support
779
- - Cons: Requires manual XSS protection
780
- - Cost: +1 task (XSS sanitization)
781
-
782
- Recommendation: Option A (more secure for web apps)
783
-
784
- Which approach do you prefer?
785
- ```
786
-
787
- ### Pattern 2: Scope Clarification
788
-
789
- ```markdown
790
- Analyzing "scheduled-reports" feature. Need clarification:
791
-
792
- 1. **Scope:** Include email delivery or just generation?
793
- 2. **Users:** For admins only or all authenticated users?
794
- 3. **Priority:** Critical (deploy this week) or enhancement (iterate)?
795
- 4. **Format:** PDF only or PDF + Excel + CSV?
796
-
797
- Please clarify so I can generate accurate spec.
798
- ```
799
-
800
- ### Pattern 3: Validator Override
801
-
802
- ```markdown
803
- Checkpoint failed 3 times:
804
-
805
- **Error:** Architecture validator - "DbContext injected directly in ReportsPage.razor"
806
-
807
- **Attempts:**
808
- 1. Tried refactoring to service layer - still triggered (service was scoped)
809
- 2. Tried IDbContextFactory - validator didn't detect pattern
810
- 3. Re-read architecture.md - our implementation is correct per standard
811
-
812
- **Options:**
813
- 1. Skip architecture validator for this checkpoint (risky)
814
- 2. Simplify implementation (use in-memory data, no DB)
815
- 3. Escalate to troubleshooting-expert agent
816
- 4. Pause for your guidance
817
-
818
- What should I do?
819
- ```
820
-
821
- ### Pattern 4: Task Ordering
822
-
823
- ```markdown
824
- Task dependency conflict detected in "user-auth":
825
-
826
- **Circular dependency:**
827
- - T003 (AuthController) depends on T005 (JWT service)
828
- - T005 (JWT service) depends on T003 (AuthController contracts)
829
-
830
- **Proposed resolution:**
831
- 1. Split T003 into T003a (contracts/DTOs) and T003b (controller implementation)
832
- 2. Order: T003a → T005 → T003b
833
-
834
- Approve this task breakdown?
835
- ```
836
-
837
- ### Templates Disponíveis
838
-
839
- Veja `.morph/templates/decision-prompts.md` para templates completos:
840
- - Scope Clarification
841
- - Architecture Choice
842
- - Task Ordering Conflict
843
- - Validation Failure Recovery
844
- - Breaking Change Approval
845
- - Phase Skip Justification
846
-
847
- **REGRA:** Sempre forneça contexto, 2-3 opções específicas, trade-offs, e sua recomendação. Usuário decide.
848
-
849
- ---
850
-
851
- ## ESTRUTURA DO FRAMEWORK
852
-
853
- ```
854
- morph-spec-framework/
855
- ├── stacks/
856
- │ ├── blazor-azure/ # Stack Blazor + Azure
857
- │ │ ├── CLAUDE.md
858
- │ │ ├── .morph/{config, standards, templates, examples}
859
- │ │ └── .claude/{skills, commands}
860
- │ │
861
- │ └── nextjs-supabase/ # Stack Next.js + Supabase
862
- │ ├── CLAUDE.md
863
- │ ├── .morph/{config, standards, templates, examples}
864
- │ └── .claude/{skills}
865
-
866
- ├── framework/ # Compartilhado entre stacks
867
- │ └── standards/{13 files} # coding, architecture, blazor-*, css-*
868
-
869
- └── src/ # CLI (morph-spec)
870
- ```
871
-
872
- ---
873
-
874
- ## COMANDOS
875
-
876
- | Comando | Ação |
877
- |---------|------|
878
- | `/morph-proposal {feature}` | Spec pipeline completo (fases 0-4, auto-continuação com pausas) |
879
- | `/morph-apply {feature}` | Implementar feature (fase 5) |
880
- | `/morph-status` | Dashboard |
881
- | `/morph-archive {feature}` | Arquivar feature concluída |
882
- | `/morph-infra {action}` | Gerenciar infra (Bicep ou Docker) |
883
- | `/morph-preflight` | Validação pre-deploy |
884
- | `/morph-troubleshoot {error}` | Troubleshooting de erros |
885
-
886
- ---
887
-
888
- ## TEMPLATES
889
-
890
- > **Template System v2.0** - Organizado por tecnologia, reutilizável entre stacks, powered by Handlebars
891
-
892
- ### Overview
893
-
894
- Templates estão em `framework/templates/` organizados por **tecnologia** (não por stack):
895
- - `code/dotnet/` - Templates .NET (service, repository, component, etc.)
896
- - `code/typescript/` - Templates TypeScript (contracts, etc.)
897
- - `code/sql/` - Templates SQL (Supabase migrations, RLS policies)
898
- - `infrastructure/azure/` - Bicep templates para Azure
899
- - `infrastructure/docker/` - Dockerfiles e Docker Compose
900
- - `integrations/` - Integrações (Asaas, Clerk, Azure Identity)
901
- - `ui/` - Design systems (CSS, Fluent/Mud themes)
902
- - `saas/` - Multi-tenant patterns
903
-
904
- **Por quê tecnologia?** Permite reutilizar templates entre stacks (ex: service.cs funciona para blazor-azure E nextjs-supabase).
905
-
906
- ### CLI Commands
907
-
908
- ```bash
909
- # Listar todos os templates
910
- morph-spec template list
911
-
912
- # Filtrar por categoria/tecnologia
913
- morph-spec template list --category code
914
- morph-spec template list --phase implement
915
-
916
- # Ver detalhes de um template
917
- morph-spec template show dotnet-backend-service --preview
918
-
919
- # Renderizar template (usando Handlebars)
920
- morph-spec template render dotnet-backend-service UserService.cs '{
921
- "FEATURE_NAME": "user-auth",
922
- "NAMESPACE": "MyApp.Services"
923
- }'
924
-
925
- # Customizar template (criar override stack-specific)
926
- morph-spec template customize dotnet-backend-service --stack blazor-azure
927
- ```
928
-
929
- ### Handlebars Helpers (v2.0)
930
-
931
- **✅ USE (novo):**
932
-
933
- | Helper | Input | Output | Uso |
934
- |--------|-------|--------|-----|
935
- | `{{pascalCase str}}` | `user-auth` | `UserAuth` | Classes |
936
- | `{{camelCase str}}` | `user-auth` | `userAuth` | Variables |
937
- | `{{snakeCase str}}` | `user-auth` | `user_auth` | SQL |
938
- | `{{titleCase str}}` | `user-auth` | `User Auth` | Titles |
939
- | `{{pluralize str}}` | `user` | `users` | Collections |
940
-
941
- **❌ DEPRECADO (v1.0):**
942
-
943
- | Placeholder | Status | Use Instead |
944
- |-------------|--------|-------------|
945
- | `{{FEATURE_NAME_PASCAL}}` | ❌ Deprecated | `{{pascalCase FEATURE_NAME}}` |
946
- | `{{FEATURE_NAME_CAMEL}}` | ❌ Deprecated | `{{camelCase FEATURE_NAME}}` |
947
- | `{{FEATURE_NAME_SNAKE}}` | ❌ Deprecated | `{{snakeCase FEATURE_NAME}}` |
948
-
949
- ### Variáveis Padrão (auto-injetadas)
950
-
951
- | Placeholder | Exemplo |
952
- |-------------|---------|
953
- | `{{FEATURE_NAME}}` | `scheduled-reports` |
954
- | `{{STACK}}` | `Blazor` ou `NextjsSupabase` |
955
- | `{{DATE}}` | `2026-02-17` |
956
- | `{{YEAR}}` | `2026` |
957
- | `{{TIMESTAMP}}` | `2026-02-17T19:38:00Z` |
958
- | `{{NAMESPACE}}` | Auto from config.json |
959
- | `{{AUTHOR}}` | Auto from config.json |
960
-
961
- ### Stack Overrides
962
-
963
- Templates são resolvidos com fallback automático:
964
- 1. `stacks/{stack}/.morph/templates/` (override stack-specific)
965
- 2. `.morph/templates/` (override project-local)
966
- 3. `framework/templates/` (fallback padrão)
967
-
968
- Para customizar um template:
969
- ```bash
970
- morph-spec template customize dotnet-backend-service --stack blazor-azure
971
- # Edite: stacks/blazor-azure/.morph/templates/code/dotnet/backend/service.cs
972
- ```
973
-
974
- ### Documentação Completa
975
-
976
- Veja `framework/templates/README.md` para:
977
- - Estrutura completa de diretórios
978
- - Todos os helpers Handlebars disponíveis
979
- - Como criar novos templates
980
- - Migração v1 → v2
981
-
982
- ---
983
-
984
- ## REFERÊNCIAS
985
-
986
- - `stacks/{stack}/CLAUDE.md` — Instruções específicas da stack
987
- - `stacks/{stack}/.morph/standards/` — Standards da stack
988
- - `stacks/{stack}/.morph/config/agents.json` — Agentes da stack
989
- - `framework/standards/` — Standards compartilhados (coding, architecture)
990
-
991
- ---
992
-
993
- *MORPH-SPEC by Polymorphism Tech*