@polymorphism-tech/morph-spec 4.13.0 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,170 +1,143 @@
1
- # Task Planning Patterns — VSA e DDD
2
-
3
- > Padrões detalhados de task planning para VSA e DDD.
4
- > Referenciado pelos Passos 0.5 e 0.6 de `phase-tasks/SKILL.md`.
5
-
6
- ---
7
-
8
- ## Padrão VSA (Vertical Slice Architecture)
9
-
10
- **Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
11
-
12
- ### Categorias de tasks VSA
13
-
14
- Uma task por slice — Handler + Validator + Endpoint juntos:
15
-
16
- | Categoria | Descrição | Arquivo(s) |
17
- |-----------|-----------|------------|
18
- | **entity** | Entity class + DbSet no ApplicationDbContext | `Entities/{Entity}.cs`, `Database/ApplicationDbContext.cs` |
19
- | **errors** | `{Entity}Errors` static class com factory methods | `Features/{Entity}Feature/{Entity}Errors.cs` |
20
- | **tags** | Constante em ApiTags (se tag nova) | `Constants/ApiTags.cs` |
21
- | **migration** | `dotnet ef migrations add` + `database update` | `Migrations/...` |
22
- | **slice** | Slice completo: Handler (+ Request + Response records) + Validator + Endpoint | `Features/{Entity}Feature/{Op}/{Op}Handler.cs`, `...Validator.cs`, `...Endpoint.cs` |
23
- | **tests** | Unit tests dos handlers | `Tests/Features/{Entity}Feature/...` |
24
- | **docs** | README, Swagger, comentários | — |
25
-
26
- ### Ordem obrigatória (bottom-up VSA)
27
-
28
- ```
29
- T001: Entity + DbContext DbSet
30
- ↓
31
- T002: {Entity}Errors (factory methods)
32
- ↓
33
- T003: ApiTags constant (se tag ainda não existe)
34
- ↓
35
- T004: Migration (Add{Entity} + database update)
36
- ↓
37
- T005: Slice Create{Entity} ← Handler+Validator+Endpoint = 1 task
38
- T006: Slice GetAll{Entity}s ← Handler+Endpoint = 1 task (sem Validator)
39
- T007: Slice Get{Entity}ById ← Handler+Validator+Endpoint = 1 task
40
- T008: Slice Update{Entity} ← Handler+Validator+Endpoint = 1 task
41
- T009: Slice Delete{Entity} ← Handler+Validator+Endpoint = 1 task
42
- ↓
43
- T010+: Slices customizados (operações extra do VSA Blueprint)
44
- ↓
45
- T0NN: Tests
46
- ```
47
-
48
- ### Regras VSA para tasks
49
-
50
- - 1 task = 1 slice completo (Handler + Validator + Endpoint num único task)
51
- - `GetAll` NÃO tem Validator — mencionar explicitamente no task
52
- - Cada task de slice lista os 3 arquivos que devem ser criados no campo `files`
53
- - Entity task deve incluir a linha `DbSet<{Entity}>` no `ApplicationDbContext`
54
- - Migration task é separada da entity task (pode rodar em paralelo com errors + tags)
55
-
56
- ### Exemplos de tasks VSA
57
-
58
- ```json
59
- { "id": "T001", "title": "Criar Entity Book + registrar DbSet no ApplicationDbContext",
60
- "category": "entity", "dependencies": [], "estimatedMinutes": 20,
61
- "files": ["Entities/Book.cs", "Database/ApplicationDbContext.cs"] }
62
-
63
- { "id": "T002", "title": "Criar BookErrors (NotFound + outros factory methods)",
64
- "category": "errors", "dependencies": ["T001"], "estimatedMinutes": 10,
65
- "files": ["Features/BookFeature/BookErrors.cs"] }
66
-
67
- { "id": "T003", "title": "Adicionar ApiTags.Books em Constants/ApiTags.cs",
68
- "category": "tags", "dependencies": [], "estimatedMinutes": 5,
69
- "files": ["Constants/ApiTags.cs"] }
70
-
71
- { "id": "T004", "title": "Criar migration AddBook + aplicar ao banco",
72
- "category": "migration", "dependencies": ["T001"], "estimatedMinutes": 10,
73
- "files": ["Migrations/...AddBook.cs"] }
74
-
75
- { "id": "T005", "title": "Implementar slice CreateBook (Handler + Validator + Endpoint)",
76
- "category": "slice", "dependencies": ["T001", "T002", "T003", "T004"],
77
- "estimatedMinutes": 45,
78
- "files": [
79
- "Features/BookFeature/CreateBook/CreateBookHandler.cs",
80
- "Features/BookFeature/CreateBook/CreateBookValidator.cs",
81
- "Features/BookFeature/CreateBook/CreateBookEndpoint.cs"
82
- ] }
83
-
84
- { "id": "T006", "title": "Implementar slice GetAllBooks (Handler + Endpoint, sem Validator)",
85
- "category": "slice", "dependencies": ["T001", "T004"], "estimatedMinutes": 25,
86
- "files": [
87
- "Features/BookFeature/GetAllBooks/GetAllBooksHandler.cs",
88
- "Features/BookFeature/GetAllBooks/GetAllBooksEndpoint.cs"
89
- ] }
90
- ```
91
-
92
- ---
93
-
94
- ## Padrão DDD — Mapeamento de Níveis para Categorias
95
-
96
- ### Categorias por nível de complexidade
97
-
98
- | Nível | Categorias de Tasks |
99
- |-------|---------------------|
100
- | **1 — CRUD** | `domain` (Entity simples) → `infrastructure` (Repository, EF Config) → `application` (Service CRUD) → `presentation` (API/Page) → `tests` |
101
- | **2 — Business Logic** | `domain` (AggregateRoot, ValueObjects, DomainEvents) → `infrastructure` (Repository, EF Config) → `application` (Commands, Queries, Handlers) → `presentation` (API/Page) → `tests` |
102
- | **3 — Bounded Context** | `domain-bc` (BC setup, Aggregates, Events) → `infrastructure` (BC repositories, EF) → `application` (Commands, Queries, Integration handlers) → `presentation` → `tests` |
103
-
104
- **Nível 1:** Nenhuma task adicional obrigatória — apenas o padrão CRUD nas categorias listadas.
105
-
106
- ### Tasks adicionais obrigatórias por nível
107
-
108
- **Nível 2 apenas:**
109
- - `T{N}: Implementar AggregateRoot {EntityName} com factory method e invariants` (domain)
110
- - `T{N}: Implementar ValueObjects: {lista do Aggregate Blueprint}` (domain)
111
- - `T{N}: Implementar DomainEvents: {lista do Aggregate Blueprint}` (domain)
112
- - `T{N}: Implementar Command Handlers com MediatR` (application)
113
- - `T{N}: Implementar Query Handlers com read models` (application)
114
-
115
- **Nível 3 apenas (além do Nível 2):**
116
- - `T{N}: Configurar namespace/pasta do Bounded Context {BoundedContext}` (infrastructure)
117
- - `T{N}: Implementar Integration Events para comunicação cross-BC` (domain-bc)
118
- - `T{N}: Implementar handlers de Integration Events` (application)
119
-
120
- ---
121
-
122
- ## Estrutura de Task (formato JSON)
123
-
124
- ```json
125
- {
126
- "id": "T001",
127
- "title": "Criar Entity {Nome}",
128
- "description": "Implementar entity {Nome} com propriedades X, Y, Z seguindo padrões EF Core",
129
- "category": "domain",
130
- "dependencies": [],
131
- "estimatedMinutes": 30,
132
- "status": "pending",
133
- "specSections": ["## Domain Model", "## Business Rules"],
134
- "contractInterfaces": ["I{Nome}Repository"],
135
- "files": [
136
- "Domain/Entities/{Nome}.cs",
137
- "Infrastructure/Data/Configurations/{Nome}Configuration.cs"
138
- ]
139
- }
140
- ```
141
-
142
- ## Categorias de Tasks (DDD)
143
-
144
- | Categoria | Descrição | Exemplos |
145
- |-----------|-----------|----------|
146
- | **domain** | Entities, Value Objects, Enums | Entity, DomainException |
147
- | **application** | Services, DTOs, Interfaces | Service, Validator, Mapper |
148
- | **infrastructure** | DbContext, Repositories, External APIs | EF Config, Repository impl |
149
- | **presentation** | Controllers, Pages, Components | API endpoint, Blazor page |
150
- | **tests** | Unit tests, Integration tests | Service tests, API tests |
151
- | **infra** | Bicep, Migrations, Scripts | Azure resources, DB migration |
152
- | **docs** | README, API docs, Swagger | OpenAPI spec, README update |
153
-
154
- ## Ordem de Implementação Bottom-Up
155
-
156
- ```
157
- 1. Domain (Entities, Enums, Value Objects)
158
- ↓
159
- 2. Infrastructure (Repositories, DbContext configs)
160
- ↓
161
- 3. Application (Services, DTOs, Business logic)
162
- ↓
163
- 4. Presentation (Controllers, Pages, Components)
164
- ↓
165
- 5. Tests (Unit → Integration)
166
- ↓
167
- 6. Infra (Bicep, Migrations, Deploy scripts)
168
- ↓
169
- 7. Docs (README, Swagger, Comments)
170
- ```
1
+ # Task Planning Patterns — VSA
2
+
3
+ > Padrões detalhados de task planning para Vertical Slice Architecture.
4
+ > Referenciado pelos Passos 0.5 e 0.6 de `phase-tasks/SKILL.md`.
5
+
6
+ ---
7
+
8
+ ## Padrão VSA (Vertical Slice Architecture)
9
+
10
+ **Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
11
+
12
+ ### Categorias de tasks VSA
13
+
14
+ Uma task por slice — Handler + Validator + Endpoint juntos:
15
+
16
+ | Categoria | Descrição | Arquivo(s) |
17
+ |-----------|-----------|------------|
18
+ | **entity** | Entity class + DbSet no ApplicationDbContext | `Entities/{Entity}.cs`, `Database/ApplicationDbContext.cs` |
19
+ | **errors** | `{Entity}Errors` static class com factory methods | `Features/{Entity}Feature/{Entity}Errors.cs` |
20
+ | **tags** | Constante em ApiTags (se tag nova) | `Constants/ApiTags.cs` |
21
+ | **migration** | `dotnet ef migrations add` + `database update` | `Migrations/...` |
22
+ | **slice** | Slice completo: Handler (+ Request + Response records) + Validator + Endpoint | `Features/{Entity}Feature/{Op}/{Op}Handler.cs`, `...Validator.cs`, `...Endpoint.cs` |
23
+ | **tests** | Unit tests dos handlers | `Tests/Features/{Entity}Feature/...` |
24
+ | **docs** | README, Swagger, comentários | — |
25
+
26
+ ### Ordem obrigatória (bottom-up VSA)
27
+
28
+ ```
29
+ T001: Entity + DbContext DbSet
30
+ ↓
31
+ T002: {Entity}Errors (factory methods)
32
+ ↓
33
+ T003: ApiTags constant (se tag ainda não existe)
34
+ ↓
35
+ T004: Migration (Add{Entity} + database update)
36
+ ↓
37
+ T005: Slice Create{Entity} ← Handler+Validator+Endpoint = 1 task
38
+ T006: Slice GetAll{Entity}s ← Handler+Endpoint = 1 task (sem Validator)
39
+ T007: Slice Get{Entity}ById ← Handler+Validator+Endpoint = 1 task
40
+ T008: Slice Update{Entity} ← Handler+Validator+Endpoint = 1 task
41
+ T009: Slice Delete{Entity} ← Handler+Validator+Endpoint = 1 task
42
+ ↓
43
+ T010+: Slices customizados (operações extra do VSA Blueprint)
44
+ ↓
45
+ T0NN: Tests
46
+ ```
47
+
48
+ ### Regras VSA para tasks
49
+
50
+ - 1 task = 1 slice completo (Handler + Validator + Endpoint num único task)
51
+ - `GetAll` NÃO tem Validator — mencionar explicitamente no task
52
+ - Cada task de slice lista os 3 arquivos que devem ser criados no campo `files`
53
+ - Entity task deve incluir a linha `DbSet<{Entity}>` no `ApplicationDbContext`
54
+ - Migration task é separada da entity task (pode rodar em paralelo com errors + tags)
55
+
56
+ ### Exemplos de tasks VSA
57
+
58
+ ```json
59
+ { "id": "T001", "title": "Criar Entity Book + registrar DbSet no ApplicationDbContext",
60
+ "category": "entity", "dependencies": [], "estimatedMinutes": 20,
61
+ "files": ["Entities/Book.cs", "Database/ApplicationDbContext.cs"] }
62
+
63
+ { "id": "T002", "title": "Criar BookErrors (NotFound + outros factory methods)",
64
+ "category": "errors", "dependencies": ["T001"], "estimatedMinutes": 10,
65
+ "files": ["Features/BookFeature/BookErrors.cs"] }
66
+
67
+ { "id": "T003", "title": "Adicionar ApiTags.Books em Constants/ApiTags.cs",
68
+ "category": "tags", "dependencies": [], "estimatedMinutes": 5,
69
+ "files": ["Constants/ApiTags.cs"] }
70
+
71
+ { "id": "T004", "title": "Criar migration AddBook + aplicar ao banco",
72
+ "category": "migration", "dependencies": ["T001"], "estimatedMinutes": 10,
73
+ "files": ["Migrations/...AddBook.cs"] }
74
+
75
+ { "id": "T005", "title": "Implementar slice CreateBook (Handler + Validator + Endpoint)",
76
+ "category": "slice", "dependencies": ["T001", "T002", "T003", "T004"],
77
+ "estimatedMinutes": 45,
78
+ "files": [
79
+ "Features/BookFeature/CreateBook/CreateBookHandler.cs",
80
+ "Features/BookFeature/CreateBook/CreateBookValidator.cs",
81
+ "Features/BookFeature/CreateBook/CreateBookEndpoint.cs"
82
+ ] }
83
+
84
+ { "id": "T006", "title": "Implementar slice GetAllBooks (Handler + Endpoint, sem Validator)",
85
+ "category": "slice", "dependencies": ["T001", "T004"], "estimatedMinutes": 25,
86
+ "files": [
87
+ "Features/BookFeature/GetAllBooks/GetAllBooksHandler.cs",
88
+ "Features/BookFeature/GetAllBooks/GetAllBooksEndpoint.cs"
89
+ ] }
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Estrutura de Task (formato JSON)
95
+
96
+ ```json
97
+ {
98
+ "id": "T001",
99
+ "title": "Criar Entity {Nome}",
100
+ "description": "Implementar entity {Nome} com propriedades X, Y, Z seguindo padrões EF Core",
101
+ "category": "entity",
102
+ "dependencies": [],
103
+ "estimatedMinutes": 30,
104
+ "status": "pending",
105
+ "specSections": ["## Domain Model", "## Business Rules"],
106
+ "contractInterfaces": ["I{Nome}Repository"],
107
+ "files": [
108
+ "Entities/{Nome}.cs",
109
+ "Database/ApplicationDbContext.cs"
110
+ ]
111
+ }
112
+ ```
113
+
114
+ ## Categorias de Tasks (VSA)
115
+
116
+ | Categoria | Descrição | Exemplos |
117
+ |-----------|-----------|----------|
118
+ | **entity** | Entities, Enums | Entity class, DbSet registration |
119
+ | **errors** | Error factory classes | `{Entity}Errors.cs` |
120
+ | **tags** | API endpoint tags | `ApiTags.cs` constants |
121
+ | **migration** | DB migrations | EF migrations |
122
+ | **slice** | Complete VSA slice | Handler + Validator + Endpoint |
123
+ | **tests** | Unit tests, Integration tests | Handler tests, API tests |
124
+ | **infra** | Docker, Migrations, Scripts | docker-compose, Supabase migrations |
125
+ | **docs** | README, API docs | OpenAPI spec, README update |
126
+
127
+ ## Ordem de Implementação Bottom-Up (VSA)
128
+
129
+ ```
130
+ 1. Entity + DbContext registration
131
+ ↓
132
+ 2. Errors + ApiTags
133
+ ↓
134
+ 3. Migrations
135
+ ↓
136
+ 4. Slices (Handler + Validator + Endpoint per operation)
137
+ ↓
138
+ 5. Tests (Unit → Integration)
139
+ ↓
140
+ 6. Infra (Docker, Supabase migrations)
141
+ ↓
142
+ 7. Docs (README, Swagger)
143
+ ```
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 2 (UI/UX). Creates design-system.md, mockups.md, c
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.13.0"
7
+ cliVersion: "4.14.0"
8
8
  ---
9
9
 
10
10
  # MORPH UI/UX Design - Phase 2
@@ -4,7 +4,7 @@ description: Guided workflow for mid-implementation scope escalation — analyze
4
4
  user-invocable: true
5
5
  argument-hint: "[feature-name]"
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.13.0"
7
+ cliVersion: "4.14.0"
8
8
  ---
9
9
 
10
10
  # Scope Escalation Workflow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymorphism-tech/morph-spec",
3
- "version": "4.13.0",
3
+ "version": "4.14.0",
4
4
  "description": "MORPH-SPEC: AI-First development framework with validation pipeline and multi-stack support",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -103,23 +103,31 @@ export async function installAgents(projectDir, frameworkDir = 'framework', opti
103
103
  /**
104
104
  * Tier-based defaults for Claude Code subagent frontmatter fields.
105
105
  *
106
- * Tier 1 (Orchestrators): can spawn subagents via Task tool, 30 turns, project memory.
107
- * Tier 2 (Domain Leaders): coordinate specialists but do not spawn subagents, 20 turns, local memory.
106
+ * Tier 1 (Orchestrators): opus model, can spawn subagents via Agent tool, 30 turns, project memory, high effort.
107
+ * Tier 2 (Domain Leaders): sonnet model, coordinate specialists, 20 turns, local memory, medium effort.
108
+ * Tier 3 (Specialists): sonnet model, implementation focus, 15 turns, local memory, medium effort.
109
+ * Tier 4 (Validators): haiku model, read-only scanning, 10 turns, background execution, low effort.
108
110
  */
109
111
  const TIER_DEFAULTS = {
110
112
  1: {
111
- model: 'inherit',
112
- tools: 'Read, Grep, Glob, Bash, Task, Write, Edit',
113
+ model: 'opus',
114
+ tools: 'Read, Grep, Glob, Bash, Agent, Write, Edit',
113
115
  maxTurns: 30,
114
116
  skills: ['morph-checklist'],
115
117
  memory: 'project',
118
+ effort: 'high',
119
+ permissionMode: 'acceptEdits',
120
+ background: false,
116
121
  },
117
122
  2: {
118
- model: 'inherit',
123
+ model: 'sonnet',
119
124
  tools: 'Read, Write, Edit, Bash, Glob, Grep',
120
125
  maxTurns: 20,
121
126
  skills: ['morph-checklist'],
122
127
  memory: 'local',
128
+ effort: 'medium',
129
+ permissionMode: 'acceptEdits',
130
+ background: false,
123
131
  },
124
132
  3: {
125
133
  model: 'sonnet',
@@ -127,6 +135,9 @@ const TIER_DEFAULTS = {
127
135
  maxTurns: 15,
128
136
  skills: [],
129
137
  memory: 'local',
138
+ effort: 'medium',
139
+ permissionMode: 'default',
140
+ background: false,
130
141
  },
131
142
  4: {
132
143
  model: 'haiku',
@@ -134,6 +145,9 @@ const TIER_DEFAULTS = {
134
145
  maxTurns: 10,
135
146
  skills: [],
136
147
  memory: 'project',
148
+ effort: 'low',
149
+ permissionMode: 'plan',
150
+ background: true,
137
151
  },
138
152
  };
139
153
 
@@ -149,10 +163,14 @@ function buildFrontmatter(agent, description) {
149
163
  const defaults = TIER_DEFAULTS[agent.tier] ?? TIER_DEFAULTS[2];
150
164
  const name = agent.title ?? agent.name;
151
165
 
152
- // Allow per-agent tool overrides (e.g., morph-spec-validator needs Bash for npm test)
166
+ // Allow per-agent overrides from teammate config
153
167
  const tools = agent.teammate?.tools ?? defaults.tools;
154
- // Allow per-agent maxTurns override
155
168
  const maxTurns = agent.teammate?.maxTurns ?? defaults.maxTurns;
169
+ const effort = agent.teammate?.effort ?? defaults.effort;
170
+ const permissionMode = agent.teammate?.permissionMode ?? defaults.permissionMode;
171
+ const background = agent.teammate?.background ?? defaults.background;
172
+ // color is a top-level field on the agent (not inside teammate)
173
+ const color = agent.color;
156
174
 
157
175
  const lines = [
158
176
  `name: ${name}`,
@@ -162,6 +180,11 @@ function buildFrontmatter(agent, description) {
162
180
  `maxTurns: ${maxTurns}`,
163
181
  ];
164
182
 
183
+ if (color) lines.push(`color: ${color}`);
184
+ if (effort) lines.push(`effort: ${effort}`);
185
+ if (permissionMode && permissionMode !== 'default') lines.push(`permissionMode: ${permissionMode}`);
186
+ if (background) lines.push(`background: true`);
187
+
165
188
  if (defaults.skills.length > 0) {
166
189
  const skillsList = defaults.skills.map(s => ` - ${s}`).join('\n');
167
190
  lines.push(`skills:`, skillsList);
@@ -183,11 +206,18 @@ const GROUP_TO_CATEGORIES = {
183
206
 
184
207
  function buildDescription(agent) {
185
208
  const role = agent.teammate?.role ?? `Handles ${(agent.domains ?? []).join(', ')}`;
209
+ const triggers = agent.teammate?.triggers;
186
210
  const categories = GROUP_TO_CATEGORIES[agent.group];
187
- const suffix = categories ? ` | Tasks: ${categories}` : '';
188
- const full = `${role}${suffix}`;
211
+
212
+ let desc = role;
213
+ if (triggers) {
214
+ desc += `. Use proactively when: ${triggers}`;
215
+ } else if (categories) {
216
+ desc += ` | Tasks: ${categories}`;
217
+ }
218
+
189
219
  // Truncate to 200 chars for settings display
190
- return full.length > 200 ? full.slice(0, 197) + '...' : full;
220
+ return desc.length > 200 ? desc.slice(0, 197) + '...' : desc;
191
221
  }
192
222
 
193
223
  /**