@polymorphism-tech/morph-spec 7.1.0 → 7.2.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,200 +1,200 @@
1
- # morph-spec Quick Start
2
-
3
- ## Install
4
-
5
- ```bash
6
- npm install -g @polymorphism-tech/morph-spec
7
- ```
8
-
9
- > The installer automatically configures your PowerShell PATH on Windows. If `morph-spec` is not found, open a new terminal window.
10
-
11
- ---
12
-
13
- ## Initialize a project
14
-
15
- Navigate to your project root and run:
16
-
17
- ```bash
18
- morph-spec init
19
- ```
20
-
21
- `init` does the following:
22
- - Auto-detects your stack (Blazor, Next.js, Node.js, monorepo)
23
- - Creates `.morph/` with framework files, standards, and templates
24
- - Creates `.morph/context/` with inferred project context
25
- - Installs `.claude/skills/`, `.claude/agents/`, `.claude/rules/`
26
- - Writes `.claude/settings.local.json` with 10 Claude Code hooks
27
- - Copies `CLAUDE.md` with runtime instructions
28
-
29
- Verify the installation:
30
-
31
- ```bash
32
- morph-spec doctor
33
- ```
34
-
35
- ---
36
-
37
- ## Your first feature
38
-
39
- Open your project in Claude Code and run:
40
-
41
- ```
42
- /morph-proposal my-feature
43
- ```
44
-
45
- Replace `my-feature` with a short kebab-case name for your feature (e.g., `user-notifications`, `payment-flow`).
46
-
47
- The proposal pipeline runs phases 0–6 with three approval gates:
48
-
49
- ### Phase 0 — Proposal
50
-
51
- Claude analyzes your request, detects which agents are relevant, and produces `0-proposal/proposal.md`. You review it and approve (or request changes).
52
-
53
- ### Phase 1 — Setup
54
-
55
- Loads project context from `.morph/context/`, confirms stack and active agents. No approval needed.
56
-
57
- ### Phase 2 — UI/UX (conditional)
58
-
59
- Only runs if frontend agents are active. Claude generates:
60
- - `1-design/design-system.md` — colors, typography, spacing
61
- - `1-design/mockups.md` — ASCII wireframes
62
- - `1-design/components.md` — component specs
63
- - `1-design/flows.md` — user flows and edge cases
64
-
65
- You approve the UI design before design phase begins.
66
-
67
- ### Phase 3 — Design
68
-
69
- Claude produces the technical specification:
70
- - `2-design/spec.md` — full requirements, use cases, validations
71
- - `2-design/contracts.cs` — C# interfaces, DTOs, enums
72
- - `2-design/decisions.md` — architectural decision records (ADRs)
73
-
74
- You review and approve the design.
75
-
76
- ### Phase 4 — Clarify
77
-
78
- Claude identifies 3–7 ambiguities in the spec, asks you to resolve them, then updates the spec. No gate.
79
-
80
- ### Phase 6 — Tasks
81
-
82
- Claude breaks the spec into atomic tasks (`T001`, `T002`, …) saved to `3-tasks/tasks.md`. You approve the task list.
83
-
84
- At this point, planning is complete:
85
-
86
- ```
87
- ✅ Planning complete — run /morph-apply my-feature to implement
88
- ```
89
-
90
- ---
91
-
92
- ## Implement
93
-
94
- ```
95
- /morph-apply my-feature
96
- ```
97
-
98
- Claude reads `spec.md`, `contracts.cs`, and `tasks.md`, then implements task by task:
99
- - Starts each task, writes the code, marks it done
100
- - Runs 5 validators automatically after each task: security, architecture, packages, design system, Blazor concurrency
101
- - Auto-checkpoints every 3 tasks (validates, saves state)
102
- - Generates `4-implement/recap.md` on completion
103
-
104
- ---
105
-
106
- ## During development
107
-
108
- Check feature state:
109
-
110
- ```bash
111
- morph-spec state get my-feature
112
- morph-spec status my-feature
113
- ```
114
-
115
- Advance to the next phase manually (when needed):
116
-
117
- ```bash
118
- morph-spec phase advance my-feature
119
- ```
120
-
121
- Mark a task complete:
122
-
123
- ```bash
124
- morph-spec task done my-feature T001
125
- ```
126
-
127
- Run validators at any time:
128
-
129
- ```bash
130
- morph-spec validate # all validators
131
- morph-spec validate architecture # specific validator
132
- morph-spec validate packages
133
- ```
134
-
135
- ---
136
-
137
- ## Multiple features
138
-
139
- You can have multiple features in progress simultaneously. Each has its own directory under `.morph/features/`:
140
-
141
- ```
142
- .morph/features/
143
- ├── user-notifications/
144
- │ ├── 0-proposal/
145
- │ ├── 2-design/
146
- │ └── 3-tasks/
147
- └── payment-flow/
148
- ├── 0-proposal/
149
- └── 2-design/
150
- ```
151
-
152
- See all feature states:
153
-
154
- ```bash
155
- morph-spec state list
156
- ```
157
-
158
- ---
159
-
160
- ## Keeping up to date
161
-
162
- When a new version of `@polymorphism-tech/morph-spec` is published:
163
-
164
- ```bash
165
- # Update the CLI
166
- npm install -g @polymorphism-tech/morph-spec@latest
167
-
168
- # Update framework files in your project
169
- morph-spec update
170
-
171
- # Verify
172
- morph-spec doctor
173
- ```
174
-
175
- `morph-spec update` re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md`. It does not touch your config, context, or feature outputs.
176
-
177
- ---
178
-
179
- ## Tips
180
-
181
- **Use `/morph-proposal` even for small features.** The proposal phase catches scope creep, identifies the right agents, and generates contracts early — before implementation makes it expensive to change direction.
182
-
183
- **Approve explicitly at each gate.** The design gate exists to prevent implementing the wrong thing. If something in `spec.md` or `contracts.cs` looks off, say so before approving.
184
-
185
- **ADRs belong in `decisions.md`.** When Claude makes an architectural choice, it documents it there. Read it after Design completes. Decisions drive the validators that run during implementation.
186
-
187
- **`morph-spec doctor` is your first debugging step.** If something is behaving unexpectedly, doctor will surface version mismatches, missing files, and hook configuration issues.
188
-
189
- ---
190
-
191
- ## Next steps
192
-
193
- - [CHEATSHEET.md](CHEATSHEET.md) — command reference
194
- - [ARCHITECTURE.md](ARCHITECTURE.md) — system design and agent hierarchy
195
- - [CHANGELOG.md](../CHANGELOG.md) — release history
196
- - `.morph/framework/standards/` — all coding and architecture standards
197
-
198
- ---
199
-
200
- *morph-spec v4.22.1 by Polymorphism Tech*
1
+ # morph-spec Quick Start
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ npm install -g @polymorphism-tech/morph-spec
7
+ ```
8
+
9
+ > The installer automatically configures your PowerShell PATH on Windows. If `morph-spec` is not found, open a new terminal window.
10
+
11
+ ---
12
+
13
+ ## Initialize a project
14
+
15
+ Navigate to your project root and run:
16
+
17
+ ```bash
18
+ morph-spec init
19
+ ```
20
+
21
+ `init` does the following:
22
+ - Auto-detects your stack (Blazor, Next.js, Node.js, monorepo)
23
+ - Creates `.morph/` with framework files, standards, and templates
24
+ - Creates `.morph/context/` with inferred project context
25
+ - Installs `.claude/skills/`, `.claude/agents/`, `.claude/rules/`
26
+ - Writes `.claude/settings.local.json` with 10 Claude Code hooks
27
+ - Copies `CLAUDE.md` with runtime instructions
28
+
29
+ Verify the installation:
30
+
31
+ ```bash
32
+ morph-spec doctor
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Your first feature
38
+
39
+ Open your project in Claude Code and run:
40
+
41
+ ```
42
+ /morph-proposal my-feature
43
+ ```
44
+
45
+ Replace `my-feature` with a short kebab-case name for your feature (e.g., `user-notifications`, `payment-flow`).
46
+
47
+ The proposal pipeline runs phases 0–6 with three approval gates:
48
+
49
+ ### Phase 0 — Proposal
50
+
51
+ Claude analyzes your request, detects which agents are relevant, and produces `0-proposal/proposal.md`. You review it and approve (or request changes).
52
+
53
+ ### Phase 1 — Setup
54
+
55
+ Loads project context from `.morph/context/`, confirms stack and active agents. No approval needed.
56
+
57
+ ### Phase 2 — UI/UX (conditional)
58
+
59
+ Only runs if frontend agents are active. Claude generates:
60
+ - `1-design/design-system.md` — colors, typography, spacing
61
+ - `1-design/mockups.md` — ASCII wireframes
62
+ - `1-design/components.md` — component specs
63
+ - `1-design/flows.md` — user flows and edge cases
64
+
65
+ You approve the UI design before design phase begins.
66
+
67
+ ### Phase 3 — Design
68
+
69
+ Claude produces the technical specification:
70
+ - `2-design/spec.md` — full requirements, use cases, validations
71
+ - `2-design/contracts.cs` — C# interfaces, DTOs, enums
72
+ - `2-design/decisions.md` — architectural decision records (ADRs)
73
+
74
+ You review and approve the design.
75
+
76
+ ### Phase 4 — Clarify
77
+
78
+ Claude identifies 3–7 ambiguities in the spec, asks you to resolve them, then updates the spec. No gate.
79
+
80
+ ### Phase 6 — Tasks
81
+
82
+ Claude breaks the spec into atomic tasks (`T001`, `T002`, …) saved to `3-tasks/tasks.md`. You approve the task list.
83
+
84
+ At this point, planning is complete:
85
+
86
+ ```
87
+ ✅ Planning complete — run /morph-apply my-feature to implement
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Implement
93
+
94
+ ```
95
+ /morph-apply my-feature
96
+ ```
97
+
98
+ Claude reads `spec.md`, `contracts.cs`, and `tasks.md`, then implements task by task:
99
+ - Starts each task, writes the code, marks it done
100
+ - Runs 5 validators automatically after each task: security, architecture, packages, design system, Blazor concurrency
101
+ - Auto-checkpoints every 3 tasks (validates, saves state)
102
+ - Generates `4-implement/recap.md` on completion
103
+
104
+ ---
105
+
106
+ ## During development
107
+
108
+ Check feature state:
109
+
110
+ ```bash
111
+ morph-spec state get my-feature
112
+ morph-spec status my-feature
113
+ ```
114
+
115
+ Advance to the next phase manually (when needed):
116
+
117
+ ```bash
118
+ morph-spec phase advance my-feature
119
+ ```
120
+
121
+ Mark a task complete:
122
+
123
+ ```bash
124
+ morph-spec task done my-feature T001
125
+ ```
126
+
127
+ Run validators at any time:
128
+
129
+ ```bash
130
+ morph-spec validate # all validators
131
+ morph-spec validate architecture # specific validator
132
+ morph-spec validate packages
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Multiple features
138
+
139
+ You can have multiple features in progress simultaneously. Each has its own directory under `.morph/features/`:
140
+
141
+ ```
142
+ .morph/features/
143
+ ├── user-notifications/
144
+ │ ├── 0-proposal/
145
+ │ ├── 2-design/
146
+ │ └── 3-tasks/
147
+ └── payment-flow/
148
+ ├── 0-proposal/
149
+ └── 2-design/
150
+ ```
151
+
152
+ See all feature states:
153
+
154
+ ```bash
155
+ morph-spec state list
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Keeping up to date
161
+
162
+ When a new version of `@polymorphism-tech/morph-spec` is published:
163
+
164
+ ```bash
165
+ # Update the CLI
166
+ npm install -g @polymorphism-tech/morph-spec@latest
167
+
168
+ # Update framework files in your project
169
+ morph-spec update
170
+
171
+ # Verify
172
+ morph-spec doctor
173
+ ```
174
+
175
+ `morph-spec update` re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md`. It does not touch your config, context, or feature outputs.
176
+
177
+ ---
178
+
179
+ ## Tips
180
+
181
+ **Use `/morph-proposal` even for small features.** The proposal phase catches scope creep, identifies the right agents, and generates contracts early — before implementation makes it expensive to change direction.
182
+
183
+ **Approve explicitly at each gate.** The design gate exists to prevent implementing the wrong thing. If something in `spec.md` or `contracts.cs` looks off, say so before approving.
184
+
185
+ **ADRs belong in `decisions.md`.** When Claude makes an architectural choice, it documents it there. Read it after Design completes. Decisions drive the validators that run during implementation.
186
+
187
+ **`morph-spec doctor` is your first debugging step.** If something is behaving unexpectedly, doctor will surface version mismatches, missing files, and hook configuration issues.
188
+
189
+ ---
190
+
191
+ ## Next steps
192
+
193
+ - [CHEATSHEET.md](CHEATSHEET.md) — command reference
194
+ - [ARCHITECTURE.md](ARCHITECTURE.md) — system design and agent hierarchy
195
+ - [CHANGELOG.md](../CHANGELOG.md) — release history
196
+ - `.morph/framework/standards/` — all coding and architecture standards
197
+
198
+ ---
199
+
200
+ *morph-spec v7.2.0 by Polymorphism Tech*
@@ -14,12 +14,14 @@ Se não houver feature ativa, pergunte ao usuário qual feature trabalhar.
14
14
 
15
15
  **NUNCA:**
16
16
  - Pular para código sem proposal aprovado (Gate 1) e plano aprovado (Gate 2).
17
- - Modificar `spec.md`, `mandate.md`, `tasks.md` depois do Gate 2 — eles estão congelados.
17
+ - Modificar o contrato do plano depois do Gate 2: `spec.md`, `mandate.md`, e os campos de plano de `tasks.json` (`title`, `description`, `dependencies`, `effort`, `doneCriteria`, `group`) estão congelados.
18
+ - Usar `Edit` em `tasks.json` após o Gate 2 — o arquivo é gravado inteiro via `writeTasksJson` (Write). O hook `protect-spec-files` bloqueia `Edit`.
18
19
  - Listar perguntas em texto simples — sempre use a tool `AskUserQuestion` (1-4 perguntas por chamada).
19
- - Usar `Guid.NewGuid()`, classes não-sealed sem justificativa, exceptions como fluxo de controle, Repository pattern.
20
+ - Usar `Guid.NewGuid()`, classes não-sealed sem justificativa, exceptions como fluxo de controle, camada de Service/Manager entre handler e dados, ou SQL cru sem justificativa.
20
21
 
21
22
  **SEMPRE:**
22
23
  - Auto-advance entre tarefas durante a fase implement — não pause sem ambiguidade bloqueante.
24
+ - Atualizar o progresso em `tasks.json` via `writeTasksJson` ao concluir cada task — apenas os campos `status`, `outputs` e `notes` mudam; o contrato do plano permanece congelado.
23
25
  - Apresentar gates com o template fixo definido em MORPH.md / morph-plan.
24
26
  - Registrar decisões não triviais em `decisions.md`.
25
27
  - Aplicar `morph-eval` após cada tarefa; silêncio em score ≥ 8 é o sinal correto.
@@ -48,7 +48,10 @@ Padrões proibidos automaticamente injetados no mandate:
48
48
  - `Guid.NewGuid()` → `Guid.CreateVersion7()`
49
49
  - Classes não-sealed sem justificativa
50
50
  - Exceptions como fluxo de controle
51
- - Repository pattern / `IRepository<T>` (VSA usa handlers diretos no DbContext)
51
+ - Camada de Service/Manager entre handler e dados — o handler fala com `IRepository<T>` ou `DbContext`, nunca com um service
52
+ - SQL cru (`FromSqlRaw`, `ExecuteQuery(string)`) sem justificativa em `decisions.md` — use LINQ
53
+
54
+ Acesso a dados em VSA é híbrido: `IRepository<T>` + `IUnitOfWork` para CRUD simples; `ApplicationDbContext` injetado direto no slice quando a query for específica (joins, projeção, paginação, filtros compostos).
52
55
 
53
56
  ---
54
57
 
@@ -61,8 +64,8 @@ Responsabilidades: ler o mandato, entender o escopo, propor o plano de ataque, i
61
64
  Anti-padrão: o Orchestrator não escreve código. Se você está no papel de Orchestrator e percebe que começou a implementar algo, pare — você transitou de papel sem intenção, e o plano provavelmente ainda não está fechado.
62
65
 
63
66
  **Specialist** — ativo durante a fase de implementação.
64
- Responsabilidades: executar tarefas do tasks.md em ordem, consultar standards relevantes antes de cada tarefa, registrar decisões e desvios no decisions.md, manter o recap.md atualizado ao final de cada tarefa.
65
- Anti-padrão: o Specialist não cria novas tarefas. Descobertas de escopo durante a implementação vão para o decisions.md com flag "escopo expandido" — o Orchestrator avalia se o tasks.md precisa ser atualizado.
67
+ Responsabilidades: executar tarefas do tasks.json em ordem, consultar standards relevantes antes de cada tarefa, registrar decisões e desvios no decisions.md, manter o recap.md atualizado ao final de cada tarefa.
68
+ Anti-padrão: o Specialist não cria novas tarefas. Descobertas de escopo durante a implementação vão para o decisions.md com flag "escopo expandido" — o Orchestrator avalia se o tasks.json precisa ser atualizado.
66
69
 
67
70
  **Evaluator** — ativo após uma tarefa ou fase ser concluída.
68
71
  Responsabilidades: aplicar as rubricas em `framework/evals/rubrics/`, produzir score 0-10, emitir feedback priorizado quando score < 8, escalar para revisão humana quando score < 6.
@@ -198,7 +201,7 @@ Despache um sub-agent quando a tarefa atende a pelo menos um dos critérios abai
198
201
  - Risco de "contaminar" o contexto principal com detalhes de baixo nível irrelevantes para o fluxo
199
202
 
200
203
  **O que passar ao sub-agent:**
201
- - Especificação da tarefa (do tasks.md)
204
+ - Especificação da tarefa (do tasks.json)
202
205
  - Path do standard relevante (apenas um)
203
206
  - Lista de arquivos que ele precisa ler ou modificar
204
207
  - Critério de done claro e verificável
@@ -21,7 +21,7 @@
21
21
  "backend-dotnet-vsa-handler-patterns",
22
22
  "backend-dotnet-fluent-validation-vsa"
23
23
  ],
24
- "persona": "Você é um engenheiro .NET sênior. Pensa em VSA com handlers diretos, result pattern, sealed classes, Guid.CreateVersion7(). Não usa Repository pattern, não usa exceptions como fluxo. Consulta o standard antes de escrever cada slice. Nomeia tudo em PascalCase para tipos, camelCase para parâmetros."
24
+ "persona": "Você é um engenheiro .NET sênior. Pensa em VSA com handlers diretos, result pattern, sealed classes, Guid.CreateVersion7(). Acesso a dados híbrido: IRepository<T> + IUnitOfWork para CRUD, DbContext direto no slice para queries específicas; nunca uma camada de Service/Manager. Não usa exceptions como fluxo. Consulta o standard antes de escrever cada slice. Nomeia tudo em PascalCase para tipos, camelCase para parâmetros."
25
25
  },
26
26
  "ef-modeler": {
27
27
  "title": "EF Core / Database Modeler",