@polymorphism-tech/morph-spec 4.10.0 → 4.10.1

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.
Files changed (71) hide show
  1. package/README.md +2 -2
  2. package/claude-plugin.json +1 -1
  3. package/docs/CHEATSHEET.md +1 -1
  4. package/docs/QUICKSTART.md +1 -1
  5. package/framework/CLAUDE.md +5 -69
  6. package/framework/agents/backend/api-designer.md +3 -0
  7. package/framework/agents/backend/dotnet-senior.md +3 -0
  8. package/framework/agents/backend/ef-modeler.md +2 -0
  9. package/framework/agents/backend/hangfire-orchestrator.md +2 -0
  10. package/framework/agents/backend/ms-agent-expert.md +2 -0
  11. package/framework/agents/frontend/blazor-builder.md +2 -0
  12. package/framework/agents/frontend/nextjs-expert.md +2 -0
  13. package/framework/agents/infrastructure/azure-architect.md +2 -0
  14. package/framework/agents/infrastructure/azure-deploy-specialist.md +2 -0
  15. package/framework/agents/infrastructure/bicep-architect.md +2 -0
  16. package/framework/agents/infrastructure/container-specialist.md +2 -0
  17. package/framework/agents/infrastructure/devops-engineer.md +3 -0
  18. package/framework/agents/infrastructure/infra-architect.md +3 -0
  19. package/framework/agents/integrations/asaas-financial.md +2 -0
  20. package/framework/agents/integrations/azure-identity.md +2 -0
  21. package/framework/agents/integrations/clerk-auth.md +3 -0
  22. package/framework/agents/integrations/hangfire-integration.md +2 -0
  23. package/framework/agents/integrations/resend-email.md +2 -0
  24. package/framework/commands/morph-apply.md +151 -161
  25. package/framework/commands/morph-archive.md +28 -28
  26. package/framework/commands/morph-infra.md +79 -79
  27. package/framework/commands/morph-preflight.md +92 -56
  28. package/framework/commands/morph-proposal.md +94 -70
  29. package/framework/commands/morph-status.md +31 -31
  30. package/framework/commands/morph-troubleshoot.md +63 -60
  31. package/framework/rules/csharp-standards.md +3 -0
  32. package/framework/rules/frontend-standards.md +2 -0
  33. package/framework/rules/infrastructure-standards.md +3 -0
  34. package/framework/rules/morph-workflow.md +57 -2
  35. package/framework/rules/nextjs-standards.md +2 -0
  36. package/framework/rules/testing-standards.md +3 -0
  37. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +54 -49
  38. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +42 -19
  39. package/framework/skills/level-0-meta/morph-code-review/SKILL.md +8 -5
  40. package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +7 -5
  41. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +139 -136
  42. package/framework/skills/level-0-meta/morph-init/SKILL.md +42 -13
  43. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +130 -130
  44. package/framework/skills/level-0-meta/morph-replicate/SKILL.md +95 -87
  45. package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +24 -0
  46. package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +42 -41
  47. package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +22 -11
  48. package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +123 -114
  49. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +120 -102
  50. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +206 -214
  51. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +38 -0
  52. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +241 -360
  53. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +107 -115
  54. package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +135 -135
  55. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +14 -0
  56. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +143 -139
  57. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +168 -165
  58. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +57 -8
  59. package/package.json +3 -3
  60. package/src/commands/project/doctor.js +7 -2
  61. package/src/commands/project/update.js +4 -4
  62. package/src/lib/stack-filter.js +58 -0
  63. package/src/scripts/setup-infra.js +53 -18
  64. package/src/utils/agents-installer.js +19 -5
  65. package/src/utils/claude-md-injector.js +90 -0
  66. package/src/utils/hooks-installer.js +1 -4
  67. package/src/utils/skills-installer.js +67 -7
  68. package/CLAUDE.md +0 -98
  69. package/framework/memory/patterns-learned.md +0 -766
  70. package/framework/skills/level-0-meta/morph-terminal-title/SKILL.md +0 -61
  71. package/framework/skills/level-0-meta/morph-terminal-title/scripts/set_title.sh +0 -65
@@ -1,200 +1,206 @@
1
1
  ---
2
2
  name: morph:phase-clarify
3
- description: MORPH-SPEC Phase 3 (Clarify). Iterative clarification loop driven by a satisfaction score (0-100). Generates targeted questions per round, always presents "Encerrar Clarify" as exit option, and stops when score 85 or user exits. Use after design approval to eliminate spec ambiguities before task breakdown begins.
3
+ description: MORPH-SPEC Phase 3 (Clarify). Iterative clarification loop driven by a satisfaction score (0-100). Generates targeted questions per round, always presents "End Clarify" as exit option, and stops when score >= 85 or user exits. Use after design approval to eliminate spec ambiguities before task breakdown begins.
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
7
- cliVersion: "4.10.0"
6
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
+ cliVersion: "4.10.1"
8
8
  ---
9
9
 
10
- # MORPH Clarify - FASE 3
10
+ # MORPH Clarify Phase 3
11
11
 
12
12
  > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
13
13
 
14
- Elimine ambiguidades da especificação através de um loop iterativo de perguntas até que o spec tenha qualidade suficiente para gerar tasks.
14
+ Eliminate spec ambiguities through an iterative question loop until the spec has sufficient quality to generate tasks.
15
15
 
16
- ## Pré-requisitos
16
+ ## Prerequisites
17
17
 
18
- - [ ] FASE 2 (Design) concluída
19
- - [ ] `spec.md` aprovado pelo usuário
20
- - [ ] `contracts.cs` definidos
18
+ - [ ] Phase 2 (Design) completed
19
+ - [ ] `spec.md` approved by user
20
+ - [ ] `contracts.cs` (or `contracts.ts`) defined
21
21
 
22
- ## Ferramentas Recomendadas
22
+ ## Recommended Tools
23
23
 
24
- > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` para guia completo.
24
+ > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
25
25
  > **Example:** `references/clarifications-example.md` — filled-in clarifications.md showing expected Q&A format.
26
26
 
27
- | Ação | Ferramenta |
28
- |------|------------|
29
- | Ler spec.md + contracts.cs | **Read** |
30
- | Verificar viabilidade técnica | **Context7 MCP** `query_docs()` |
31
- | Verificar issues/limitações externas | **GitHub MCP** `search_issues()` |
32
- | Atualizar spec com clarificações | **Edit** spec.md |
33
- | Criar clarifications.md | **Write** |
34
- | Atualizar state | **Bash** `npx morph-spec state mark-output $ARGUMENTS clarifications` |
27
+ | Action | Tool | Alternative |
28
+ |--------|------|-------------|
29
+ | Read spec + contracts | **Read** all design outputs | — |
30
+ | Verify technical feasibility | **Context7 MCP** `query_docs()` | **WebSearch** |
31
+ | Check external issues/limitations | **GitHub MCP** `search_issues()` | — |
32
+ | Ask clarifying questions | **AskUserQuestion** (never plain text) | — |
33
+ | Update spec with clarifications | **Edit** spec.md | — |
34
+ | Create clarifications.md | **Write** | |
35
+ | Update state | **Bash** `npx morph-spec state mark-output $ARGUMENTS clarifications` | — |
35
36
 
36
37
  ---
37
38
 
38
- ## Sistema de Pontuação de Satisfação
39
+ ## Satisfaction Scoring System
39
40
 
40
- Antes de cada round, calcule o **Satisfaction Score (0100)** avaliando o spec atual:
41
+ Before each round, calculate the **Satisfaction Score (0-100)** by evaluating the current spec:
41
42
 
42
- | Dimensão | Pts | Critério de máxima pontuação |
43
- |----------|-----|------------------------------|
44
- | **Completude funcional** | 25 | Todos os requisitos têm critérios de aceitação mensuráveis (sem "deve", "pode", "em geral") |
45
- | **Cobertura de falhas** | 20 | Todos os caminhos de erro têm comportamento definido (invalid input, not found, timeout, unauthorized) |
46
- | **Edge cases** | 20 | Limites, estados concorrentes, inputs vazios/extremos documentados |
47
- | **Clareza definitória** | 20 | Nenhum termo crítico sem definição, nenhum "TBD", nenhum "a definir" |
48
- | **Contratos de integração** | 15 | Dependências externas têm formato de payload, erros e retry policy definidos |
43
+ | Dimension | Pts | Maximum Score Criteria |
44
+ |-----------|-----|----------------------|
45
+ | **Functional completeness** | 25 | All requirements have measurable acceptance criteria (no vague "should", "may", "generally") |
46
+ | **Failure coverage** | 20 | All error paths have defined behavior (invalid input, not found, timeout, unauthorized) |
47
+ | **Edge cases** | 20 | Boundaries, concurrent states, empty/extreme inputs documented |
48
+ | **Definitional clarity** | 20 | No critical term undefined, no "TBD", no "to be defined" |
49
+ | **Integration contracts** | 15 | External dependencies have payload format, errors, and retry policy defined |
49
50
 
50
51
  **Thresholds:**
51
52
 
52
- | Score | Ação |
53
- |-------|------|
54
- | 85 | Claude está satisfeito. Apresentar resultado e oferecer "Encerrar" como opção principal |
55
- | 7084 | Continuar. Focar perguntas nas dimensões com menor pontuação |
56
- | < 70 | Continuar. Perguntas amplas cobrindo as maiores lacunas |
53
+ | Score | Action |
54
+ |-------|--------|
55
+ | >= 85 | Satisfied. Present results and offer "End Clarify" as the primary option |
56
+ | 70-84 | Continue. Focus questions on the lowest-scoring dimensions |
57
+ | < 70 | Continue. Broad questions covering the largest gaps |
57
58
 
58
- > O score sobe conforme as respostas são incorporadas. Não número máximo fixo de rounds — o loop para quando o score 85 **ou** quando o usuário escolhe encerrar.
59
+ > The score rises as answers are incorporated. There's no fixed maximum rounds — the loop ends when score >= 85 **or** the user chooses to end.
59
60
 
60
61
  ---
61
62
 
62
63
  ## Workflow
63
64
 
64
- ### Inicialização
65
+ ### Initialization
65
66
 
66
- **PASSO 0 (ANTES de qualquer escrita) — Garantir fase clarify:**
67
+ **Step 0 (BEFORE any writing) — Ensure clarify phase:**
67
68
 
68
69
  ```bash
69
70
  npx morph-spec state get $ARGUMENTS
70
71
  ```
71
72
 
72
- Verifique o campo `"phase"` no output:
73
+ Check the `"phase"` field in the output:
73
74
 
74
- **Se `"phase": "clarify"`** → fase correta, prossiga.
75
+ **If `"phase": "clarify"`** → correct phase, proceed.
75
76
 
76
- **Se `"phase": "design"`** → execute em sequência:
77
+ **If `"phase": "design"`** → run in sequence:
77
78
  1. `npx morph-spec approve $ARGUMENTS design`
78
79
  2. `npx morph-spec phase advance $ARGUMENTS` (→ clarify)
79
80
 
80
- **Qualquer outro valor** → não prossiga estado inconsistente, reporte ao usuário.
81
+ **Any other value** → STOPinconsistent state, report to user.
81
82
 
82
- > **Regra:** Nunca escreva `clarifications.md` ou atualize `spec.md` enquanto a fase não for `clarify`.
83
+ > **Rule:** Never write `clarifications.md` or update `spec.md` until the phase is `clarify`.
83
84
 
84
85
  ---
85
86
 
86
- Leia os arquivos base:
87
- - `.morph/features/$ARGUMENTS/1-design/spec.md`
88
- - `.morph/features/$ARGUMENTS/1-design/contracts.cs`
89
- - `.morph/features/$ARGUMENTS/1-design/schema-analysis.md` (se existir)
87
+ Read the base files in PARALLEL:
90
88
 
91
- Calcule o score inicial. Registre mentalmente as respostas acumuladas de rounds anteriores para não repetir perguntas já respondidas.
89
+ ```
90
+ Read: .morph/features/$ARGUMENTS/1-design/spec.md
91
+ + Read: .morph/features/$ARGUMENTS/1-design/contracts.cs (or contracts.ts for TypeScript)
92
+ + Read: .morph/features/$ARGUMENTS/1-design/schema-analysis.md (if exists)
93
+ ```
94
+
95
+ Calculate the initial score. Track accumulated answers from prior rounds to avoid repeating already-answered questions.
92
96
 
93
97
  ---
94
98
 
95
- ### Loop Principal
99
+ ### Main Loop
100
+
101
+ **Repeat until: score >= 85 OR user chooses to end.**
96
102
 
97
- **Repita até: score 85 OU usuário escolhe encerrar.**
103
+ #### A. Calculate Current Round Score
98
104
 
99
- #### A. Calcular Score do Round Atual
105
+ Score each dimension based on the spec + accumulated answers. Note which dimensions are weakest — they guide this round's questions.
100
106
 
101
- Pontue cada dimensão com base no spec + respostas acumuladas. Anote quais dimensões estão mais fracas — elas guiam as perguntas deste round.
107
+ #### B. Identify New Questions
102
108
 
103
- #### B. Identificar Questões Novas
109
+ Analyze only what **hasn't been answered yet**. Categorize by dimension:
104
110
 
105
- Analise apenas o que **ainda não foi respondido**. Categorize por dimensão:
111
+ | Category | Example Questions |
112
+ |----------|-------------------|
113
+ | **Validation** | Field limits, accepted formats, business rules |
114
+ | **Behavior** | What happens when X fails? Empty state? Loading state? |
115
+ | **Priority** | Must-have vs nice-to-have? MVP vs v2? |
116
+ | **Integration** | Webhook vs polling? Retry policy? Timeout? |
117
+ | **Performance** | Expected volume? Response SLA? |
118
+ | **UX** | Error message shown to user? Visual feedback? |
106
119
 
107
- | Categoria | Exemplos de questões |
108
- |-----------|----------------------|
109
- | **Validação** | Limites de campo, formatos aceitos, regras de negócio |
110
- | **Comportamento** | O que acontece quando X falha? Estado vazio? Loading? |
111
- | **Prioridade** | Must-have vs nice-to-have? MVP vs v2? |
112
- | **Integração** | Webhook vs polling? Retry policy? Timeout? |
113
- | **Performance** | Volume esperado? SLA de resposta? |
114
- | **UX** | Mensagem de erro exibida ao usuário? Feedback visual? |
120
+ #### C. Present Questions via `AskUserQuestion`
115
121
 
116
- #### C. Apresentar Perguntas via `AskUserQuestion`
122
+ **Why this matters:** AskUserQuestion gives structured options the user can click — far better UX than walls of text. It also captures answers programmatically for the clarifications.md output.
117
123
 
118
- **Regras obrigatórias:**
124
+ **Rules:**
119
125
 
120
- 1. Use `AskUserQuestion` — **NUNCA liste perguntas como texto simples**
121
- 2. Máximo **4 perguntas por chamada** (incluindo a opção de encerrar)
122
- 3. Se houver mais de 3 questões novas, faça chamadas sequenciaismas a **opção de encerrar aparece SEMPRE na última chamada de cada round**
123
- 4. **SEMPRE inclua a seguinte pergunta como última do último batch de cada round:**
126
+ 1. Use `AskUserQuestion` — **NEVER list questions as plain text**
127
+ 2. Maximum **4 questions per call** (tool limit)
128
+ 3. If there are more than 3 new questions, make sequential callsthe **exit option always appears in the last call of each round**
129
+ 4. **Always include the following question as the last in the final batch of each round:**
124
130
 
125
131
  ```json
126
132
  {
127
- "header": "Encerrar?",
128
- "question": "Deseja encerrar a fase Clarify agora ou continuar refinando o spec?",
133
+ "header": "End Clarify?",
134
+ "question": "End the Clarify phase now or continue refining the spec?",
129
135
  "multiSelect": false,
130
136
  "options": [
131
137
  {
132
- "label": "Continuar refinando",
133
- "description": "Claude identificou mais questões abertas neste round"
138
+ "label": "Continue refining",
139
+ "description": "There are still open questions identified in this round"
134
140
  },
135
141
  {
136
- "label": "Encerrar Clarify",
137
- "description": "Prosseguir para fase Tasks com o spec no estado atual"
142
+ "label": "End Clarify",
143
+ "description": "Proceed to Plan phase with the spec in its current state"
138
144
  }
139
145
  ]
140
146
  }
141
147
  ```
142
148
 
143
- > Se score 85, ajuste o label da primeira opção para: `"Continuar (opcional)"` com description: `"Score ${score}/100 — spec está satisfatório, mas você pode refinar mais"`
149
+ > If score >= 85, adjust the first option label to: `"Continue (optional)"` with description: `"Score ${score}/100 — spec is satisfactory, but you can refine further"`
144
150
 
145
- #### D. Aguardar e Incorporar Respostas
151
+ #### D. Wait and Incorporate Answers
146
152
 
147
- **Não avance antes de receber todas as respostas.**
153
+ **Do not proceed before receiving all responses.**
148
154
 
149
- Após receber:
150
- 1. Verifique se a resposta é consistente com `contracts.cs` e `schema-analysis.md`
151
- 2. Se alguma resposta for ambígua ou contraditóriapeça esclarecimento antes de atualizar
152
- 3. Atualize `spec.md` com:
153
- - Seção `## Clarifications (FASE 3)` com Q&A estruturado
154
- - Atualização das seções funcionais afetadas
155
- - Novos edge cases em `## Edge Cases`
155
+ After receiving answers:
156
+ 1. Check if the answer is consistent with `contracts.cs` and `schema-analysis.md`
157
+ 2. If any answer is ambiguous or contradictoryask for clarification before updating
158
+ 3. Update `spec.md` with:
159
+ - Section `## Clarifications (Phase 3)` with structured Q&A
160
+ - Updates to affected functional sections
161
+ - New edge cases in `## Edge Cases`
156
162
 
157
- #### E. Verificar Condição de Saída
163
+ #### E. Check Exit Condition
158
164
 
159
- - Usuário escolheu **"Encerrar Clarify"** → sair do loop
160
- - Score 85 E nenhuma questão nova identificadasair do loop
161
- - Caso contrário voltar para A
165
+ - User chose **"End Clarify"** → exit loop
166
+ - Score >= 85 AND no new questions identifiedexit loop
167
+ - Otherwisereturn to A
162
168
 
163
169
  ---
164
170
 
165
- ### Pós-Loop: Gerar Outputs
171
+ ### Post-Loop: Generate Outputs
166
172
 
167
- **Passo 1: Criar `clarifications.md`**
173
+ **Step 1: Create `clarifications.md`**
168
174
 
169
- Escreva em `.morph/features/$ARGUMENTS/1-design/clarifications.md`:
175
+ Write to `.morph/features/$ARGUMENTS/1-design/clarifications.md`:
170
176
 
171
177
  ```markdown
172
178
  # Clarifications — {Feature Name}
173
179
 
174
- **Fase:** CLARIFY (Fase 3)
175
- **Rounds realizados:** {N}
176
- **Score final:** {score}/100
177
- **Status:** Resolvidoincorporado em spec.md
180
+ **Phase:** Clarify (Phase 3)
181
+ **Rounds completed:** {N}
182
+ **Final score:** {score}/100
183
+ **Status:** Resolvedincorporated into spec.md
178
184
 
179
185
  ---
180
186
 
181
187
  ## Questions & Answers
182
188
 
183
- ### Q{N}: {Título}
184
- **Question:** {pergunta}
185
- **Answer:** {resposta do usuário}
186
- **Spec Updates:** {quais seções foram atualizadas}
189
+ ### Q{N}: {Title}
190
+ **Question:** {question}
191
+ **Answer:** {user's answer}
192
+ **Spec Updates:** {which sections were updated}
187
193
  **Priority:** High/Medium/Low
188
- **Resolved:** Yes
194
+ **Resolved:** Yes
189
195
 
190
196
  ---
191
197
 
192
198
  ## Edge Cases
193
199
 
194
- ### EC{N}: {Nome}
195
- **Scenario:** {quando acontece}
196
- **Expected Behavior:** {como o sistema reage}
197
- **Implementation Notes:** {dicas}
200
+ ### EC{N}: {Name}
201
+ **Scenario:** {when it happens}
202
+ **Expected Behavior:** {how the system reacts}
203
+ **Implementation Notes:** {tips}
198
204
 
199
205
  ---
200
206
 
@@ -205,10 +211,10 @@ Escreva em `.morph/features/$ARGUMENTS/1-design/clarifications.md`:
205
211
  | Questions Answered | {N} |
206
212
  | Edge Cases Documented | {N} |
207
213
  | Spec Sections Updated | {N} |
208
- | Score Final | {score}/100 |
214
+ | Final Score | {score}/100 |
209
215
  ```
210
216
 
211
- **Passo 2: Atualizar State**
217
+ **Step 2: Update State**
212
218
 
213
219
  ```bash
214
220
  npx morph-spec state mark-output $ARGUMENTS clarifications
@@ -216,18 +222,21 @@ npx morph-spec state mark-output $ARGUMENTS clarifications
216
222
 
217
223
  ---
218
224
 
219
- ## Outputs Gerados/Atualizados
225
+ ## Phase Outputs
220
226
 
221
- - `.morph/features/$ARGUMENTS/1-design/spec.md` — Seção "Clarifications", edge cases, requisitos refinados
222
- - `.morph/features/$ARGUMENTS/1-design/clarifications.md` Q&A estruturado com score final
227
+ <!-- morph:outputs:clarify -->
228
+ | Output | Path |
229
+ |--------|------|
230
+ | `clarifications` | `.morph/features/{feature}/1-design/clarifications.md` |
231
+ <!-- /morph:outputs -->
223
232
 
224
- ## Critérios de Avanço
233
+ ## Advancement Criteria
225
234
 
226
- - [x] Score de satisfação 85 OU usuário optou por encerrar
227
- - [x] Todas as respostas são consistentes com `contracts.cs`
228
- - [x] `spec.md` atualizado com clarificações e edge cases
229
- - [x] `clarifications.md` criado com Q&A e score final
230
- - [x] State atualizado (`mark-output clarifications`)
235
+ - [x] Satisfaction score >= 85 OR user opted to end
236
+ - [x] All answers are consistent with `contracts.cs`
237
+ - [x] `spec.md` updated with clarifications and edge cases
238
+ - [x] `clarifications.md` created with Q&A and final score
239
+ - [x] State updated (`mark-output clarifications`)
231
240
 
232
241
  ---
233
242
 
@@ -235,4 +244,4 @@ npx morph-spec state mark-output $ARGUMENTS clarifications
235
244
  npx morph-spec phase advance $ARGUMENTS
236
245
  ```
237
246
 
238
- Continuar automaticamente para FASE 4 (Plan) após clarifications.md gerado.
247
+ Continue automatically to Phase 4 (Plan) after clarifications.md is generated.