@polymorphism-tech/morph-spec 4.8.12 → 4.8.15
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.
- package/README.md +379 -379
- package/bin/morph-spec.js +23 -2
- package/bin/{task-manager.cjs → task-manager.js} +249 -172
- package/claude-plugin.json +14 -14
- package/docs/CHEATSHEET.md +203 -203
- package/docs/QUICKSTART.md +1 -1
- package/framework/agents.json +224 -140
- package/framework/hooks/README.md +202 -202
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +48 -2
- package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +151 -0
- package/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +12 -0
- package/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +6 -0
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +34 -0
- package/framework/hooks/claude-code/statusline.py +6 -0
- package/framework/hooks/claude-code/stop/validate-completion.js +38 -4
- package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +87 -0
- package/framework/hooks/claude-code/user-prompt/set-terminal-title.js +58 -0
- package/framework/hooks/shared/phase-utils.js +4 -1
- package/framework/hooks/shared/state-reader.js +1 -0
- package/framework/skills/README.md +1 -0
- package/framework/skills/level-0-meta/brainstorming/SKILL.md +2 -0
- package/framework/skills/level-0-meta/code-review/SKILL.md +16 -0
- package/framework/skills/level-0-meta/code-review/references/review-guidelines.md +100 -0
- package/framework/skills/level-0-meta/code-review/scripts/scan-csharp.mjs +36 -6
- package/framework/skills/level-0-meta/code-review-nextjs/SKILL.md +16 -0
- package/framework/skills/level-0-meta/code-review-nextjs/scripts/scan-nextjs.mjs +189 -0
- package/framework/skills/level-0-meta/frontend-review/SKILL.md +359 -0
- package/framework/skills/level-0-meta/frontend-review/scripts/scan-accessibility.mjs +376 -0
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +1 -1
- package/framework/skills/level-0-meta/morph-replicate/SKILL.md +10 -8
- package/framework/skills/level-0-meta/morph-replicate/references/blazor-html-mapping.md +70 -0
- package/framework/skills/level-0-meta/post-implementation/SKILL.md +315 -0
- package/framework/skills/level-0-meta/post-implementation/scripts/detect-dev-server.mjs +153 -0
- package/framework/skills/level-0-meta/post-implementation/scripts/detect-stack.mjs +234 -0
- package/framework/skills/level-0-meta/terminal-title/SKILL.md +61 -0
- package/framework/skills/level-0-meta/terminal-title/scripts/set_title.sh +65 -0
- package/framework/skills/level-0-meta/tool-usage-guide/SKILL.md +50 -188
- package/framework/skills/level-0-meta/tool-usage-guide/references/tools-per-phase.md +213 -0
- package/framework/skills/level-0-meta/verification-before-completion/SKILL.md +2 -0
- package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +4 -7
- package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +71 -109
- package/framework/skills/level-1-workflows/phase-design/references/architecture-analysis-guide.md +89 -0
- package/framework/skills/level-1-workflows/phase-design/references/spec-authoring-guide.md +55 -0
- package/framework/skills/level-1-workflows/phase-implement/SKILL.md +171 -114
- package/framework/skills/level-1-workflows/phase-implement/references/vsa-implementation-guide.md +92 -0
- package/framework/skills/level-1-workflows/phase-setup/SKILL.md +1 -2
- package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +35 -159
- package/framework/skills/level-1-workflows/phase-tasks/references/task-planning-patterns.md +172 -0
- package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +42 -3
- package/framework/squad-templates/backend-only.json +14 -1
- package/framework/squad-templates/frontend-only.json +14 -1
- package/framework/squad-templates/full-stack.json +25 -8
- package/framework/standards/STANDARDS.json +631 -86
- package/framework/standards/frontend/design-system/aesthetic-direction.md +213 -0
- package/framework/templates/project/validate.js +122 -0
- package/framework/workflows/configs/zero-touch.json +7 -0
- package/package.json +87 -87
- package/src/commands/agents/dispatch-agents.js +53 -10
- package/src/commands/state/advance-phase.js +88 -13
- package/src/commands/state/index.js +2 -1
- package/src/commands/state/phase-runner.js +215 -0
- package/src/commands/tasks/task.js +25 -4
- package/src/core/paths/output-schema.js +2 -1
- package/src/lib/detectors/design-system-detector.js +5 -4
- package/src/lib/generators/recap-generator.js +16 -0
- package/src/lib/orchestration/team-orchestrator.js +171 -89
- package/src/lib/phase-chain/eligibility-checker.js +243 -0
- package/src/lib/standards/digest-builder.js +231 -0
- package/src/lib/tasks/task-parser.js +94 -0
- package/src/lib/validators/blazor/blazor-concurrency-analyzer.js +39 -0
- package/src/lib/validators/content/content-validator.js +34 -106
- package/src/lib/validators/nextjs/next-component-validator.js +2 -0
- package/src/lib/validators/validation-runner.js +2 -2
- package/src/utils/file-copier.js +1 -0
- package/src/utils/hooks-installer.js +31 -7
|
@@ -6,7 +6,7 @@ disable-model-invocation: true
|
|
|
6
6
|
context: fork
|
|
7
7
|
agent: general-purpose
|
|
8
8
|
user-invocable: false
|
|
9
|
-
cliVersion: "4.8.
|
|
9
|
+
cliVersion: "4.8.15"
|
|
10
10
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -31,8 +31,9 @@ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap
|
|
|
31
31
|
|
|
32
32
|
| Ação | Ferramenta | Alternativa |
|
|
33
33
|
|------|------------|-------------|
|
|
34
|
-
| Verificar
|
|
35
|
-
| **Dispatch implementadores por domínio** (
|
|
34
|
+
| Verificar modo de execução (single/subagents/agent-teams) | **Bash** `npx morph-spec dispatch-agents $ARGUMENTS implement` | Grupos de tasks + prompts de subagents |
|
|
35
|
+
| **Dispatch implementadores por domínio** (subagents) | **Task** subagents — um por grupo | Backend + frontend + infra em paralelo |
|
|
36
|
+
| **Criar Agent Team** (features críticas multi-domínio) | Linguagem natural — veja Passo 0.5b | — |
|
|
36
37
|
| Ler task details | **Read** tasks.json, spec.md, contracts.cs | — |
|
|
37
38
|
| Criar novos arquivos | **Write** source files | — |
|
|
38
39
|
| Modificar arquivos existentes | **Edit** source files | — |
|
|
@@ -54,6 +55,9 @@ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap
|
|
|
54
55
|
- ❌ Task agent para editar um único arquivo (use Edit direto)
|
|
55
56
|
- ✅ Task agent para implementar service layer em 5+ arquivos (multi-file legítimo)
|
|
56
57
|
- ✅ Task agents paralelos quando `tasks.total ≥ 6` e feature tem 2+ domínios ativos
|
|
58
|
+
- ✅ Agent Teams quando backend e frontend precisam coordenar contratos de API
|
|
59
|
+
- ❌ Agent Teams para features single-domain (subagents são suficientes)
|
|
60
|
+
- ❌ Agent Teams sem plan approval (cria risco de implementações divergentes)
|
|
57
61
|
- ❌ Bash `cat` para criar arquivos (use Write tool)
|
|
58
62
|
- ❌ Bash `sed` para modificar código (use Edit tool)
|
|
59
63
|
- ❌ Implementar sem ler contracts.cs primeiro (contracts são a fonte de verdade!)
|
|
@@ -65,9 +69,46 @@ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap
|
|
|
65
69
|
|
|
66
70
|
---
|
|
67
71
|
|
|
72
|
+
## ✅ PRÉ-VOO OBRIGATÓRIO (antes de iniciar implementação)
|
|
73
|
+
|
|
74
|
+
### 1. Ler contexto completo em PARALELO
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
# Uma única chamada, não sequencial:
|
|
78
|
+
Read: .morph/features/{feature}/3-tasks/tasks.md
|
|
79
|
+
+ Read: .morph/features/{feature}/1-design/spec.md
|
|
80
|
+
+ Read: .morph/features/{feature}/1-design/contracts.cs
|
|
81
|
+
+ Read: .morph/config/config.json (→ architecture.style)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 2. Criar native tasks individuais por T001-T00N
|
|
85
|
+
|
|
86
|
+
Após ler `tasks.md` no passo 1, crie **uma native task por task encontrada**:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
# Para cada task em tasks.md (T001, T002, ..., T00N):
|
|
90
|
+
TaskCreate: "{T001}: {título da task}" → description: descrição completa → activeForm: "Implementando T001"
|
|
91
|
+
TaskCreate: "{T002}: {título da task}" → description: descrição completa → activeForm: "Implementando T002"
|
|
92
|
+
... (uma TaskCreate por task)
|
|
93
|
+
|
|
94
|
+
# Tarefas orquestrais sempre ao final:
|
|
95
|
+
TaskCreate: "Checkpoints e validação" → activeForm: "Validando checkpoint"
|
|
96
|
+
TaskCreate: "Gerar recap.md" → activeForm: "Gerando recap"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Após criar todas as tasks, configure dependências espelhando `tasks.md`:**
|
|
100
|
+
```
|
|
101
|
+
# Para cada task com `dependencies: [T00X, T00Y]` em tasks.md:
|
|
102
|
+
TaskUpdate(taskId="<id de T003>", addBlockedBy=["<id de T001>", "<id de T002>"])
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
> Guarde o mapeamento `{T001 → taskId}` internamente para usar nos TaskUpdates do loop.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
68
109
|
## Workflow
|
|
69
110
|
|
|
70
|
-
### Passo 0.5: Planejar
|
|
111
|
+
### Passo 0.5: Planejar Modo de Execução
|
|
71
112
|
|
|
72
113
|
**Execute antes de qualquer implementação:**
|
|
73
114
|
|
|
@@ -75,7 +116,17 @@ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap
|
|
|
75
116
|
npx morph-spec dispatch-agents $ARGUMENTS implement
|
|
76
117
|
```
|
|
77
118
|
|
|
78
|
-
**
|
|
119
|
+
**O output inclui um campo `mode` que determina o caminho de execução:**
|
|
120
|
+
|
|
121
|
+
| `mode` | Ação |
|
|
122
|
+
|--------|------|
|
|
123
|
+
| `"single"` | → Continue para o workflow sequencial normal (Passo 1) |
|
|
124
|
+
| `"subagents"` | → Dispatch Task subagents em paralelo (abaixo) |
|
|
125
|
+
| `"agent-teams"` | → Crie Agent Team com plan approval (Passo 0.5b) |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
#### Modo `"subagents"` (se `mode: "subagents"` no output):
|
|
79
130
|
|
|
80
131
|
1. Leia os `taskGroups` retornados (ex: `backend`, `frontend`, `infra`)
|
|
81
132
|
2. Para cada grupo com ≥ 3 tasks e sem dependências cruzadas, use **Task tool** com o `taskPrompt` do dispatch config:
|
|
@@ -91,12 +142,21 @@ Contexto completo:
|
|
|
91
142
|
- Contracts: [conteúdo de .morph/features/$ARGUMENTS/1-design/contracts.cs]
|
|
92
143
|
- Tasks do grupo: [lista de TXXX do grupo backend]
|
|
93
144
|
|
|
145
|
+
# No início deste subagent (grupo BACKEND):
|
|
146
|
+
# 1. Criar native task por task do grupo:
|
|
147
|
+
# TaskCreate: "{T00X}: {título}" → activeForm: "Implementando T00X"
|
|
148
|
+
# 2. Configurar dependências do grupo via TaskUpdate:
|
|
149
|
+
# TaskUpdate(taskId="<id de T003>", addBlockedBy=["<id de T001>", "<id de T002>"])
|
|
150
|
+
# Guarde o mapeamento {T00X → taskId} para usar no loop abaixo.
|
|
151
|
+
|
|
94
152
|
Para cada task do grupo, em ordem:
|
|
95
|
-
1.
|
|
96
|
-
2.
|
|
97
|
-
3.
|
|
98
|
-
4.
|
|
99
|
-
5.
|
|
153
|
+
1. TaskUpdate(taskId="<native id de T00X>", status="in_progress")
|
|
154
|
+
2. Execute: npx morph-spec task start $ARGUMENTS TXXX
|
|
155
|
+
3. Leia a descrição completa da task
|
|
156
|
+
4. Implemente os arquivos — use Write (novo) ou Edit (existente)
|
|
157
|
+
5. Verifique build: [dotnet build / npm run build]
|
|
158
|
+
6. Execute: npx morph-spec task done $ARGUMENTS TXXX
|
|
159
|
+
7. Se task done retornar sem erro: TaskUpdate(taskId="<native id de T00X>", status="completed")
|
|
100
160
|
|
|
101
161
|
A cada 3 tasks:
|
|
102
162
|
- Execute: npx morph-spec checkpoint-save $ARGUMENTS
|
|
@@ -112,11 +172,59 @@ Restrições OBRIGATÓRIAS:
|
|
|
112
172
|
3. Dispare os Task subagents dos grupos em **paralelo** (quando sem dependências entre si)
|
|
113
173
|
4. Após todos completarem, valide integração: `npx morph-spec validate-feature $ARGUMENTS --phase implement`
|
|
114
174
|
|
|
115
|
-
**Se `
|
|
175
|
+
**Se `mode: "single"`** (feature pequena ou single-domain):
|
|
116
176
|
→ Continue para o workflow sequencial normal abaixo.
|
|
117
177
|
|
|
118
178
|
---
|
|
119
179
|
|
|
180
|
+
### Passo 0.5b: Agent Teams (features críticas multi-domínio)
|
|
181
|
+
|
|
182
|
+
**Quando usar:** `mode: "agent-teams"` no output de `dispatch-agents`
|
|
183
|
+
**Requisito:** `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` no `.claude/settings.local.json` (instalado pelo morph-spec)
|
|
184
|
+
|
|
185
|
+
**Por que Agent Teams em vez de subagents:**
|
|
186
|
+
Agent Teams têm TaskList compartilhada, mensagens diretas entre teammates e hooks `TeammateIdle`. Subagents são fire-and-forget. Para features onde backend e frontend precisam coordenar contratos de API, Agent Teams garantem que o frontend não implemente chamadas antes do backend estabilizar os DTOs.
|
|
187
|
+
|
|
188
|
+
**1. Crie o Agent Team com linguagem natural:**
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
Crie um agent team para implementar a feature '$ARGUMENTS' com teammates:
|
|
192
|
+
- Backend teammate (dotnet-senior): Implemente as tasks do grupo backend.
|
|
193
|
+
Contexto: .morph/features/$ARGUMENTS/1-design/spec.md, contracts.cs, standards/coding.md
|
|
194
|
+
Restrição: Modifique APENAS arquivos de backend/domain/application.
|
|
195
|
+
Antes de implementar interfaces compartilhadas, envie mensagem ao frontend teammate.
|
|
196
|
+
- Frontend teammate (blazor-builder OU nextjs-expert): Implemente as tasks do grupo frontend.
|
|
197
|
+
Contexto: .morph/features/$ARGUMENTS/1-design/spec.md, design-system.md, standards/frontend/
|
|
198
|
+
Restrição: Modifique APENAS arquivos de UI/components/pages.
|
|
199
|
+
Aguarde confirmação do backend teammate antes de implementar chamadas de API.
|
|
200
|
+
- Quality teammate (standards-architect): Revise o output de cada teammate e execute validate-feature.
|
|
201
|
+
Exija plan approval antes de cada implementação.
|
|
202
|
+
Só aprove planos que correspondam ao contracts.cs e spec.md.
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**2. Protocolo de coordenação entre teammates:**
|
|
206
|
+
|
|
207
|
+
- Backend deve completar definição de DTOs/interfaces ANTES do frontend implementar chamadas de API
|
|
208
|
+
- Para qualquer interface compartilhada: backend envia mensagem ao frontend confirmando contratos estáveis
|
|
209
|
+
- Se frontend precisar de um endpoint que não existe → instrua a enviar mensagem ao backend teammate
|
|
210
|
+
- Conflitos de contratos → escalone ao quality teammate para resolver
|
|
211
|
+
|
|
212
|
+
**3. Configurações obrigatórias ao criar o team:**
|
|
213
|
+
|
|
214
|
+
- Habilite **plan approval**: "Require plan approval before each teammate implements"
|
|
215
|
+
- Gate de qualidade: "Only approve plans that match contracts.cs and spec.md"
|
|
216
|
+
- Restrição de domínio por teammate: cada um modifica APENAS arquivos do seu domínio
|
|
217
|
+
|
|
218
|
+
**4. Após todos os teammates completarem:**
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npx morph-spec validate-feature $ARGUMENTS --phase implement
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Sintetize os resultados de todos os teammates no recap.md (Passo 6).
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
120
228
|
### CHECKPOINT DE ENTRADA: Verificar Pré-requisitos
|
|
121
229
|
|
|
122
230
|
**⏸️ Antes de iniciar implementação:**
|
|
@@ -139,7 +247,7 @@ npx morph-spec approval-status $ARGUMENTS
|
|
|
139
247
|
|
|
140
248
|
### Passo 1: Carregar Contexto Completo
|
|
141
249
|
|
|
142
|
-
Leia
|
|
250
|
+
Leia todos os outputs antes de implementar:
|
|
143
251
|
|
|
144
252
|
1. `.morph/features/$ARGUMENTS/3-tasks/tasks.md` — Lista de tasks
|
|
145
253
|
2. `.morph/features/$ARGUMENTS/1-design/spec.md` — Especificação completa
|
|
@@ -159,71 +267,11 @@ Caso contrário → vá direto para o Passo 2.
|
|
|
159
267
|
|
|
160
268
|
### Passo 1.5: Guia de Implementação VSA (somente se `style: "vertical-slice"`)
|
|
161
269
|
|
|
162
|
-
>
|
|
163
|
-
|
|
164
|
-
**Estrutura de arquivos obrigatória por slice:**
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
Features/
|
|
168
|
-
└── {Entity}Feature/
|
|
169
|
-
├── {Entity}Errors.cs ← 1 arquivo por feature (compartilhado)
|
|
170
|
-
├── Create{Entity}/
|
|
171
|
-
│ ├── Create{Entity}Handler.cs ← Request + Response records + Handler
|
|
172
|
-
│ ├── Create{Entity}Validator.cs ← AbstractValidator<Request>
|
|
173
|
-
│ └── Create{Entity}Endpoint.cs ← IApiEndpoint (internal sealed)
|
|
174
|
-
├── GetAll{Entity}s/
|
|
175
|
-
│ ├── GetAll{Entity}sHandler.cs ← sem Validator (sem parâmetros)
|
|
176
|
-
│ └── GetAll{Entity}sEndpoint.cs
|
|
177
|
-
├── Get{Entity}ById/
|
|
178
|
-
│ ├── Get{Entity}ByIdHandler.cs
|
|
179
|
-
│ ├── Get{Entity}ByIdValidator.cs
|
|
180
|
-
│ └── Get{Entity}ByIdEndpoint.cs
|
|
181
|
-
├── Update{Entity}/
|
|
182
|
-
│ ├── Update{Entity}Handler.cs
|
|
183
|
-
│ ├── Update{Entity}Validator.cs
|
|
184
|
-
│ └── Update{Entity}Endpoint.cs
|
|
185
|
-
└── Delete{Entity}/
|
|
186
|
-
├── Delete{Entity}Handler.cs
|
|
187
|
-
├── Delete{Entity}Validator.cs
|
|
188
|
-
└── Delete{Entity}Endpoint.cs
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
**Regras obrigatórias ao implementar cada slice:**
|
|
192
|
-
1. `Request` e `Response` records ficam no **mesmo arquivo** que o `Handler`
|
|
193
|
-
2. Tudo `sealed` — handlers, endpoints, validators, records
|
|
194
|
-
3. `Guid.CreateVersion7()` para gerar IDs (não `Guid.NewGuid()`)
|
|
195
|
-
4. Endpoints usam `result.Match(onSuccess, onFailure)` — nunca acesse `result.Value` sem checar `IsSuccess`
|
|
196
|
-
5. Endpoints são `internal sealed` (não public)
|
|
197
|
-
6. `{Entity}Errors` é static e compartilhado entre todos os slices da feature
|
|
198
|
-
7. Handlers de escrita (Create/Update/Delete) injetam `IRepository<T>` + `IUnitOfWork`
|
|
199
|
-
8. Handlers de leitura (GetAll/GetById) injetam apenas `IRepository<T>`
|
|
200
|
-
9. GetAll não tem Validator
|
|
201
|
-
|
|
202
|
-
**Registrar entidade no DbContext:**
|
|
203
|
-
```csharp
|
|
204
|
-
// Database/ApplicationDbContext.cs — adicionar:
|
|
205
|
-
public DbSet<{Entity}> {Entities} { get; set; } = null!;
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
**Criar migration após DbContext atualizado:**
|
|
209
|
-
```bash
|
|
210
|
-
dotnet ef migrations add Add{Entity}
|
|
211
|
-
dotnet ef database update
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
**Registrar tag em ApiTags (se necessário):**
|
|
215
|
-
```csharp
|
|
216
|
-
// Constants/ApiTags.cs — adicionar:
|
|
217
|
-
public const string {Entities} = "{entities}";
|
|
218
|
-
```
|
|
270
|
+
> Para a estrutura completa de slices e regras VSA, veja `references/vsa-implementation-guide.md`
|
|
219
271
|
|
|
220
|
-
|
|
221
|
-
- ❌ Registrar handler manualmente no Program.cs — `AddHandlersFromAssembly()` faz isso
|
|
222
|
-
- ❌ Registrar endpoint manualmente — `RegisterApiEndpointsFromAssembly()` faz isso
|
|
223
|
-
- ❌ Registrar validator manualmente — `AddValidatorsFromAssembly()` faz isso
|
|
224
|
-
- ❌ Criar Application Service layer — handler acessa IRepository diretamente
|
|
272
|
+
Estrutura: `Features/{Entity}Feature/{Op}/` com Handler (+ Request/Response records) + Validator + Endpoint por slice. Tudo `sealed`. `Guid.CreateVersion7()`. `result.Match()` nos endpoints. Sem Application Service layer — handler acessa IRepository diretamente. Auto-discovery via reflection: não registrar manualmente no Program.cs.
|
|
225
273
|
|
|
226
|
-
|
|
274
|
+
Após cada slice completo, verificar build:
|
|
227
275
|
```bash
|
|
228
276
|
dotnet build
|
|
229
277
|
```
|
|
@@ -232,19 +280,31 @@ dotnet build
|
|
|
232
280
|
|
|
233
281
|
```bash
|
|
234
282
|
npx morph-spec task next $ARGUMENTS
|
|
235
|
-
npx morph-spec task start $ARGUMENTS T001
|
|
236
283
|
```
|
|
237
284
|
|
|
238
|
-
Para cada task:
|
|
239
|
-
|
|
240
|
-
1. **
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
npx morph-spec task
|
|
247
|
-
```
|
|
285
|
+
Para cada task (T001 → T00N):
|
|
286
|
+
|
|
287
|
+
1. **Marcar como em progresso (native task):**
|
|
288
|
+
```
|
|
289
|
+
TaskUpdate(taskId="<native id de T001>", status="in_progress")
|
|
290
|
+
```
|
|
291
|
+
2. **Iniciar via CLI:**
|
|
292
|
+
```bash
|
|
293
|
+
npx morph-spec task start $ARGUMENTS T001
|
|
294
|
+
```
|
|
295
|
+
3. **Ler a task description** completa
|
|
296
|
+
4. **Ler contracts.cs** para DTOs/interfaces relevantes
|
|
297
|
+
5. **Implementar** usando Write (novo) ou Edit (existente)
|
|
298
|
+
6. **Verificar** — build, lint, testes
|
|
299
|
+
7. **Marcar como done via CLI:**
|
|
300
|
+
```bash
|
|
301
|
+
npx morph-spec task done $ARGUMENTS T001
|
|
302
|
+
```
|
|
303
|
+
8. **Se `task done` retornar sem erro, marcar native task como concluída:**
|
|
304
|
+
```
|
|
305
|
+
TaskUpdate(taskId="<native id de T001>", status="completed")
|
|
306
|
+
```
|
|
307
|
+
> **Nota:** `TaskUpdate(completed)` só ocorre se `task done` retornar sem erro (validação passou).
|
|
248
308
|
|
|
249
309
|
### Passo 3: Checkpoint a Cada 3 Tasks
|
|
250
310
|
|
|
@@ -308,45 +368,40 @@ Após TODAS as tasks completadas:
|
|
|
308
368
|
npx morph-spec generate recap $ARGUMENTS
|
|
309
369
|
```
|
|
310
370
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
```markdown
|
|
314
|
-
# Recap — {Feature Name}
|
|
315
|
-
|
|
316
|
-
## Summary
|
|
317
|
-
{1-2 parágrafos descrevendo o que foi implementado}
|
|
371
|
+
> Para o formato completo do recap, veja `references/recap-example.md`
|
|
318
372
|
|
|
319
|
-
|
|
320
|
-
- [x] T001: {título}
|
|
321
|
-
- [x] T002: {título}
|
|
322
|
-
- ...
|
|
373
|
+
### Passo 7: Atualizar State
|
|
323
374
|
|
|
324
|
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
375
|
+
```bash
|
|
376
|
+
npx morph-spec state set $ARGUMENTS status done
|
|
377
|
+
npx morph-spec state mark-output $ARGUMENTS recap
|
|
378
|
+
```
|
|
327
379
|
|
|
328
|
-
|
|
329
|
-
{Lista de arquivos}
|
|
380
|
+
### Passo 8: Revisão Pós-Implementação (obrigatório antes do PR)
|
|
330
381
|
|
|
331
|
-
|
|
332
|
-
-
|
|
333
|
-
|
|
382
|
+
```bash
|
|
383
|
+
/post-implementation $ARGUMENTS
|
|
384
|
+
```
|
|
334
385
|
|
|
335
|
-
|
|
336
|
-
|
|
386
|
+
Execute o skill `post-implementation` antes de criar o PR. Ele orquestra:
|
|
387
|
+
- Scans automáticos (CRITICAL findings bloqueiam PR)
|
|
388
|
+
- Test suite completo
|
|
389
|
+
- `validate-feature` final
|
|
390
|
+
- Smoke test via Playwright (obrigatório se dev server ativo)
|
|
391
|
+
- Checklist de code review (CRITICAL + HIGH)
|
|
392
|
+
- Checkpoint + recap final
|
|
337
393
|
|
|
338
|
-
|
|
339
|
-
{Se UI, incluir screenshots}
|
|
340
|
-
```
|
|
394
|
+
### Passo 9: Frontend Review (NEXTJS/FULLSTACK)
|
|
341
395
|
|
|
342
|
-
|
|
396
|
+
Se stack for NEXTJS ou FULLSTACK:
|
|
343
397
|
|
|
344
398
|
```bash
|
|
345
|
-
|
|
346
|
-
npx morph-spec state set $ARGUMENTS status done
|
|
347
|
-
npx morph-spec state mark-output $ARGUMENTS recap
|
|
399
|
+
/frontend-review $ARGUMENTS
|
|
348
400
|
```
|
|
349
401
|
|
|
402
|
+
Complementa o `post-implementation` com: scan de acessibilidade (static + axe-core runtime),
|
|
403
|
+
screenshots responsivos (mobile/tablet/desktop), e verificação de SEO metadata.
|
|
404
|
+
|
|
350
405
|
---
|
|
351
406
|
|
|
352
407
|
## Integração com Superpowers
|
|
@@ -359,6 +414,7 @@ npx morph-spec state mark-output $ARGUMENTS recap
|
|
|
359
414
|
| `systematic-debugging` | Quando testes falham ou erros inesperados | `Skill(superpowers:systematic-debugging)` |
|
|
360
415
|
| `requesting-code-review` | Após implementação completa | `Skill(superpowers:requesting-code-review)` |
|
|
361
416
|
| `verification-before-completion` | Antes de marcar feature como done | Use `verification-before-completion` (morph-spec version) |
|
|
417
|
+
| `post-implementation` | Antes de criar o PR (scans + smoke test + review) | `/post-implementation {feature}` |
|
|
362
418
|
|
|
363
419
|
---
|
|
364
420
|
|
|
@@ -377,6 +433,7 @@ npx morph-spec state mark-output $ARGUMENTS recap
|
|
|
377
433
|
- [x] `recap.md` gerado
|
|
378
434
|
- [x] State atualizado para `status: done`
|
|
379
435
|
- [x] Checkpoints salvos a cada 3 tasks
|
|
436
|
+
- [x] `/post-implementation` executado sem BLOCKs (smoke test, scans, code review)
|
|
380
437
|
|
|
381
438
|
---
|
|
382
439
|
|
package/framework/skills/level-1-workflows/phase-implement/references/vsa-implementation-guide.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# VSA Implementation Guide
|
|
2
|
+
|
|
3
|
+
> Guia completo de implementação para Vertical Slice Architecture.
|
|
4
|
+
> Referenciado pelo Passo 1.5 de `phase-implement/SKILL.md`.
|
|
5
|
+
> **Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Estrutura de Arquivos Obrigatória por Slice
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Features/
|
|
13
|
+
└── {Entity}Feature/
|
|
14
|
+
├── {Entity}Errors.cs ← 1 arquivo por feature (compartilhado)
|
|
15
|
+
├── Create{Entity}/
|
|
16
|
+
│ ├── Create{Entity}Handler.cs ← Request + Response records + Handler
|
|
17
|
+
│ ├── Create{Entity}Validator.cs ← AbstractValidator<Request>
|
|
18
|
+
│ └── Create{Entity}Endpoint.cs ← IApiEndpoint (internal sealed)
|
|
19
|
+
├── GetAll{Entity}s/
|
|
20
|
+
│ ├── GetAll{Entity}sHandler.cs ← sem Validator (sem parâmetros)
|
|
21
|
+
│ └── GetAll{Entity}sEndpoint.cs
|
|
22
|
+
├── Get{Entity}ById/
|
|
23
|
+
│ ├── Get{Entity}ByIdHandler.cs
|
|
24
|
+
│ ├── Get{Entity}ByIdValidator.cs
|
|
25
|
+
│ └── Get{Entity}ByIdEndpoint.cs
|
|
26
|
+
├── Update{Entity}/
|
|
27
|
+
│ ├── Update{Entity}Handler.cs
|
|
28
|
+
│ ├── Update{Entity}Validator.cs
|
|
29
|
+
│ └── Update{Entity}Endpoint.cs
|
|
30
|
+
└── Delete{Entity}/
|
|
31
|
+
├── Delete{Entity}Handler.cs
|
|
32
|
+
├── Delete{Entity}Validator.cs
|
|
33
|
+
└── Delete{Entity}Endpoint.cs
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 9 Regras Obrigatórias por Slice
|
|
39
|
+
|
|
40
|
+
1. `Request` e `Response` records ficam no **mesmo arquivo** que o `Handler`
|
|
41
|
+
2. Tudo `sealed` — handlers, endpoints, validators, records
|
|
42
|
+
3. `Guid.CreateVersion7()` para gerar IDs (não `Guid.NewGuid()`)
|
|
43
|
+
4. Endpoints usam `result.Match(onSuccess, onFailure)` — nunca acesse `result.Value` sem checar `IsSuccess`
|
|
44
|
+
5. Endpoints são `internal sealed` (não public)
|
|
45
|
+
6. `{Entity}Errors` é static e compartilhado entre todos os slices da feature
|
|
46
|
+
7. Handlers de escrita (Create/Update/Delete) injetam `IRepository<T>` + `IUnitOfWork`
|
|
47
|
+
8. Handlers de leitura (GetAll/GetById) injetam apenas `IRepository<T>`
|
|
48
|
+
9. GetAll não tem Validator
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Registrar Entidade no DbContext
|
|
53
|
+
|
|
54
|
+
```csharp
|
|
55
|
+
// Database/ApplicationDbContext.cs — adicionar:
|
|
56
|
+
public DbSet<{Entity}> {Entities} { get; set; } = null!;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Criar Migration Após DbContext Atualizado
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
dotnet ef migrations add Add{Entity}
|
|
65
|
+
dotnet ef database update
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Registrar Tag em ApiTags (se necessário)
|
|
71
|
+
|
|
72
|
+
```csharp
|
|
73
|
+
// Constants/ApiTags.cs — adicionar:
|
|
74
|
+
public const string {Entities} = "{entities}";
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## O que NÃO Precisa Fazer (auto-discovery via reflection)
|
|
80
|
+
|
|
81
|
+
- ❌ Registrar handler manualmente no Program.cs — `AddHandlersFromAssembly()` faz isso
|
|
82
|
+
- ❌ Registrar endpoint manualmente — `RegisterApiEndpointsFromAssembly()` faz isso
|
|
83
|
+
- ❌ Registrar validator manualmente — `AddValidatorsFromAssembly()` faz isso
|
|
84
|
+
- ❌ Criar Application Service layer — handler acessa IRepository diretamente
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Verificar Build Após Cada Slice
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
dotnet build
|
|
92
|
+
```
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 1 (Setup). Reads project context, detects tech sta
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
-
cliVersion: "4.8.
|
|
7
|
+
cliVersion: "4.8.15"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Setup - FASE 1
|
|
@@ -142,7 +142,6 @@ Isso informa quais agentes serão disparados em paralelo na fase de design e qua
|
|
|
142
142
|
Marque a feature como na fase SETUP:
|
|
143
143
|
|
|
144
144
|
```bash
|
|
145
|
-
npx morph-spec state set $ARGUMENTS phase setup
|
|
146
145
|
npx morph-spec state set $ARGUMENTS status in_progress
|
|
147
146
|
```
|
|
148
147
|
|