@polymorphism-tech/morph-spec 4.8.14 → 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 +2 -2
- package/bin/morph-spec.js +23 -2
- package/bin/task-manager.js +202 -14
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/agents.json +113 -116
- 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 +6 -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 +27 -0
- package/framework/hooks/claude-code/stop/validate-completion.js +17 -2
- 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 +1 -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 +13 -206
- 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 +16 -110
- 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 +153 -118
- 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 +11 -158
- 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 +1 -1
- package/src/commands/agents/dispatch-agents.js +53 -10
- package/src/commands/state/advance-phase.js +56 -0
- package/src/commands/state/index.js +2 -1
- package/src/commands/state/phase-runner.js +215 -0
- package/src/commands/tasks/task.js +23 -2
- package/src/core/paths/output-schema.js +1 -1
- 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/validators/blazor/blazor-concurrency-analyzer.js +39 -0
- 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!)
|
|
@@ -77,19 +81,34 @@ Read: .morph/features/{feature}/3-tasks/tasks.md
|
|
|
77
81
|
+ Read: .morph/config/config.json (→ architecture.style)
|
|
78
82
|
```
|
|
79
83
|
|
|
80
|
-
### 2. Criar tasks
|
|
84
|
+
### 2. Criar native tasks individuais por T001-T00N
|
|
81
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`:**
|
|
82
100
|
```
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
TaskCreate: "Gerar recap.md" → activeForm: "Gerando recap"
|
|
101
|
+
# Para cada task com `dependencies: [T00X, T00Y]` em tasks.md:
|
|
102
|
+
TaskUpdate(taskId="<id de T003>", addBlockedBy=["<id de T001>", "<id de T002>"])
|
|
86
103
|
```
|
|
87
104
|
|
|
105
|
+
> Guarde o mapeamento `{T001 → taskId}` internamente para usar nos TaskUpdates do loop.
|
|
106
|
+
|
|
88
107
|
---
|
|
89
108
|
|
|
90
109
|
## Workflow
|
|
91
110
|
|
|
92
|
-
### Passo 0.5: Planejar
|
|
111
|
+
### Passo 0.5: Planejar Modo de Execução
|
|
93
112
|
|
|
94
113
|
**Execute antes de qualquer implementação:**
|
|
95
114
|
|
|
@@ -97,7 +116,17 @@ TaskCreate: "Gerar recap.md" → activeForm: "Gerando reca
|
|
|
97
116
|
npx morph-spec dispatch-agents $ARGUMENTS implement
|
|
98
117
|
```
|
|
99
118
|
|
|
100
|
-
**
|
|
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):
|
|
101
130
|
|
|
102
131
|
1. Leia os `taskGroups` retornados (ex: `backend`, `frontend`, `infra`)
|
|
103
132
|
2. Para cada grupo com ≥ 3 tasks e sem dependências cruzadas, use **Task tool** com o `taskPrompt` do dispatch config:
|
|
@@ -113,12 +142,21 @@ Contexto completo:
|
|
|
113
142
|
- Contracts: [conteúdo de .morph/features/$ARGUMENTS/1-design/contracts.cs]
|
|
114
143
|
- Tasks do grupo: [lista de TXXX do grupo backend]
|
|
115
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
|
+
|
|
116
152
|
Para cada task do grupo, em ordem:
|
|
117
|
-
1.
|
|
118
|
-
2.
|
|
119
|
-
3.
|
|
120
|
-
4.
|
|
121
|
-
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")
|
|
122
160
|
|
|
123
161
|
A cada 3 tasks:
|
|
124
162
|
- Execute: npx morph-spec checkpoint-save $ARGUMENTS
|
|
@@ -134,11 +172,59 @@ Restrições OBRIGATÓRIAS:
|
|
|
134
172
|
3. Dispare os Task subagents dos grupos em **paralelo** (quando sem dependências entre si)
|
|
135
173
|
4. Após todos completarem, valide integração: `npx morph-spec validate-feature $ARGUMENTS --phase implement`
|
|
136
174
|
|
|
137
|
-
**Se `
|
|
175
|
+
**Se `mode: "single"`** (feature pequena ou single-domain):
|
|
138
176
|
→ Continue para o workflow sequencial normal abaixo.
|
|
139
177
|
|
|
140
178
|
---
|
|
141
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
|
+
|
|
142
228
|
### CHECKPOINT DE ENTRADA: Verificar Pré-requisitos
|
|
143
229
|
|
|
144
230
|
**⏸️ Antes de iniciar implementação:**
|
|
@@ -161,7 +247,7 @@ npx morph-spec approval-status $ARGUMENTS
|
|
|
161
247
|
|
|
162
248
|
### Passo 1: Carregar Contexto Completo
|
|
163
249
|
|
|
164
|
-
Leia
|
|
250
|
+
Leia todos os outputs antes de implementar:
|
|
165
251
|
|
|
166
252
|
1. `.morph/features/$ARGUMENTS/3-tasks/tasks.md` — Lista de tasks
|
|
167
253
|
2. `.morph/features/$ARGUMENTS/1-design/spec.md` — Especificação completa
|
|
@@ -181,71 +267,11 @@ Caso contrário → vá direto para o Passo 2.
|
|
|
181
267
|
|
|
182
268
|
### Passo 1.5: Guia de Implementação VSA (somente se `style: "vertical-slice"`)
|
|
183
269
|
|
|
184
|
-
>
|
|
270
|
+
> Para a estrutura completa de slices e regras VSA, veja `references/vsa-implementation-guide.md`
|
|
185
271
|
|
|
186
|
-
|
|
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.
|
|
187
273
|
|
|
188
|
-
|
|
189
|
-
Features/
|
|
190
|
-
└── {Entity}Feature/
|
|
191
|
-
├── {Entity}Errors.cs ← 1 arquivo por feature (compartilhado)
|
|
192
|
-
├── Create{Entity}/
|
|
193
|
-
│ ├── Create{Entity}Handler.cs ← Request + Response records + Handler
|
|
194
|
-
│ ├── Create{Entity}Validator.cs ← AbstractValidator<Request>
|
|
195
|
-
│ └── Create{Entity}Endpoint.cs ← IApiEndpoint (internal sealed)
|
|
196
|
-
├── GetAll{Entity}s/
|
|
197
|
-
│ ├── GetAll{Entity}sHandler.cs ← sem Validator (sem parâmetros)
|
|
198
|
-
│ └── GetAll{Entity}sEndpoint.cs
|
|
199
|
-
├── Get{Entity}ById/
|
|
200
|
-
│ ├── Get{Entity}ByIdHandler.cs
|
|
201
|
-
│ ├── Get{Entity}ByIdValidator.cs
|
|
202
|
-
│ └── Get{Entity}ByIdEndpoint.cs
|
|
203
|
-
├── Update{Entity}/
|
|
204
|
-
│ ├── Update{Entity}Handler.cs
|
|
205
|
-
│ ├── Update{Entity}Validator.cs
|
|
206
|
-
│ └── Update{Entity}Endpoint.cs
|
|
207
|
-
└── Delete{Entity}/
|
|
208
|
-
├── Delete{Entity}Handler.cs
|
|
209
|
-
├── Delete{Entity}Validator.cs
|
|
210
|
-
└── Delete{Entity}Endpoint.cs
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
**Regras obrigatórias ao implementar cada slice:**
|
|
214
|
-
1. `Request` e `Response` records ficam no **mesmo arquivo** que o `Handler`
|
|
215
|
-
2. Tudo `sealed` — handlers, endpoints, validators, records
|
|
216
|
-
3. `Guid.CreateVersion7()` para gerar IDs (não `Guid.NewGuid()`)
|
|
217
|
-
4. Endpoints usam `result.Match(onSuccess, onFailure)` — nunca acesse `result.Value` sem checar `IsSuccess`
|
|
218
|
-
5. Endpoints são `internal sealed` (não public)
|
|
219
|
-
6. `{Entity}Errors` é static e compartilhado entre todos os slices da feature
|
|
220
|
-
7. Handlers de escrita (Create/Update/Delete) injetam `IRepository<T>` + `IUnitOfWork`
|
|
221
|
-
8. Handlers de leitura (GetAll/GetById) injetam apenas `IRepository<T>`
|
|
222
|
-
9. GetAll não tem Validator
|
|
223
|
-
|
|
224
|
-
**Registrar entidade no DbContext:**
|
|
225
|
-
```csharp
|
|
226
|
-
// Database/ApplicationDbContext.cs — adicionar:
|
|
227
|
-
public DbSet<{Entity}> {Entities} { get; set; } = null!;
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
**Criar migration após DbContext atualizado:**
|
|
231
|
-
```bash
|
|
232
|
-
dotnet ef migrations add Add{Entity}
|
|
233
|
-
dotnet ef database update
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
**Registrar tag em ApiTags (se necessário):**
|
|
237
|
-
```csharp
|
|
238
|
-
// Constants/ApiTags.cs — adicionar:
|
|
239
|
-
public const string {Entities} = "{entities}";
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
**O que NÃO precisa fazer (auto-discovery via reflection):**
|
|
243
|
-
- ❌ Registrar handler manualmente no Program.cs — `AddHandlersFromAssembly()` faz isso
|
|
244
|
-
- ❌ Registrar endpoint manualmente — `RegisterApiEndpointsFromAssembly()` faz isso
|
|
245
|
-
- ❌ Registrar validator manualmente — `AddValidatorsFromAssembly()` faz isso
|
|
246
|
-
- ❌ Criar Application Service layer — handler acessa IRepository diretamente
|
|
247
|
-
|
|
248
|
-
**Verificar build após cada slice completo:**
|
|
274
|
+
Após cada slice completo, verificar build:
|
|
249
275
|
```bash
|
|
250
276
|
dotnet build
|
|
251
277
|
```
|
|
@@ -254,19 +280,31 @@ dotnet build
|
|
|
254
280
|
|
|
255
281
|
```bash
|
|
256
282
|
npx morph-spec task next $ARGUMENTS
|
|
257
|
-
npx morph-spec task start $ARGUMENTS T001
|
|
258
283
|
```
|
|
259
284
|
|
|
260
|
-
Para cada task:
|
|
261
|
-
|
|
262
|
-
1. **
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
npx morph-spec task
|
|
269
|
-
```
|
|
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).
|
|
270
308
|
|
|
271
309
|
### Passo 3: Checkpoint a Cada 3 Tasks
|
|
272
310
|
|
|
@@ -330,45 +368,40 @@ Após TODAS as tasks completadas:
|
|
|
330
368
|
npx morph-spec generate recap $ARGUMENTS
|
|
331
369
|
```
|
|
332
370
|
|
|
333
|
-
|
|
371
|
+
> Para o formato completo do recap, veja `references/recap-example.md`
|
|
334
372
|
|
|
335
|
-
|
|
336
|
-
# Recap — {Feature Name}
|
|
337
|
-
|
|
338
|
-
## Summary
|
|
339
|
-
{1-2 parágrafos descrevendo o que foi implementado}
|
|
340
|
-
|
|
341
|
-
## Tasks Completed
|
|
342
|
-
- [x] T001: {título}
|
|
343
|
-
- [x] T002: {título}
|
|
344
|
-
- ...
|
|
373
|
+
### Passo 7: Atualizar State
|
|
345
374
|
|
|
346
|
-
|
|
347
|
-
-
|
|
348
|
-
-
|
|
375
|
+
```bash
|
|
376
|
+
npx morph-spec state set $ARGUMENTS status done
|
|
377
|
+
npx morph-spec state mark-output $ARGUMENTS recap
|
|
378
|
+
```
|
|
349
379
|
|
|
350
|
-
|
|
351
|
-
{Lista de arquivos}
|
|
380
|
+
### Passo 8: Revisão Pós-Implementação (obrigatório antes do PR)
|
|
352
381
|
|
|
353
|
-
|
|
354
|
-
-
|
|
355
|
-
|
|
382
|
+
```bash
|
|
383
|
+
/post-implementation $ARGUMENTS
|
|
384
|
+
```
|
|
356
385
|
|
|
357
|
-
|
|
358
|
-
|
|
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
|
|
359
393
|
|
|
360
|
-
|
|
361
|
-
{Se UI, incluir screenshots}
|
|
362
|
-
```
|
|
394
|
+
### Passo 9: Frontend Review (NEXTJS/FULLSTACK)
|
|
363
395
|
|
|
364
|
-
|
|
396
|
+
Se stack for NEXTJS ou FULLSTACK:
|
|
365
397
|
|
|
366
398
|
```bash
|
|
367
|
-
|
|
368
|
-
npx morph-spec state set $ARGUMENTS status done
|
|
369
|
-
npx morph-spec state mark-output $ARGUMENTS recap
|
|
399
|
+
/frontend-review $ARGUMENTS
|
|
370
400
|
```
|
|
371
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
|
+
|
|
372
405
|
---
|
|
373
406
|
|
|
374
407
|
## Integração com Superpowers
|
|
@@ -381,6 +414,7 @@ npx morph-spec state mark-output $ARGUMENTS recap
|
|
|
381
414
|
| `systematic-debugging` | Quando testes falham ou erros inesperados | `Skill(superpowers:systematic-debugging)` |
|
|
382
415
|
| `requesting-code-review` | Após implementação completa | `Skill(superpowers:requesting-code-review)` |
|
|
383
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}` |
|
|
384
418
|
|
|
385
419
|
---
|
|
386
420
|
|
|
@@ -399,6 +433,7 @@ npx morph-spec state mark-output $ARGUMENTS recap
|
|
|
399
433
|
- [x] `recap.md` gerado
|
|
400
434
|
- [x] State atualizado para `status: done`
|
|
401
435
|
- [x] Checkpoints salvos a cada 3 tasks
|
|
436
|
+
- [x] `/post-implementation` executado sem BLOCKs (smoke test, scans, code review)
|
|
402
437
|
|
|
403
438
|
---
|
|
404
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
|
|