@polymorphism-tech/morph-spec 4.7.1 → 4.8.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 (138) hide show
  1. package/.morph/analytics/threads-log.jsonl +54 -0
  2. package/.morph/state.json +198 -0
  3. package/LICENSE +1 -2
  4. package/README.md +379 -414
  5. package/bin/morph-spec.js +57 -403
  6. package/bin/validate.js +2 -26
  7. package/claude-plugin.json +2 -2
  8. package/docs/ARCHITECTURE.md +43 -46
  9. package/docs/CHEATSHEET.md +203 -221
  10. package/docs/COMMAND-FLOWS.md +319 -289
  11. package/docs/QUICKSTART.md +2 -8
  12. package/docs/plans/2026-02-22-claude-docs-morph-alignment-analysis.md +2 -0
  13. package/docs/plans/2026-02-22-claude-settings.md +2 -0
  14. package/docs/plans/2026-02-22-morph-cc-alignment-impl.md +2 -0
  15. package/docs/plans/2026-02-22-morph-spec-next.md +2 -0
  16. package/docs/plans/2026-02-22-native-alignment-design.md +2 -0
  17. package/docs/plans/2026-02-22-native-alignment-impl.md +2 -0
  18. package/docs/plans/2026-02-22-native-enrichment-design.md +2 -0
  19. package/docs/plans/2026-02-22-native-enrichment.md +2 -0
  20. package/docs/plans/2026-02-23-ddd-architecture-refactor.md +2 -0
  21. package/docs/plans/2026-02-23-ddd-nextsteps.md +2 -0
  22. package/docs/plans/2026-02-23-infra-architect-refactor.md +2 -0
  23. package/docs/plans/2026-02-23-nextjs-code-review-design.md +2 -1
  24. package/docs/plans/2026-02-23-nextjs-code-review-impl.md +2 -0
  25. package/docs/plans/2026-02-23-nextjs-standards-design.md +2 -1
  26. package/docs/plans/2026-02-23-nextjs-standards-impl.md +2 -0
  27. package/docs/plans/2026-02-24-cli-radical-simplification.md +592 -0
  28. package/docs/plans/2026-02-24-framework-failure-points.md +125 -0
  29. package/docs/plans/2026-02-24-morph-init-design.md +337 -0
  30. package/docs/plans/2026-02-24-morph-init-impl.md +1269 -0
  31. package/docs/plans/2026-02-24-tutorial-command-design.md +71 -0
  32. package/docs/plans/2026-02-24-tutorial-command.md +298 -0
  33. package/framework/CLAUDE.md +2 -2
  34. package/framework/commands/morph-proposal.md +3 -3
  35. package/framework/hooks/README.md +11 -10
  36. package/framework/hooks/claude-code/notification/approval-reminder.js +2 -0
  37. package/framework/hooks/claude-code/post-tool-use/dispatch.js +1 -1
  38. package/framework/hooks/claude-code/pre-tool-use/protect-readonly-files.js +4 -55
  39. package/framework/hooks/claude-code/session-start/inject-morph-context.js +20 -5
  40. package/framework/hooks/claude-code/statusline.py +6 -1
  41. package/framework/hooks/claude-code/stop/validate-completion.js +1 -1
  42. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +1 -1
  43. package/framework/hooks/dev/check-sync-health.js +117 -0
  44. package/framework/hooks/dev/guard-version-numbers.js +57 -0
  45. package/framework/hooks/dev/sync-standards-registry.js +60 -0
  46. package/framework/hooks/dev/sync-template-registry.js +60 -0
  47. package/framework/hooks/dev/validate-skill-format.js +70 -0
  48. package/framework/hooks/dev/validate-standard-format.js +73 -0
  49. package/framework/hooks/shared/payload-utils.js +39 -0
  50. package/framework/hooks/shared/state-reader.js +25 -1
  51. package/framework/rules/morph-workflow.md +1 -1
  52. package/framework/skills/level-0-meta/morph-init/SKILL.md +216 -0
  53. package/framework/skills/level-0-meta/morph-replicate/SKILL.md +4 -4
  54. package/framework/skills/level-0-meta/tool-usage-guide/SKILL.md +4 -4
  55. package/framework/skills/level-0-meta/verification-before-completion/SKILL.md +1 -1
  56. package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +192 -191
  57. package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +181 -180
  58. package/framework/skills/level-1-workflows/phase-design/SKILL.md +339 -338
  59. package/framework/skills/level-1-workflows/phase-implement/SKILL.md +254 -253
  60. package/framework/skills/level-1-workflows/phase-setup/SKILL.md +168 -170
  61. package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +284 -283
  62. package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +246 -245
  63. package/framework/templates/examples/design-system-examples.md +1 -1
  64. package/framework/templates/ui/FluentDesignTheme.cs +1 -1
  65. package/framework/templates/ui/MudTheme.cs +1 -1
  66. package/framework/templates/ui/design-system.css +1 -1
  67. package/package.json +4 -2
  68. package/scripts/bump-version.js +248 -0
  69. package/scripts/install-dev-hooks.js +138 -0
  70. package/src/commands/agents/index.js +1 -2
  71. package/src/commands/index.js +13 -16
  72. package/src/commands/project/doctor.js +100 -14
  73. package/src/commands/project/index.js +7 -10
  74. package/src/commands/project/init.js +398 -555
  75. package/src/commands/project/install-plugin-cmd.js +28 -0
  76. package/src/commands/project/setup-infra-cmd.js +12 -0
  77. package/src/commands/project/tutorial.js +115 -0
  78. package/src/commands/project/update.js +22 -37
  79. package/src/commands/state/approve.js +213 -221
  80. package/src/commands/state/index.js +0 -1
  81. package/src/commands/state/state.js +337 -365
  82. package/src/commands/templates/index.js +0 -4
  83. package/src/commands/trust/trust.js +1 -93
  84. package/src/commands/utils/index.js +1 -5
  85. package/src/commands/validation/index.js +1 -5
  86. package/src/core/registry/command-registry.js +11 -285
  87. package/src/core/state/state-manager.js +5 -2
  88. package/src/lib/detectors/index.js +81 -87
  89. package/src/lib/detectors/structure-detector.js +275 -273
  90. package/src/lib/generators/recap-generator.js +232 -225
  91. package/src/lib/installers/mcp-installer.js +18 -3
  92. package/src/scripts/global-install.js +34 -0
  93. package/src/scripts/install-plugin.js +126 -0
  94. package/src/scripts/setup-infra.js +203 -0
  95. package/src/utils/agents-installer.js +10 -1
  96. package/src/utils/hooks-installer.js +70 -17
  97. package/CLAUDE.md +0 -77
  98. package/docs/claude-alignment-report.md +0 -137
  99. package/docs/examples/order-management/contracts.cs +0 -84
  100. package/docs/examples/order-management/proposal.md +0 -24
  101. package/docs/examples/order-management/spec.md +0 -162
  102. package/src/commands/feature/create-story.js +0 -362
  103. package/src/commands/feature/index.js +0 -6
  104. package/src/commands/feature/shard-spec.js +0 -225
  105. package/src/commands/feature/sprint-status.js +0 -250
  106. package/src/commands/generation/generate-onboarding.js +0 -169
  107. package/src/commands/generation/generate.js +0 -276
  108. package/src/commands/generation/index.js +0 -5
  109. package/src/commands/learning/capture-pattern.js +0 -121
  110. package/src/commands/learning/index.js +0 -5
  111. package/src/commands/learning/search-patterns.js +0 -126
  112. package/src/commands/mcp/mcp.js +0 -102
  113. package/src/commands/project/changes.js +0 -66
  114. package/src/commands/project/cost.js +0 -179
  115. package/src/commands/project/detect.js +0 -114
  116. package/src/commands/project/diff.js +0 -278
  117. package/src/commands/project/revert.js +0 -173
  118. package/src/commands/project/standards.js +0 -80
  119. package/src/commands/project/sync.js +0 -167
  120. package/src/commands/project/update-agents.js +0 -23
  121. package/src/commands/state/rollback-phase.js +0 -185
  122. package/src/commands/templates/template-customize.js +0 -87
  123. package/src/commands/templates/template-list.js +0 -114
  124. package/src/commands/templates/template-show.js +0 -129
  125. package/src/commands/templates/template-validate.js +0 -91
  126. package/src/commands/utils/troubleshoot.js +0 -222
  127. package/src/commands/validation/analyze-blazor-concurrency.js +0 -193
  128. package/src/commands/validation/lint-fluent.js +0 -352
  129. package/src/commands/validation/validate-blazor-state.js +0 -210
  130. package/src/commands/validation/validate-blazor.js +0 -156
  131. package/src/commands/validation/validate-css.js +0 -84
  132. package/src/lib/detectors/conversation-analyzer.js +0 -163
  133. package/src/lib/learning/index.js +0 -7
  134. package/src/lib/learning/learning-system.js +0 -520
  135. package/src/lib/troubleshooting/index.js +0 -8
  136. package/src/lib/troubleshooting/troubleshoot-grep.js +0 -198
  137. package/src/lib/troubleshooting/troubleshoot-index.js +0 -144
  138. package/src/llm/environment-detector.js +0 -43
@@ -1,254 +1,255 @@
1
- ---
2
- name: phase-implement
3
- description: MORPH-SPEC Phase 5 (Implement). Executes feature tasks using TDD with checkpoint validation every 3 tasks, smoke tests via Playwright, and generates code + recap.md. Use after task list approval when starting feature implementation.
4
- argument-hint: "[feature-name]"
5
- disable-model-invocation: true
6
- context: fork
7
- agent: general-purpose
8
- user-invocable: false
9
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
10
- ---
11
-
12
- # MORPH Implement - FASE 5
13
-
14
- > INTERNAL: Workflow skill used by /morph-apply during automated phase orchestration. Not a user command.
15
-
16
- Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap final.
17
-
18
- ## Pré-requisitos
19
-
20
- - [ ] FASE 4 (Tasks) concluída
21
- - [ ] `tasks.md` ou `tasks.json` aprovado pelo usuário
22
- - [ ] Tasks gate (`morph-spec approve $ARGUMENTS tasks`) aprovado
23
- - [ ] Todos os outputs de design existem (spec.md, contracts.cs, decisions.md)
24
-
25
- ## Ferramentas Recomendadas
26
-
27
- > **Ref:** `framework/skills/level-0-meta/tool-usage-guide/SKILL.md` para guia completo.
28
- > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` para referência MCP.
29
- > **Example:** `references/recap-example.md` filled-in recap.md showing expected output quality.
30
-
31
- | Ação | Ferramenta | Alternativa |
32
- |------|------------|-------------|
33
- | Ler task details | **Read** tasks.json, spec.md, contracts.cs | — |
34
- | Criar novos arquivos | **Write** source files | — |
35
- | Modificar arquivos existentes | **Edit** source files | — |
36
- | Consultar API de biblioteca | **Context7 MCP** `query_docs()` | **WebSearch** + **WebFetch** |
37
- | Executar migrations | **Supabase MCP** `query()` | **Bash** `npx supabase migration ...` |
38
- | Build do projeto | **Bash** `dotnet build` ou `npm run build` | |
39
- | Rodar testes | **Bash** `dotnet test` ou `npm test` | — |
40
- | Checkpoint validation | **Bash** `npx morph-spec validate-feature ...` | — |
41
- | Marcar task concluída | **Bash** `npx morph-spec task done $ARGUMENTS T001` | — |
42
- | Smoke test no browser | **Playwright MCP** `browser_navigate()` + `browser_snapshot()` | Manual |
43
- | Verificar erros de console | **Playwright MCP** `browser_console_messages()` | |
44
- | Screenshot para recap | **Playwright MCP** `browser_take_screenshot()` | — |
45
- | Criar PR | **Bash** `gh pr create ...` | **GitHub MCP** `create_pull_request()` |
46
- | Atualizar state | **Bash** `npx morph-spec state set ...` | |
47
-
48
- **MCPs desta fase:** Supabase (migrations, RLS), Context7 (API lookup), Playwright (smoke test), GitHub (PRs).
49
-
50
- **Anti-padrões:**
51
- - ❌ Task agent para editar um único arquivo (use Edit direto)
52
- - Task agent para implementar service layer em 5+ arquivos (multi-file legítimo)
53
- - Bash `cat` para criar arquivos (use Write tool)
54
- - ❌ Bash `sed` para modificar código (use Edit tool)
55
- - ❌ Implementar sem ler contracts.cs primeiro (contracts são a fonte de verdade!)
56
-
57
- ---
58
-
59
- ## Workflow
60
-
61
- ### CHECKPOINT DE ENTRADA: Verificar Pré-requisitos
62
-
63
- **⏸️ Antes de iniciar implementação:**
64
-
65
- - [ ] `tasks.md` ou `tasks.json` existe e foi aprovado?
66
- - [ ] Tasks gate aprovado (`morph-spec approve $ARGUMENTS tasks`)?
67
- - [ ] `spec.md` atualizado com clarificações?
68
- - [ ] `contracts.cs` corresponde ao schema real?
69
- - [ ] Build base do projeto compila sem erros?
70
-
71
- ```bash
72
- npx morph-spec state get $ARGUMENTS
73
- npx morph-spec approval-status $ARGUMENTS
74
- ```
75
-
76
- **❌ Se alguma checkbox NÃO estiver marcada:**
77
- Voltar para a fase correspondente
78
-
79
- ---
80
-
81
- ### Passo 1: Carregar Contexto Completo
82
-
83
- Leia TODOS os outputs antes de implementar:
84
-
85
- 1. `.morph/features/$ARGUMENTS/3-tasks/tasks.md` — Lista de tasks
86
- 2. `.morph/features/$ARGUMENTS/1-design/spec.md` — Especificação completa
87
- 3. `.morph/features/$ARGUMENTS/1-design/contracts.cs` — Interfaces e DTOs
88
- 4. `.morph/features/$ARGUMENTS/1-design/decisions.md` — ADRs
89
- 5. `.morph/features/$ARGUMENTS/1-design/schema-analysis.md` — Schema real (se existir)
90
- 6. `.morph/features/$ARGUMENTS/2-ui/design-system.md` — Design tokens (se existir)
91
-
92
- ### Passo 2: Iniciar Primeira Task
93
-
94
- ```bash
95
- npx morph-spec task next $ARGUMENTS
96
- npx morph-spec task start $ARGUMENTS T001
97
- ```
98
-
99
- Para cada task:
100
-
101
- 1. **Ler a task description** completa
102
- 2. **Ler contracts.cs** para DTOs/interfaces relevantes
103
- 3. **Implementar** usando Write (novo) ou Edit (existente)
104
- 4. **Verificar** build, lint, testes
105
- 5. **Marcar como done:**
106
- ```bash
107
- npx morph-spec task done $ARGUMENTS T001
108
- ```
109
-
110
- ### Passo 3: Checkpoint a Cada 3 Tasks
111
-
112
- **A cada 3 tasks completadas:**
113
-
114
- ```bash
115
- # Save checkpoint
116
- npx morph-spec checkpoint-save $ARGUMENTS
117
-
118
- # Run validation
119
- npx morph-spec validate-feature $ARGUMENTS --phase implement
120
- ```
121
-
122
- **Se validação falhar:**
123
- 1. NÃO avançar para próxima task
124
- 2. Corrigir issues reportados
125
- 3. Re-rodar validação
126
- 4. então prosseguir
127
-
128
- ### Passo 4: Test-Driven Development (Recomendado)
129
-
130
- Para cada task de implementação:
131
-
132
- 1. **Escrever teste primeiro** (unit test para service/domain)
133
- 2. **Rodar teste** deve falhar (RED)
134
- 3. **Implementar** o mínimo para passar
135
- 4. **Rodar teste** deve passar (GREEN)
136
- 5. **Refatorar** se necessário (REFACTOR)
137
-
138
- ```bash
139
- # .NET
140
- dotnet test --filter "FullyQualifiedName~{TestClass}"
141
-
142
- # Node.js
143
- npm test -- test/path/to/test.js
144
- ```
145
-
146
- ### Passo 5: Smoke Test com Playwright (se UI)
147
-
148
- Após implementar componentes visuais:
149
-
150
- ```javascript
151
- // Navegar para a página
152
- await mcp__playwright__browser_navigate({ url: 'http://localhost:5000/feature-page' });
153
-
154
- // Capturar estado da página
155
- await mcp__playwright__browser_snapshot();
156
-
157
- // Verificar erros de console
158
- await mcp__playwright__browser_console_messages({ level: 'error' });
159
-
160
- // Screenshot para recap
161
- await mcp__playwright__browser_take_screenshot({ type: 'png' });
162
- ```
163
-
164
- ### Passo 6: Gerar `recap.md`
165
-
166
- Após TODAS as tasks completadas:
167
-
168
- ```bash
169
- npx morph-spec generate recap $ARGUMENTS
170
- ```
171
-
172
- Ou crie manualmente `.morph/features/$ARGUMENTS/4-implement/recap.md`:
173
-
174
- ```markdown
175
- # Recap — {Feature Name}
176
-
177
- ## Summary
178
- {1-2 parágrafos descrevendo o que foi implementado}
179
-
180
- ## Tasks Completed
181
- - [x] T001: {título}
182
- - [x] T002: {título}
183
- - ...
184
-
185
- ## Key Decisions During Implementation
186
- - {Decisão 1}: {Razão}
187
- - {Decisão 2}: {Razão}
188
-
189
- ## Files Created/Modified
190
- {Lista de arquivos}
191
-
192
- ## Tests
193
- - Unit tests: X passing
194
- - Integration tests: Y passing
195
-
196
- ## Validation Results
197
- {Output do morph-spec validate-feature}
198
-
199
- ## Screenshots
200
- {Se UI, incluir screenshots}
201
- ```
202
-
203
- ### Passo 7: Atualizar State
204
-
205
- ```bash
206
- npx morph-spec state set $ARGUMENTS phase implement
207
- npx morph-spec state set $ARGUMENTS status done
208
- npx morph-spec state mark-output $ARGUMENTS recap
209
- ```
210
-
211
- ---
212
-
213
- ## Integração com Superpowers
214
-
215
- > Disponível quando o plugin `superpowers` está instalado.
216
-
217
- | Skill | Quando Usar | Invocação |
218
- |-------|-------------|-----------|
219
- | `test-driven-development` | Para cada task de implementação | `Skill(superpowers:test-driven-development)` |
220
- | `systematic-debugging` | Quando testes falham ou erros inesperados | `Skill(superpowers:systematic-debugging)` |
221
- | `requesting-code-review` | Após implementação completa | `Skill(superpowers:requesting-code-review)` |
222
- | `verification-before-completion` | Antes de marcar feature como done | Use `verification-before-completion` (morph-spec version) |
223
-
224
- ---
225
-
226
- ## Outputs Gerados
227
-
228
- - Código fonte implementado (vários arquivos)
229
- - Testes unitários e de integração
230
- - `.morph/features/$ARGUMENTS/4-implement/recap.md` Resumo da implementação
231
-
232
- ## Critérios de Conclusão
233
-
234
- - [x] Todas as tasks completadas
235
- - [x] Build compila sem erros
236
- - [x] Testes passando
237
- - [x] Validation pipeline passa
238
- - [x] `recap.md` gerado
239
- - [x] State atualizado para `status: done`
240
- - [x] Checkpoints salvos a cada 3 tasks
241
-
242
- ---
243
-
244
- ## Outputs desta Fase
245
-
246
- <!-- morph:outputs:implement -->
247
- | Output | Caminho |
248
- |--------|---------|
249
- | `recap` | `.morph/features/{feature}/4-implement/recap.md` |
250
- <!-- /morph:outputs -->
251
-
252
- ---
253
-
1
+ ---
2
+ name: phase-implement
3
+ description: MORPH-SPEC Phase 5 (Implement). Executes feature tasks using TDD with checkpoint validation every 3 tasks, smoke tests via Playwright, and generates code + recap.md. Use after task list approval when starting feature implementation.
4
+ argument-hint: "[feature-name]"
5
+ disable-model-invocation: true
6
+ context: fork
7
+ agent: general-purpose
8
+ user-invocable: false
9
+ cliVersion: "4.8.1"
10
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
11
+ ---
12
+
13
+ # MORPH Implement - FASE 5
14
+
15
+ > INTERNAL: Workflow skill used by /morph-apply during automated phase orchestration. Not a user command.
16
+
17
+ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap final.
18
+
19
+ ## Pré-requisitos
20
+
21
+ - [ ] FASE 4 (Tasks) concluída
22
+ - [ ] `tasks.md` ou `tasks.json` aprovado pelo usuário
23
+ - [ ] Tasks gate (`morph-spec approve $ARGUMENTS tasks`) aprovado
24
+ - [ ] Todos os outputs de design existem (spec.md, contracts.cs, decisions.md)
25
+
26
+ ## Ferramentas Recomendadas
27
+
28
+ > **Ref:** `framework/skills/level-0-meta/tool-usage-guide/SKILL.md` para guia completo.
29
+ > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` para referência MCP.
30
+ > **Example:** `references/recap-example.md` — filled-in recap.md showing expected output quality.
31
+
32
+ | Ação | Ferramenta | Alternativa |
33
+ |------|------------|-------------|
34
+ | Ler task details | **Read** tasks.json, spec.md, contracts.cs | — |
35
+ | Criar novos arquivos | **Write** source files | — |
36
+ | Modificar arquivos existentes | **Edit** source files | |
37
+ | Consultar API de biblioteca | **Context7 MCP** `query_docs()` | **WebSearch** + **WebFetch** |
38
+ | Executar migrations | **Supabase MCP** `query()` | **Bash** `npx supabase migration ...` |
39
+ | Build do projeto | **Bash** `dotnet build` ou `npm run build` | — |
40
+ | Rodar testes | **Bash** `dotnet test` ou `npm test` | — |
41
+ | Checkpoint validation | **Bash** `npx morph-spec validate-feature ...` | — |
42
+ | Marcar task concluída | **Bash** `npx morph-spec task done $ARGUMENTS T001` | |
43
+ | Smoke test no browser | **Playwright MCP** `browser_navigate()` + `browser_snapshot()` | Manual |
44
+ | Verificar erros de console | **Playwright MCP** `browser_console_messages()` | — |
45
+ | Screenshot para recap | **Playwright MCP** `browser_take_screenshot()` | — |
46
+ | Criar PR | **Bash** `gh pr create ...` | **GitHub MCP** `create_pull_request()` |
47
+ | Atualizar state | **Bash** `npx morph-spec state set ...` | — |
48
+
49
+ **MCPs desta fase:** Supabase (migrations, RLS), Context7 (API lookup), Playwright (smoke test), GitHub (PRs).
50
+
51
+ **Anti-padrões:**
52
+ - Task agent para editar um único arquivo (use Edit direto)
53
+ - Task agent para implementar service layer em 5+ arquivos (multi-file legítimo)
54
+ - ❌ Bash `cat` para criar arquivos (use Write tool)
55
+ - ❌ Bash `sed` para modificar código (use Edit tool)
56
+ - ❌ Implementar sem ler contracts.cs primeiro (contracts são a fonte de verdade!)
57
+
58
+ ---
59
+
60
+ ## Workflow
61
+
62
+ ### CHECKPOINT DE ENTRADA: Verificar Pré-requisitos
63
+
64
+ **⏸️ Antes de iniciar implementação:**
65
+
66
+ - [ ] `tasks.md` ou `tasks.json` existe e foi aprovado?
67
+ - [ ] Tasks gate aprovado (`morph-spec approve $ARGUMENTS tasks`)?
68
+ - [ ] `spec.md` atualizado com clarificações?
69
+ - [ ] `contracts.cs` corresponde ao schema real?
70
+ - [ ] Build base do projeto compila sem erros?
71
+
72
+ ```bash
73
+ npx morph-spec state get $ARGUMENTS
74
+ npx morph-spec approval-status $ARGUMENTS
75
+ ```
76
+
77
+ **❌ Se alguma checkbox NÃO estiver marcada:**
78
+ → Voltar para a fase correspondente
79
+
80
+ ---
81
+
82
+ ### Passo 1: Carregar Contexto Completo
83
+
84
+ Leia TODOS os outputs antes de implementar:
85
+
86
+ 1. `.morph/features/$ARGUMENTS/3-tasks/tasks.md` — Lista de tasks
87
+ 2. `.morph/features/$ARGUMENTS/1-design/spec.md` — Especificação completa
88
+ 3. `.morph/features/$ARGUMENTS/1-design/contracts.cs` — Interfaces e DTOs
89
+ 4. `.morph/features/$ARGUMENTS/1-design/decisions.md` — ADRs
90
+ 5. `.morph/features/$ARGUMENTS/1-design/schema-analysis.md` — Schema real (se existir)
91
+ 6. `.morph/features/$ARGUMENTS/2-ui/design-system.md` — Design tokens (se existir)
92
+
93
+ ### Passo 2: Iniciar Primeira Task
94
+
95
+ ```bash
96
+ npx morph-spec task next $ARGUMENTS
97
+ npx morph-spec task start $ARGUMENTS T001
98
+ ```
99
+
100
+ Para cada task:
101
+
102
+ 1. **Ler a task description** completa
103
+ 2. **Ler contracts.cs** para DTOs/interfaces relevantes
104
+ 3. **Implementar** usando Write (novo) ou Edit (existente)
105
+ 4. **Verificar** build, lint, testes
106
+ 5. **Marcar como done:**
107
+ ```bash
108
+ npx morph-spec task done $ARGUMENTS T001
109
+ ```
110
+
111
+ ### Passo 3: Checkpoint a Cada 3 Tasks
112
+
113
+ **A cada 3 tasks completadas:**
114
+
115
+ ```bash
116
+ # Save checkpoint
117
+ npx morph-spec checkpoint-save $ARGUMENTS
118
+
119
+ # Run validation
120
+ npx morph-spec validate-feature $ARGUMENTS --phase implement
121
+ ```
122
+
123
+ **Se validação falhar:**
124
+ 1. NÃO avançar para próxima task
125
+ 2. Corrigir issues reportados
126
+ 3. Re-rodar validação
127
+ 4. Só então prosseguir
128
+
129
+ ### Passo 4: Test-Driven Development (Recomendado)
130
+
131
+ Para cada task de implementação:
132
+
133
+ 1. **Escrever teste primeiro** (unit test para service/domain)
134
+ 2. **Rodar teste** deve falhar (RED)
135
+ 3. **Implementar** o mínimo para passar
136
+ 4. **Rodar teste** deve passar (GREEN)
137
+ 5. **Refatorar** se necessário (REFACTOR)
138
+
139
+ ```bash
140
+ # .NET
141
+ dotnet test --filter "FullyQualifiedName~{TestClass}"
142
+
143
+ # Node.js
144
+ npm test -- test/path/to/test.js
145
+ ```
146
+
147
+ ### Passo 5: Smoke Test com Playwright (se UI)
148
+
149
+ Após implementar componentes visuais:
150
+
151
+ ```javascript
152
+ // Navegar para a página
153
+ await mcp__playwright__browser_navigate({ url: 'http://localhost:5000/feature-page' });
154
+
155
+ // Capturar estado da página
156
+ await mcp__playwright__browser_snapshot();
157
+
158
+ // Verificar erros de console
159
+ await mcp__playwright__browser_console_messages({ level: 'error' });
160
+
161
+ // Screenshot para recap
162
+ await mcp__playwright__browser_take_screenshot({ type: 'png' });
163
+ ```
164
+
165
+ ### Passo 6: Gerar `recap.md`
166
+
167
+ Após TODAS as tasks completadas:
168
+
169
+ ```bash
170
+ npx morph-spec generate recap $ARGUMENTS
171
+ ```
172
+
173
+ Ou crie manualmente `.morph/features/$ARGUMENTS/4-implement/recap.md`:
174
+
175
+ ```markdown
176
+ # Recap — {Feature Name}
177
+
178
+ ## Summary
179
+ {1-2 parágrafos descrevendo o que foi implementado}
180
+
181
+ ## Tasks Completed
182
+ - [x] T001: {título}
183
+ - [x] T002: {título}
184
+ - ...
185
+
186
+ ## Key Decisions During Implementation
187
+ - {Decisão 1}: {Razão}
188
+ - {Decisão 2}: {Razão}
189
+
190
+ ## Files Created/Modified
191
+ {Lista de arquivos}
192
+
193
+ ## Tests
194
+ - Unit tests: X passing
195
+ - Integration tests: Y passing
196
+
197
+ ## Validation Results
198
+ {Output do morph-spec validate-feature}
199
+
200
+ ## Screenshots
201
+ {Se UI, incluir screenshots}
202
+ ```
203
+
204
+ ### Passo 7: Atualizar State
205
+
206
+ ```bash
207
+ npx morph-spec state set $ARGUMENTS phase implement
208
+ npx morph-spec state set $ARGUMENTS status done
209
+ npx morph-spec state mark-output $ARGUMENTS recap
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Integração com Superpowers
215
+
216
+ > Disponível quando o plugin `superpowers` está instalado.
217
+
218
+ | Skill | Quando Usar | Invocação |
219
+ |-------|-------------|-----------|
220
+ | `test-driven-development` | Para cada task de implementação | `Skill(superpowers:test-driven-development)` |
221
+ | `systematic-debugging` | Quando testes falham ou erros inesperados | `Skill(superpowers:systematic-debugging)` |
222
+ | `requesting-code-review` | Após implementação completa | `Skill(superpowers:requesting-code-review)` |
223
+ | `verification-before-completion` | Antes de marcar feature como done | Use `verification-before-completion` (morph-spec version) |
224
+
225
+ ---
226
+
227
+ ## Outputs Gerados
228
+
229
+ - Código fonte implementado (vários arquivos)
230
+ - Testes unitários e de integração
231
+ - `.morph/features/$ARGUMENTS/4-implement/recap.md` — Resumo da implementação
232
+
233
+ ## Critérios de Conclusão
234
+
235
+ - [x] Todas as tasks completadas
236
+ - [x] Build compila sem erros
237
+ - [x] Testes passando
238
+ - [x] Validation pipeline passa
239
+ - [x] `recap.md` gerado
240
+ - [x] State atualizado para `status: done`
241
+ - [x] Checkpoints salvos a cada 3 tasks
242
+
243
+ ---
244
+
245
+ ## Outputs desta Fase
246
+
247
+ <!-- morph:outputs:implement -->
248
+ | Output | Caminho |
249
+ |--------|---------|
250
+ | `recap` | `.morph/features/{feature}/4-implement/recap.md` |
251
+ <!-- /morph:outputs -->
252
+
253
+ ---
254
+
254
255
  Feature completa! Considere criar um PR e rodar `morph-spec session-summary $ARGUMENTS`.