@polymorphism-tech/morph-spec 4.8.8 → 4.8.9
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/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/agents.json +2 -1
- package/framework/hooks/dev/guard-version-numbers.js +1 -1
- package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +2 -2
- package/framework/skills/level-1-workflows/phase-implement/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-setup/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +112 -3
- package/framework/skills/level-1-workflows/phase-tasks/references/tasks-example.md +173 -0
- package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +1 -1
- package/framework/templates/docs/spec.md +33 -1
- package/package.json +1 -1
- package/src/commands/project/doctor.js +1 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> Spec-driven development framework for multi-stack projects. Turns feature requests into implementation-ready code through structured, AI-orchestrated phases.
|
|
4
4
|
|
|
5
5
|
**Package:** `@polymorphism-tech/morph-spec`
|
|
6
|
-
**Version:** 4.8.
|
|
6
|
+
**Version:** 4.8.9
|
|
7
7
|
**Requires:** Node.js 18+, Claude Code
|
|
8
8
|
|
|
9
9
|
---
|
|
@@ -376,4 +376,4 @@ Code generated by morph-spec (contracts, templates, implementation output) belon
|
|
|
376
376
|
|
|
377
377
|
---
|
|
378
378
|
|
|
379
|
-
*morph-spec v4.8.
|
|
379
|
+
*morph-spec v4.8.9 by [Polymorphism Tech](https://polymorphism.tech)*
|
package/claude-plugin.json
CHANGED
package/docs/CHEATSHEET.md
CHANGED
package/docs/QUICKSTART.md
CHANGED
package/framework/agents.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Scope: Framework codebase only (dev hook)
|
|
8
8
|
*
|
|
9
9
|
* Blocks Write/Edit to files that contain hardcoded version patterns
|
|
10
|
-
* like "MORPH-SPEC v4.8.
|
|
10
|
+
* like "MORPH-SPEC v4.8.9". Version should only be in package.json.
|
|
11
11
|
*
|
|
12
12
|
* Checked extensions: .md, .cs, .css, .js (covers templates + source)
|
|
13
13
|
* Exceptions: CHANGELOG.md, node_modules/, test/, package.json, package-lock.json
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 3 (Clarify). Reviews spec.md for ambiguities, gene
|
|
|
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.9"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Clarify - FASE 3
|
|
@@ -3,7 +3,7 @@ name: phase-codebase-analysis
|
|
|
3
3
|
description: MORPH-SPEC Design sub-phase that analyzes existing codebase and database schema, producing schema-analysis.md with real column names, types, relationships, and field mismatches. Use at the start of Design phase before generating contracts.cs to prevent incorrect field names or types.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
6
|
-
cliVersion: "4.8.
|
|
6
|
+
cliVersion: "4.8.9"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# MORPH Codebase Analysis - Sub-fase de DESIGN
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phase-design
|
|
3
|
-
description: MORPH-SPEC Phase 2 (Design). Analyzes codebase/schema, then produces spec.md, contracts-level{N}.cs, schema-analysis.md, and decisions.md for the feature. Use after setup phase to create a full technical specification with C# contracts based on the real database schema and architecture decision records.
|
|
3
|
+
description: MORPH-SPEC Phase 2 (Design). Analyzes codebase/schema, then produces spec.md, contracts.cs (contracts-vsa.cs for VSA or contracts-level{N}.cs for DDD), schema-analysis.md, and decisions.md for the feature. Use after setup phase to create a full technical specification with C# contracts based on the real database schema and architecture decision records.
|
|
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.9"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Design - FASE 2
|
|
@@ -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.9"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Setup - FASE 1
|
|
@@ -5,7 +5,7 @@ argument-hint: "[feature-name]"
|
|
|
5
5
|
disable-model-invocation: true
|
|
6
6
|
user-invocable: false
|
|
7
7
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
8
|
-
cliVersion: "4.8.
|
|
8
|
+
cliVersion: "4.8.9"
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# MORPH Tasks - FASE 4
|
|
@@ -44,6 +44,9 @@ Quebre a especificação em tasks executáveis, defina ordem de execução e est
|
|
|
44
44
|
- ✅ Task agent para specs multi-domínio (backend + frontend + infra = 3 planners em paralelo)
|
|
45
45
|
- ✅ Task agent quando spec tem 20+ requisitos em múltiplos bounded contexts
|
|
46
46
|
- ❌ Criar tasks.json sem ler todos os outputs primeiro
|
|
47
|
+
- ❌ **(VSA)** Criar tasks separadas para Handler, Validator e Endpoint — um slice = uma task
|
|
48
|
+
- ❌ **(VSA)** Usar categorias DDD (`domain`, `application`, `infrastructure`) em projetos VSA
|
|
49
|
+
- ❌ **(VSA)** Criar task de "Implementar Service layer" — não existe em VSA
|
|
47
50
|
|
|
48
51
|
---
|
|
49
52
|
|
|
@@ -75,7 +78,111 @@ npx morph-spec approval get $ARGUMENTS design
|
|
|
75
78
|
|
|
76
79
|
---
|
|
77
80
|
|
|
78
|
-
### Passo 0:
|
|
81
|
+
### Passo 0: Detectar Estilo de Arquitetura
|
|
82
|
+
|
|
83
|
+
Antes de tudo, determine se o projeto é VSA ou DDD:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
cat .morph/config/config.json | grep -A3 '"architecture"'
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Se `config.architecture.style === "vertical-slice"`** → siga o **Passo 0.5 (VSA)** e pule o Passo 0 DDD.
|
|
90
|
+
**Caso contrário** → siga o **Passo 0.6 (DDD)** abaixo.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Passo 0.5: Plano de Tasks — VSA
|
|
95
|
+
|
|
96
|
+
**Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
|
|
97
|
+
|
|
98
|
+
Leia a seção `## Architecture Style: Vertical Slice` do spec.md para o **VSA Blueprint** (entity fields, operações, rotas, validações):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
grep -A30 "## Architecture Style" ".morph/features/$ARGUMENTS/1-design/spec.md"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Categorias de tasks VSA** (uma task por slice — Handler + Validator + Endpoint juntos):
|
|
105
|
+
|
|
106
|
+
| Categoria | Descrição | Arquivo(s) |
|
|
107
|
+
|-----------|-----------|------------|
|
|
108
|
+
| **entity** | Entity class + DbSet no ApplicationDbContext | `Entities/{Entity}.cs`, `Database/ApplicationDbContext.cs` |
|
|
109
|
+
| **errors** | `{Entity}Errors` static class com factory methods | `Features/{Entity}Feature/{Entity}Errors.cs` |
|
|
110
|
+
| **tags** | Constante em ApiTags (se tag nova) | `Constants/ApiTags.cs` |
|
|
111
|
+
| **migration** | `dotnet ef migrations add` + `database update` | `Migrations/...` |
|
|
112
|
+
| **slice** | Slice completo: Handler (+ Request + Response records) + Validator + Endpoint | `Features/{Entity}Feature/{Op}/{Op}Handler.cs`, `...Validator.cs`, `...Endpoint.cs` |
|
|
113
|
+
| **tests** | Unit tests dos handlers | `Tests/Features/{Entity}Feature/...` |
|
|
114
|
+
| **docs** | README, Swagger, comentários | — |
|
|
115
|
+
|
|
116
|
+
**Ordem obrigatória (bottom-up VSA):**
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
T001: Entity + DbContext DbSet
|
|
120
|
+
↓
|
|
121
|
+
T002: {Entity}Errors (factory methods)
|
|
122
|
+
↓
|
|
123
|
+
T003: ApiTags constant (se tag ainda não existe)
|
|
124
|
+
↓
|
|
125
|
+
T004: Migration (Add{Entity} + database update)
|
|
126
|
+
↓
|
|
127
|
+
T005: Slice Create{Entity} ← Handler+Validator+Endpoint = 1 task
|
|
128
|
+
T006: Slice GetAll{Entity}s ← Handler+Endpoint = 1 task (sem Validator)
|
|
129
|
+
T007: Slice Get{Entity}ById ← Handler+Validator+Endpoint = 1 task
|
|
130
|
+
T008: Slice Update{Entity} ← Handler+Validator+Endpoint = 1 task
|
|
131
|
+
T009: Slice Delete{Entity} ← Handler+Validator+Endpoint = 1 task
|
|
132
|
+
↓
|
|
133
|
+
T010+: Slices customizados (operações extra do VSA Blueprint)
|
|
134
|
+
↓
|
|
135
|
+
T0NN: Tests
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Regras VSA para tasks:**
|
|
139
|
+
- 1 task = 1 slice completo (Handler + Validator + Endpoint num único task)
|
|
140
|
+
- `GetAll` NÃO tem Validator — mencionar explicitamente no task
|
|
141
|
+
- Cada task de slice lista os 3 arquivos que devem ser criados no campo `files`
|
|
142
|
+
- Entity task deve incluir a linha `DbSet<{Entity}>` no `ApplicationDbContext`
|
|
143
|
+
- Migration task é separada da entity task (pode rodar em paralelo com errors + tags)
|
|
144
|
+
|
|
145
|
+
**Exemplo de tasks VSA geradas:**
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{ "id": "T001", "title": "Criar Entity Book + registrar DbSet no ApplicationDbContext",
|
|
149
|
+
"category": "entity", "dependencies": [], "estimatedMinutes": 20,
|
|
150
|
+
"files": ["Entities/Book.cs", "Database/ApplicationDbContext.cs"] }
|
|
151
|
+
|
|
152
|
+
{ "id": "T002", "title": "Criar BookErrors (NotFound + outros factory methods)",
|
|
153
|
+
"category": "errors", "dependencies": ["T001"], "estimatedMinutes": 10,
|
|
154
|
+
"files": ["Features/BookFeature/BookErrors.cs"] }
|
|
155
|
+
|
|
156
|
+
{ "id": "T003", "title": "Adicionar ApiTags.Books em Constants/ApiTags.cs",
|
|
157
|
+
"category": "tags", "dependencies": [], "estimatedMinutes": 5,
|
|
158
|
+
"files": ["Constants/ApiTags.cs"] }
|
|
159
|
+
|
|
160
|
+
{ "id": "T004", "title": "Criar migration AddBook + aplicar ao banco",
|
|
161
|
+
"category": "migration", "dependencies": ["T001"], "estimatedMinutes": 10,
|
|
162
|
+
"files": ["Migrations/...AddBook.cs"] }
|
|
163
|
+
|
|
164
|
+
{ "id": "T005", "title": "Implementar slice CreateBook (Handler + Validator + Endpoint)",
|
|
165
|
+
"category": "slice", "dependencies": ["T001", "T002", "T003", "T004"],
|
|
166
|
+
"estimatedMinutes": 45,
|
|
167
|
+
"files": [
|
|
168
|
+
"Features/BookFeature/CreateBook/CreateBookHandler.cs",
|
|
169
|
+
"Features/BookFeature/CreateBook/CreateBookValidator.cs",
|
|
170
|
+
"Features/BookFeature/CreateBook/CreateBookEndpoint.cs"
|
|
171
|
+
] }
|
|
172
|
+
|
|
173
|
+
{ "id": "T006", "title": "Implementar slice GetAllBooks (Handler + Endpoint, sem Validator)",
|
|
174
|
+
"category": "slice", "dependencies": ["T001", "T004"], "estimatedMinutes": 25,
|
|
175
|
+
"files": [
|
|
176
|
+
"Features/BookFeature/GetAllBooks/GetAllBooksHandler.cs",
|
|
177
|
+
"Features/BookFeature/GetAllBooks/GetAllBooksEndpoint.cs"
|
|
178
|
+
] }
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Após definir tasks VSA, pule direto para o Passo 3 (Dependências).**
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
### Passo 0.6: Ler Nível de Domínio — DDD
|
|
79
186
|
|
|
80
187
|
**Ref:** `framework/standards/architecture/ddd/complexity-levels.md`
|
|
81
188
|
|
|
@@ -115,10 +222,12 @@ Use o nível para **restringir** as categorias de tasks às listadas para o nív
|
|
|
115
222
|
|
|
116
223
|
### Passo 1: Analisar Spec
|
|
117
224
|
|
|
225
|
+
> **VSA:** Se veio do Passo 0.5, o breakdown de tasks já foi definido — use os exemplos gerados como base e pule para o Passo 3 (Dependências).
|
|
226
|
+
|
|
118
227
|
Leia `.morph/features/$ARGUMENTS/1-design/spec.md` e identifique:
|
|
119
228
|
|
|
120
229
|
1. **Requisitos funcionais** (FR001, FR002, ...)
|
|
121
|
-
2. **Componentes técnicos** (Entities, Services, Controllers, Pages)
|
|
230
|
+
2. **Componentes técnicos** (Entities, Services/Slices, Controllers/Endpoints, Pages)
|
|
122
231
|
3. **Infraestrutura** (Bicep, migrations, configs)
|
|
123
232
|
4. **Testes** (Unit tests, integration tests)
|
|
124
233
|
|
|
@@ -228,4 +228,177 @@ Integration tests using `WebApplicationFactory` + in-memory SQLite (or TestConta
|
|
|
228
228
|
|
|
229
229
|
---
|
|
230
230
|
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
# Tasks - Book CRUD (VSA Example)
|
|
234
|
+
|
|
235
|
+
> Example of tasks.md for a Vertical Slice Architecture (VSA) feature.
|
|
236
|
+
> Key rule: 1 task = 1 complete slice (Handler + Validator + Endpoint together).
|
|
237
|
+
> GetAll slices have no Validator — stated explicitly in the task.
|
|
238
|
+
|
|
239
|
+
| Task ID | Category | Title | Status |
|
|
240
|
+
|---------|----------|-------|--------|
|
|
241
|
+
| T001 | entity | Criar Entity Book + registrar DbSet no ApplicationDbContext | Pending |
|
|
242
|
+
| T002 | errors | Criar BookErrors (NotFound + outros factory methods) | Pending |
|
|
243
|
+
| T003 | tags | Adicionar ApiTags.Books em Constants/ApiTags.cs | Pending |
|
|
244
|
+
| T004 | migration | Criar migration AddBook + aplicar ao banco | Pending |
|
|
245
|
+
| T005 | slice | Implementar slice CreateBook (Handler + Validator + Endpoint) | Pending |
|
|
246
|
+
| T006 | slice | Implementar slice GetAllBooks (Handler + Endpoint, sem Validator) | Pending |
|
|
247
|
+
| T007 | slice | Implementar slice GetBookById (Handler + Validator + Endpoint) | Pending |
|
|
248
|
+
| T008 | slice | Implementar slice UpdateBook (Handler + Validator + Endpoint) | Pending |
|
|
249
|
+
| T009 | slice | Implementar slice DeleteBook (Handler + Validator + Endpoint) | Pending |
|
|
250
|
+
|
|
251
|
+
**Status Values:** `Pending | In Progress | Blocked | Done`
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Phase 1: Foundation
|
|
256
|
+
|
|
257
|
+
### T001: Criar Entity Book + registrar DbSet no ApplicationDbContext
|
|
258
|
+
- **Category:** entity
|
|
259
|
+
- **Estimate:** 20min
|
|
260
|
+
- **Dependencies:** None
|
|
261
|
+
|
|
262
|
+
**Description:**
|
|
263
|
+
Criar a entity `Book` com todos os campos definidos no spec.md. Registrar `DbSet<Book>` no `ApplicationDbContext`. Usar `Guid.CreateVersion7()` para o campo Id — não `Guid.NewGuid()`. Propriedades obrigatórias como `sealed` ou com setters `private init`.
|
|
264
|
+
|
|
265
|
+
**Deliverables:**
|
|
266
|
+
- [ ] Create: `Entities/Book.cs`
|
|
267
|
+
- [ ] Update: `Database/ApplicationDbContext.cs` (add `public DbSet<Book> Books { get; set; } = null!;`)
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
### T002: Criar BookErrors (NotFound + outros factory methods)
|
|
272
|
+
- **Category:** errors
|
|
273
|
+
- **Estimate:** 10min
|
|
274
|
+
- **Dependencies:** T001
|
|
275
|
+
|
|
276
|
+
**Description:**
|
|
277
|
+
Criar a classe `BookErrors` static com factory methods para cada tipo de erro da feature. Cada method retorna um `Error` com code e description. Esses erros são compartilhados por todos os slices da BookFeature.
|
|
278
|
+
|
|
279
|
+
**Deliverables:**
|
|
280
|
+
- [ ] Create: `Features/BookFeature/BookErrors.cs`
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### T003: Adicionar ApiTags.Books em Constants/ApiTags.cs
|
|
285
|
+
- **Category:** tags
|
|
286
|
+
- **Estimate:** 5min
|
|
287
|
+
- **Dependencies:** None
|
|
288
|
+
|
|
289
|
+
**Description:**
|
|
290
|
+
Adicionar a constante `Books` em `ApiTags` para uso em todos os endpoints da feature. Se a constante já existir, pular esta task.
|
|
291
|
+
|
|
292
|
+
**Deliverables:**
|
|
293
|
+
- [ ] Update: `Constants/ApiTags.cs` (add `public const string Books = "books";`)
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
### T004: Criar migration AddBook + aplicar ao banco
|
|
298
|
+
- **Category:** migration
|
|
299
|
+
- **Estimate:** 10min
|
|
300
|
+
- **Dependencies:** T001
|
|
301
|
+
|
|
302
|
+
**Description:**
|
|
303
|
+
Gerar a migration EF Core para a entity `Book` e aplicar ao banco local. Verificar que a migration foi gerada corretamente antes de aplicar.
|
|
304
|
+
|
|
305
|
+
**Deliverables:**
|
|
306
|
+
- [ ] Run: `dotnet ef migrations add AddBook`
|
|
307
|
+
- [ ] Run: `dotnet ef database update`
|
|
308
|
+
- [ ] Verify: migration applies without errors
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Phase 2: Slices
|
|
313
|
+
|
|
314
|
+
### T005: Implementar slice CreateBook (Handler + Validator + Endpoint)
|
|
315
|
+
- **Category:** slice
|
|
316
|
+
- **Estimate:** 45min
|
|
317
|
+
- **Dependencies:** T001, T002, T003, T004
|
|
318
|
+
|
|
319
|
+
**Description:**
|
|
320
|
+
Implementar o slice completo de criação. O arquivo Handler deve conter os records `CreateBookRequest` e `CreateBookResponse` no mesmo arquivo. O Validator deve herdar de `AbstractValidator<CreateBookRequest>`. O Endpoint deve ser `internal sealed` e usar `result.Match()` — nunca `result.Value` sem checar `IsSuccess`.
|
|
321
|
+
|
|
322
|
+
Handler injeta: `IRepository<Book>` + `IUnitOfWork`.
|
|
323
|
+
|
|
324
|
+
**Deliverables:**
|
|
325
|
+
- [ ] Create: `Features/BookFeature/CreateBook/CreateBookHandler.cs`
|
|
326
|
+
- [ ] Create: `Features/BookFeature/CreateBook/CreateBookValidator.cs`
|
|
327
|
+
- [ ] Create: `Features/BookFeature/CreateBook/CreateBookEndpoint.cs`
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
### T006: Implementar slice GetAllBooks (Handler + Endpoint, sem Validator)
|
|
332
|
+
- **Category:** slice
|
|
333
|
+
- **Estimate:** 25min
|
|
334
|
+
- **Dependencies:** T001, T004
|
|
335
|
+
|
|
336
|
+
**Description:**
|
|
337
|
+
Implementar o slice de listagem. GetAll NÃO tem Validator (sem parâmetros de entrada para validar). Handler injeta apenas `IRepository<Book>` — não precisa de `IUnitOfWork` (read-only).
|
|
338
|
+
|
|
339
|
+
**Deliverables:**
|
|
340
|
+
- [ ] Create: `Features/BookFeature/GetAllBooks/GetAllBooksHandler.cs`
|
|
341
|
+
- [ ] Create: `Features/BookFeature/GetAllBooks/GetAllBooksEndpoint.cs`
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
### T007: Implementar slice GetBookById (Handler + Validator + Endpoint)
|
|
346
|
+
- **Category:** slice
|
|
347
|
+
- **Estimate:** 30min
|
|
348
|
+
- **Dependencies:** T001, T002, T004
|
|
349
|
+
|
|
350
|
+
**Description:**
|
|
351
|
+
Implementar o slice de busca por ID. Validator verifica que o Guid não é empty. Handler retorna `BookErrors.NotFound()` se o livro não existir. Handler injeta apenas `IRepository<Book>`.
|
|
352
|
+
|
|
353
|
+
**Deliverables:**
|
|
354
|
+
- [ ] Create: `Features/BookFeature/GetBookById/GetBookByIdHandler.cs`
|
|
355
|
+
- [ ] Create: `Features/BookFeature/GetBookById/GetBookByIdValidator.cs`
|
|
356
|
+
- [ ] Create: `Features/BookFeature/GetBookById/GetBookByIdEndpoint.cs`
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
### T008: Implementar slice UpdateBook (Handler + Validator + Endpoint)
|
|
361
|
+
- **Category:** slice
|
|
362
|
+
- **Estimate:** 45min
|
|
363
|
+
- **Dependencies:** T001, T002, T003, T004
|
|
364
|
+
|
|
365
|
+
**Description:**
|
|
366
|
+
Implementar o slice de atualização. Handler retorna `BookErrors.NotFound()` se o livro não existir antes de atualizar. Handler injeta: `IRepository<Book>` + `IUnitOfWork`.
|
|
367
|
+
|
|
368
|
+
**Deliverables:**
|
|
369
|
+
- [ ] Create: `Features/BookFeature/UpdateBook/UpdateBookHandler.cs`
|
|
370
|
+
- [ ] Create: `Features/BookFeature/UpdateBook/UpdateBookValidator.cs`
|
|
371
|
+
- [ ] Create: `Features/BookFeature/UpdateBook/UpdateBookEndpoint.cs`
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
### T009: Implementar slice DeleteBook (Handler + Validator + Endpoint)
|
|
376
|
+
- **Category:** slice
|
|
377
|
+
- **Estimate:** 30min
|
|
378
|
+
- **Dependencies:** T001, T002, T003, T004
|
|
379
|
+
|
|
380
|
+
**Description:**
|
|
381
|
+
Implementar o slice de deleção. Handler verifica existência antes de deletar, retorna `BookErrors.NotFound()` se não existir. Handler injeta: `IRepository<Book>` + `IUnitOfWork`.
|
|
382
|
+
|
|
383
|
+
**Deliverables:**
|
|
384
|
+
- [ ] Create: `Features/BookFeature/DeleteBook/DeleteBookHandler.cs`
|
|
385
|
+
- [ ] Create: `Features/BookFeature/DeleteBook/DeleteBookValidator.cs`
|
|
386
|
+
- [ ] Create: `Features/BookFeature/DeleteBook/DeleteBookEndpoint.cs`
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## Summary
|
|
391
|
+
|
|
392
|
+
| Phase | Tasks | Estimate |
|
|
393
|
+
|-------|-------|----------|
|
|
394
|
+
| Foundation (entity + errors + tags + migration) | T001–T004 | 45min |
|
|
395
|
+
| Slices (Create + GetAll + GetById + Update + Delete) | T005–T009 | 2h55m |
|
|
396
|
+
| **Total** | **9 tasks** | **~3h40m** |
|
|
397
|
+
|
|
398
|
+
> **VSA Note:** No manual DI registration needed — `AddHandlersFromAssembly()`,
|
|
399
|
+
> `RegisterApiEndpointsFromAssembly()`, and `AddValidatorsFromAssembly()` discover
|
|
400
|
+
> all handlers, endpoints and validators automatically via assembly scanning (Scrutor).
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
231
404
|
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 1.5 (UI/UX). Creates design-system.md, mockups.md,
|
|
|
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.9"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH UI/UX Design - FASE 1.5
|
|
@@ -99,9 +99,41 @@ public interface I{{pascalCase FEATURE_NAME}}Service
|
|
|
99
99
|
|
|
100
100
|
---
|
|
101
101
|
|
|
102
|
+
## Architecture Style: Vertical Slice
|
|
103
|
+
|
|
104
|
+
> Preencher SOMENTE se `config.architecture.style === "vertical-slice"`. Omitir em projetos DDD.
|
|
105
|
+
|
|
106
|
+
**Architecture Style:** Vertical Slice Architecture (VSA)
|
|
107
|
+
|
|
108
|
+
**Entity Fields:**
|
|
109
|
+
| Field | Type | Constraints |
|
|
110
|
+
|-------|------|-------------|
|
|
111
|
+
| Id | Guid | PK, `Guid.CreateVersion7()` |
|
|
112
|
+
| {Field} | {C# Type} | {Required / Optional / Unique} |
|
|
113
|
+
| CreatedAt | DateTimeOffset | Auto |
|
|
114
|
+
|
|
115
|
+
**Operations:**
|
|
116
|
+
| Slice | HTTP | Route | Has Validator |
|
|
117
|
+
|-------|------|-------|---------------|
|
|
118
|
+
| Create{Entity} | POST | {ROUTE} | Yes |
|
|
119
|
+
| GetAll{Entity}s | GET | {ROUTE} | No |
|
|
120
|
+
| Get{Entity}ById | GET | {ROUTE}/{id} | Yes |
|
|
121
|
+
| Update{Entity} | PUT | {ROUTE}/{id} | Yes |
|
|
122
|
+
| Delete{Entity} | DELETE | {ROUTE}/{id} | Yes |
|
|
123
|
+
|
|
124
|
+
**Error Types ({Entity}Errors):**
|
|
125
|
+
- `{Entity}Errors.{ErrorName}()` — {description}
|
|
126
|
+
|
|
127
|
+
**Validation Rules:**
|
|
128
|
+
| Field | Rules |
|
|
129
|
+
|-------|-------|
|
|
130
|
+
| {Field} | NotEmpty(), MaxLength({N}), {etc.} |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
102
134
|
## Aggregate Blueprint (Nível 2+ apenas)
|
|
103
135
|
|
|
104
|
-
> Omitir esta seção se Nível 1 (CRUD).
|
|
136
|
+
> Omitir esta seção se Nível 1 (CRUD) ou se Architecture Style = Vertical Slice.
|
|
105
137
|
|
|
106
138
|
### Aggregate Root: {EntityName}
|
|
107
139
|
|
package/package.json
CHANGED
|
@@ -136,6 +136,7 @@ const FRAMEWORK_STANDARDS = [
|
|
|
136
136
|
'framework/standards/architecture/ddd/aggregates.md',
|
|
137
137
|
'framework/standards/architecture/ddd/entities.md',
|
|
138
138
|
'framework/standards/architecture/ddd/value-objects.md',
|
|
139
|
+
'framework/standards/architecture/vertical-slice/vertical-slice.md',
|
|
139
140
|
'framework/standards/data/vector-search/azure-ai-search.md',
|
|
140
141
|
'framework/standards/data/vector-search/rag-chunking.md',
|
|
141
142
|
'framework/standards/context/priming.md',
|