@polymorphism-tech/morph-spec 4.9.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 (164) hide show
  1. package/README.md +2 -2
  2. package/bin/morph-spec.js +30 -0
  3. package/bin/task-manager.js +34 -22
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/CLAUDE.md +35 -98
  8. package/framework/agents/backend/api-designer.md +3 -0
  9. package/framework/agents/backend/dotnet-senior.md +3 -0
  10. package/framework/agents/backend/ef-modeler.md +2 -0
  11. package/framework/agents/backend/hangfire-orchestrator.md +2 -0
  12. package/framework/agents/backend/ms-agent-expert.md +2 -0
  13. package/framework/agents/frontend/blazor-builder.md +2 -0
  14. package/framework/agents/frontend/nextjs-expert.md +2 -0
  15. package/framework/agents/infrastructure/azure-architect.md +2 -0
  16. package/framework/agents/infrastructure/azure-deploy-specialist.md +2 -0
  17. package/framework/agents/infrastructure/bicep-architect.md +2 -0
  18. package/framework/agents/infrastructure/container-specialist.md +2 -0
  19. package/framework/agents/infrastructure/devops-engineer.md +3 -0
  20. package/framework/agents/infrastructure/infra-architect.md +3 -0
  21. package/framework/agents/integrations/asaas-financial.md +2 -0
  22. package/framework/agents/integrations/azure-identity.md +2 -0
  23. package/framework/agents/integrations/clerk-auth.md +3 -0
  24. package/framework/agents/integrations/hangfire-integration.md +2 -0
  25. package/framework/agents/integrations/resend-email.md +2 -0
  26. package/framework/agents.json +37 -7
  27. package/framework/commands/commit.md +166 -0
  28. package/framework/commands/morph-apply.md +156 -155
  29. package/framework/commands/morph-archive.md +33 -27
  30. package/framework/commands/morph-infra.md +83 -77
  31. package/framework/commands/morph-preflight.md +97 -55
  32. package/framework/commands/morph-proposal.md +131 -58
  33. package/framework/commands/morph-status.md +36 -30
  34. package/framework/commands/morph-troubleshoot.md +68 -59
  35. package/framework/hooks/claude-code/notification/approval-reminder.js +3 -2
  36. package/framework/hooks/claude-code/post-tool-use/dispatch.js +154 -31
  37. package/framework/hooks/claude-code/post-tool-use/skill-reminder.js +7 -84
  38. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +8 -17
  39. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +16 -3
  40. package/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +4 -3
  41. package/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +3 -2
  42. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +60 -0
  43. package/framework/hooks/claude-code/session-start/inject-morph-context.js +55 -2
  44. package/framework/hooks/claude-code/session-start/post-compact-restore.js +41 -0
  45. package/framework/hooks/claude-code/stop/validate-completion.js +2 -15
  46. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +23 -5
  47. package/framework/hooks/shared/compact-restore.js +100 -0
  48. package/framework/hooks/shared/dispatch-helpers.js +116 -0
  49. package/framework/hooks/shared/phase-utils.js +9 -5
  50. package/framework/hooks/shared/state-reader.js +27 -3
  51. package/framework/phases.json +30 -7
  52. package/framework/rules/csharp-standards.md +3 -0
  53. package/framework/rules/frontend-standards.md +2 -0
  54. package/framework/rules/infrastructure-standards.md +3 -0
  55. package/framework/rules/morph-workflow.md +143 -86
  56. package/framework/rules/nextjs-standards.md +2 -0
  57. package/framework/rules/testing-standards.md +3 -0
  58. package/framework/skills/level-0-meta/mcp-registry.json +86 -51
  59. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +139 -0
  60. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +42 -19
  61. package/framework/skills/level-0-meta/{code-review → morph-code-review}/SKILL.md +8 -5
  62. package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/SKILL.md +8 -6
  63. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +362 -0
  64. package/framework/skills/level-0-meta/morph-init/SKILL.md +114 -20
  65. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +362 -0
  66. package/framework/skills/level-0-meta/morph-replicate/SKILL.md +95 -87
  67. package/framework/skills/level-0-meta/{simulation-checklist → morph-simulation-checklist}/SKILL.md +24 -0
  68. package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/SKILL.md +43 -43
  69. package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/references/tools-per-phase.md +1 -2
  70. package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/SKILL.md +23 -12
  71. package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/scripts/check-phase-outputs.mjs +2 -2
  72. package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +247 -0
  73. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +270 -0
  74. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +499 -0
  75. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +38 -0
  76. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +472 -0
  77. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +50 -0
  78. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +45 -0
  79. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +47 -0
  80. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +246 -0
  81. package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +238 -0
  82. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +14 -0
  83. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +312 -0
  84. package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/scripts/validate-tasks.mjs +3 -3
  85. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +324 -0
  86. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +146 -0
  87. package/framework/standards/integration/mcp/mcp-tools.md +25 -7
  88. package/framework/templates/docs/onboarding.md +2 -2
  89. package/package.json +3 -4
  90. package/src/commands/agents/dispatch-agents.js +50 -3
  91. package/src/commands/mcp/mcp-setup.js +39 -2
  92. package/src/commands/phase/phase-reset.js +74 -0
  93. package/src/commands/project/doctor.js +26 -7
  94. package/src/commands/project/update.js +4 -4
  95. package/src/commands/scope/escalate.js +215 -0
  96. package/src/commands/state/advance-phase.js +27 -53
  97. package/src/commands/state/state.js +1 -1
  98. package/src/commands/task/expand.js +100 -0
  99. package/src/core/paths/output-schema.js +4 -3
  100. package/src/core/state/phase-state-machine.js +7 -4
  101. package/src/core/state/state-manager.js +4 -3
  102. package/src/lib/detectors/claude-config-detector.js +93 -347
  103. package/src/lib/detectors/design-system-detector.js +189 -189
  104. package/src/lib/detectors/index.js +155 -57
  105. package/src/lib/generators/context-generator.js +2 -2
  106. package/src/lib/installers/mcp-installer.js +37 -5
  107. package/src/lib/phase-chain/phase-validator.js +22 -16
  108. package/src/lib/scope/impact-analyzer.js +106 -0
  109. package/src/lib/stack-filter.js +58 -0
  110. package/src/lib/tasks/task-parser.js +1 -1
  111. package/src/lib/validators/shared/emit-validator-dispatch.js +64 -0
  112. package/src/scripts/setup-infra.js +68 -18
  113. package/src/utils/agents-installer.js +51 -17
  114. package/src/utils/claude-md-injector.js +90 -0
  115. package/src/utils/file-copier.js +0 -1
  116. package/src/utils/hooks-installer.js +16 -5
  117. package/src/utils/skills-installer.js +67 -7
  118. package/CLAUDE.md +0 -98
  119. package/framework/memory/patterns-learned.md +0 -766
  120. package/framework/skills/level-0-meta/brainstorming/SKILL.md +0 -137
  121. package/framework/skills/level-0-meta/frontend-review/SKILL.md +0 -359
  122. package/framework/skills/level-0-meta/post-implementation/SKILL.md +0 -362
  123. package/framework/skills/level-0-meta/terminal-title/SKILL.md +0 -61
  124. package/framework/skills/level-0-meta/terminal-title/scripts/set_title.sh +0 -65
  125. package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +0 -216
  126. package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +0 -252
  127. package/framework/skills/level-1-workflows/phase-design/SKILL.md +0 -383
  128. package/framework/skills/level-1-workflows/phase-implement/SKILL.md +0 -492
  129. package/framework/skills/level-1-workflows/phase-setup/SKILL.md +0 -195
  130. package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +0 -271
  131. package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +0 -286
  132. package/src/commands/project/index.js +0 -8
  133. package/src/core/index.js +0 -10
  134. package/src/core/state/index.js +0 -8
  135. package/src/core/templates/index.js +0 -9
  136. package/src/core/templates/template-data-sources.js +0 -325
  137. package/src/core/workflows/index.js +0 -7
  138. package/src/lib/detectors/config-detector.js +0 -223
  139. package/src/lib/detectors/standards-generator.js +0 -335
  140. package/src/lib/detectors/structure-detector.js +0 -275
  141. package/src/lib/monitor/agent-resolver.js +0 -144
  142. package/src/lib/monitor/renderer.js +0 -230
  143. package/src/lib/orchestration/index.js +0 -7
  144. package/src/lib/orchestration/team-orchestrator.js +0 -404
  145. package/src/sanitizer/context-sanitizer.js +0 -221
  146. package/src/sanitizer/patterns.js +0 -163
  147. package/src/writer/file-writer.js +0 -86
  148. /package/framework/skills/level-0-meta/{brainstorming → morph-brainstorming}/references/proposal-example.md +0 -0
  149. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-example.md +0 -0
  150. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-guidelines.md +0 -0
  151. /package/framework/skills/level-0-meta/{code-review → morph-code-review}/scripts/scan-csharp.mjs +0 -0
  152. /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/references/review-example-nextjs.md +0 -0
  153. /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/scripts/scan-nextjs.mjs +0 -0
  154. /package/framework/skills/level-0-meta/{frontend-review → morph-frontend-review}/scripts/scan-accessibility.mjs +0 -0
  155. /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-dev-server.mjs +0 -0
  156. /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-stack.mjs +0 -0
  157. /package/framework/skills/level-1-workflows/{phase-clarify → morph-phase-clarify}/references/clarifications-example.md +0 -0
  158. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/architecture-analysis-guide.md +0 -0
  159. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-authoring-guide.md +0 -0
  160. /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-example.md +0 -0
  161. /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/recap-example.md +0 -0
  162. /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/vsa-implementation-guide.md +0 -0
  163. /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/task-planning-patterns.md +0 -0
  164. /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/tasks-example.md +0 -0
@@ -1,362 +0,0 @@
1
- ---
2
- name: morph:post-implementation
3
- description: Orquestra o fluxo completo pós-implementação: detecção de stack,
4
- scans automáticos (C#/Next.js), testes, validate-feature, smoke test via
5
- Playwright (obrigatório se dev server ativo), checklist de code review por
6
- stack, checkpoint e geração de recap. Use após concluir todas as tasks.
7
- argument-hint: "[feature-name]"
8
- user-invocable: true
9
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Task,
10
- mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot,
11
- mcp__playwright__browser_take_screenshot, mcp__playwright__browser_console_messages
12
- ---
13
-
14
- # Post-Implementation Review
15
-
16
- > Orquestrador pós-implementação: executa todos os checks em sequência lógica e bloqueia em caso de falha.
17
- > Use após completar todas as tasks de implementação, antes de criar o PR.
18
-
19
- ---
20
-
21
- ## Pré-requisitos
22
-
23
- - Todas as tasks marcadas como done (`morph-spec task done`)
24
- - Build do projeto compilando sem erros
25
-
26
- ---
27
-
28
- ## Step 1 — Detectar Stack
29
-
30
- ```bash
31
- node .claude/skills/post-implementation/scripts/detect-stack.mjs
32
- ```
33
-
34
- Output JSON: `{ stack: "DOTNET" | "NEXTJS" | "FULLSTACK" | "UNKNOWN", frontendPath, backendPath, startCommand }`
35
-
36
- Ordem de prioridade (mais confiável primeiro):
37
- 1. `.morph/config/config.json` → `config.project.stack` + `frontendPath`/`backendPath`
38
- 2. `.morph/context/README.md` → seção `## Tech Stack`
39
- 3. Fallback: Glob por `*.csproj` e `package.json` com dep `"next"`
40
-
41
- Guarde o resultado — todos os passos seguintes dependem do `stack` detectado.
42
-
43
- ---
44
-
45
- ## Step 2 — Automated Scans
46
-
47
- Execute os scans automáticos conforme o stack detectado.
48
-
49
- ### Se DOTNET ou FULLSTACK:
50
-
51
- ```bash
52
- node .claude/skills/morph:code-review/scripts/scan-csharp.mjs --diff
53
- ```
54
-
55
- ### Se NEXTJS ou FULLSTACK:
56
-
57
- ```bash
58
- node .claude/skills/morph:code-review-nextjs/scripts/scan-nextjs.mjs --diff
59
- ```
60
-
61
- **🚫 BLOCK se qualquer finding CRITICAL encontrado.**
62
-
63
- Corrija todos os CRITICALs antes de continuar. Para revisar a lista completa de checks:
64
- - .NET: `/morph:code-review`
65
- - Next.js: `/morph:code-review-nextjs`
66
-
67
- ---
68
-
69
- ## Step 3 — Test Suite
70
-
71
- Execute os testes conforme o stack.
72
-
73
- ### DOTNET:
74
-
75
- ```bash
76
- dotnet test --verbosity minimal
77
- ```
78
-
79
- ### NEXTJS:
80
-
81
- ```bash
82
- npm test -- --watchAll=false
83
- ```
84
-
85
- ### FULLSTACK:
86
-
87
- Execute ambos em paralelo (use Task tool com dois subagents independentes).
88
-
89
- **🚫 BLOCK se testes falharem.**
90
-
91
- Não prossiga enquanto houver testes falhando. Corrija as falhas e re-execute antes de continuar.
92
-
93
- ---
94
-
95
- ## Step 4 — Framework Validation
96
-
97
- ```bash
98
- npx morph-spec validate-feature $ARGUMENTS --phase implement
99
- ```
100
-
101
- **🚫 BLOCK se falhar.**
102
-
103
- Leia o output de validação, corrija os issues reportados e re-execute até passar.
104
-
105
- ---
106
-
107
- ## Step 5 — Smoke Test (Playwright MCP)
108
-
109
- ### 5a. Detectar Dev Server
110
-
111
- ```bash
112
- node .claude/skills/post-implementation/scripts/detect-dev-server.mjs "<startCommand>"
113
- ```
114
-
115
- Passe o `startCommand` retornado pelo detect-stack no Step 1.
116
-
117
- O script:
118
- 1. Varre portas `[3000, 3001, 4200, 5000, 5001, 7000, 8000, 8080]` com `fetch()` timeout 500ms
119
- 2. Se encontrar um servidor ativo → retorna `{ found: true, url }`
120
- 3. Se não encontrar e `startCommand` fornecido → tenta iniciar automaticamente e aguarda 30s
121
- 4. Retorna exit code 0 (server disponível) ou 1 (não disponível após tentativa)
122
-
123
- ### 5b. Se dev server disponível (exit 0):
124
-
125
- **O smoke test é OBRIGATÓRIO.**
126
-
127
- 1. Leia `spec.md` da feature para identificar os happy paths críticos (máximo 3 flows, seção Functional Requirements)
128
- 2. Execute o smoke test via Playwright MCP:
129
-
130
- ```javascript
131
- // Navegar para a feature
132
- await mcp__playwright__browser_navigate({ url: '<url-detectada>' });
133
-
134
- // Capturar estado da página
135
- await mcp__playwright__browser_snapshot();
136
-
137
- // Verificar erros críticos de console
138
- await mcp__playwright__browser_console_messages({ level: 'error' });
139
-
140
- // Screenshot para documentação
141
- await mcp__playwright__browser_take_screenshot({
142
- type: 'png',
143
- filename: '.morph/features/$ARGUMENTS/4-implement/smoke-screenshots/smoke-<timestamp>.png'
144
- });
145
- ```
146
-
147
- Para cada happy path crítico da spec:
148
- - Navegue até o flow
149
- - Verifique elementos-chave visíveis (`browser_snapshot`)
150
- - Confirme ausência de erros de console críticos
151
- - Capture screenshot do estado final
152
-
153
- **Verificações obrigatórias:**
154
- - [ ] Página carrega sem erro 404/500
155
- - [ ] Elementos principais da feature visíveis (conforme spec)
156
- - [ ] Console sem erros críticos (level: error)
157
- - [ ] Happy path principal funcional
158
-
159
- **🚫 BLOCK se qualquer verificação falhar.** Não crie PR com smoke test falhando.
160
-
161
- ### 5c. Se dev server NÃO disponível (exit 1):
162
-
163
- **⚠️ ATENÇÃO: Dev server não encontrado após tentativa de iniciar.**
164
-
165
- Solicite confirmação explícita ao usuário antes de pular o smoke test:
166
-
167
- ```
168
- Dev server não detectado na porta esperada. O smoke test via Playwright é obrigatório
169
- para garantir que o código funciona no browser antes de criar o PR.
170
-
171
- Opções:
172
- 1. Inicie manualmente o servidor (`npm run dev` / `dotnet run`) e re-execute /post-implementation
173
- 2. Confirme explicitamente que deseja pular o smoke test e por quê
174
-
175
- Não é possível prosseguir para criação de PR sem smoke test ou confirmação explícita.
176
- ```
177
-
178
- **Aguarde resposta antes de continuar.**
179
-
180
- ---
181
-
182
- ## Step 6 — Code Review Checklist (CRITICAL + HIGH)
183
-
184
- > Antes de revisar, leia: `.claude/skills/morph:code-review/references/review-guidelines.md` — aplique confidence ≥ 75, ignore violações pré-existentes, inclua file:line em cada finding.
185
-
186
- Revise os itens mais importantes por stack. Para review completo, use os skills dedicados.
187
-
188
- ### Se FULLSTACK:
189
-
190
- Dispatch dois subagents em paralelo (Task tool):
191
-
192
- **Subagent 1 — Backend Review:**
193
- > Revisor .NET focado. Escopo: APENAS arquivos .cs alterados (git diff main...HEAD).
194
- > Run: `node .claude/skills/morph:code-review/scripts/scan-csharp.mjs --diff`
195
- > Depois revisar manualmente itens CRITICAL+HIGH do checklist .NET.
196
- > Aplicar review-guidelines.md: confidence ≥ 75, skip pré-existentes.
197
- > Output: findings com file:line, ou "✅ Sem CRITICAL/HIGH em backend alterado."
198
-
199
- **Subagent 2 — Frontend Review:**
200
- > Revisor Next.js focado. Escopo: APENAS arquivos .tsx/.ts alterados (git diff main...HEAD).
201
- > Run: `node .claude/skills/morph:code-review-nextjs/scripts/scan-nextjs.mjs --diff`
202
- > Depois revisar manualmente itens CRITICAL+HIGH do checklist Next.js.
203
- > Aplicar review-guidelines.md: confidence ≥ 75, skip pré-existentes.
204
- > Output: findings com file:line, ou "✅ Sem CRITICAL/HIGH em frontend alterado."
205
-
206
- Aguardar ambos. **🚫 BLOCK se algum retornar CRITICAL não resolvido.**
207
-
208
- ### Se DOTNET:
209
-
210
- **Itens CRITICAL e HIGH — .NET:**
211
-
212
- ```
213
- [ ] CancellationToken propagado em toda a chain async
214
- [ ] Sem .Result / .Wait() (deadlock risk)
215
- [ ] Domain tem zero refs para Infrastructure ou Web
216
- [ ] Sem circular dependencies
217
- [ ] Sem empty catch blocks
218
- [ ] Background ops usam IDbContextFactory + await using
219
- [ ] Métodos async têm sufixo Async
220
- [ ] Interfaces prefixadas com I
221
- [ ] Sem classes > 300 linhas
222
- [ ] DTOs com nomes descritivos + tipos corretos
223
- ```
224
-
225
- > Para lista completa: `/morph:code-review`
226
-
227
- ### Se NEXTJS:
228
-
229
- **Itens CRITICAL e HIGH — Next.js:**
230
-
231
- ```
232
- [ ] node .claude/skills/morph:code-review-nextjs/scripts/scan-nextjs.mjs --diff → 0 CRITICAL
233
- [ ] File names em kebab-case (user-card.tsx, não UserCard.tsx)
234
- [ ] 'use client' apenas em componentes com hooks/event handlers
235
- [ ] Sem useEffect para data fetching → Server Component ou useQuery
236
- [ ] Zod schema definido primeiro, type derivado com z.infer<>
237
- [ ] zodResolver conectado ao useForm, useMutation para submit
238
- [ ] Query key factory usado (userKeys.lists(), não ['users'])
239
- [ ] Feature public API via features/{name}/index.ts
240
- [ ] components/ui/ intocados (shadcn CLI only)
241
- [ ] Sem any type annotation
242
- ```
243
-
244
- > Para lista completa: `/morph:code-review-nextjs`
245
-
246
- **🚫 BLOCK se qualquer item CRITICAL não estiver resolvido.**
247
-
248
- ---
249
-
250
- ## Step 7 — Checkpoint + Recap
251
-
252
- ```bash
253
- # Salvar checkpoint pós-review
254
- npx morph-spec checkpoint-save $ARGUMENTS --note "post-implementation review"
255
-
256
- # Gerar recap final
257
- npx morph-spec generate recap $ARGUMENTS
258
- ```
259
-
260
- ---
261
-
262
- ## Step 8 — Finish Worktree
263
-
264
- Implementation is complete. If the feature was developed in a morph worktree, finalize it now.
265
-
266
- **Check if a worktree exists:**
267
- ```bash
268
- git worktree list | grep morph/
269
- ```
270
-
271
- **If a `morph/{feature}` worktree exists:**
272
-
273
- Invoke the finishing-a-development-branch skill:
274
- ```
275
- Skill(superpowers:finishing-a-development-branch)
276
- ```
277
-
278
- This skill will:
279
- 1. Verify tests pass
280
- 2. Present 4 options:
281
- - **Merge locally** → merge into base branch + delete worktree
282
- - **Push and create PR** → push branch + create GitHub PR (keeps worktree)
283
- - **Keep as-is** → no action (worktree preserved for later)
284
- - **Discard** → delete branch + worktree (requires typed confirmation)
285
- 3. Clean up worktree for options 1 and 4
286
-
287
- **If NOT in a worktree** (legacy mode): skip this step and proceed to Step 9.
288
-
289
- > **Note:** If the `superpowers` plugin is not installed, create the PR manually:
290
- > `gh pr create --title "feat({feature}): <description>" --body "..."`
291
-
292
- ---
293
-
294
- ## Step 9 — Pre-PR Compliance Checklist
295
-
296
- Antes de criar o PR, invoque o checklist de compliance:
297
-
298
- ```
299
- Skill(morph:checklist)
300
- ```
301
-
302
- Este skill verifica: segurança, SEO, performance, acessibilidade e conformidade LGPD.
303
- **🚫 BLOCK se qualquer item CRITICAL não estiver resolvido.**
304
-
305
- ---
306
-
307
- ## Step 10 — PR Suggestion
308
-
309
- Quando todos os steps passarem, sugira o PR:
310
-
311
- ```bash
312
- gh pr create \
313
- --title "feat($ARGUMENTS): <descrição concisa da feature>" \
314
- --body "$(cat <<'EOF'
315
- ## Summary
316
-
317
- - <principais mudanças implementadas>
318
- - <tasks concluídas>
319
-
320
- ## Test Results
321
-
322
- - Build: ✅ passou
323
- - Tests: ✅ X testes passando
324
- - Smoke Test: ✅ happy path verificado via Playwright
325
-
326
- ## Screenshots
327
-
328
- <!-- Cole os paths dos screenshots salvos em smoke-screenshots/ -->
329
-
330
- ## Checklist
331
-
332
- - [ ] Automated scans: 0 CRITICAL findings
333
- - [ ] All tests passing
334
- - [ ] Smoke test via Playwright: ✅
335
- - [ ] Code review checklist: CRITICAL + HIGH itens verificados
336
- - [ ] validate-feature: ✅ passou
337
- - [ ] Checkpoint salvo
338
- - [ ] recap.md gerado
339
- EOF
340
- )"
341
- ```
342
-
343
- ---
344
-
345
- ## Resumo dos BLOCKs
346
-
347
- | Step | Condição de BLOCK |
348
- |------|-------------------|
349
- | Step 2 | Qualquer finding CRITICAL nos scans automáticos |
350
- | Step 3 | Qualquer teste falhando |
351
- | Step 4 | `validate-feature` falhando |
352
- | Step 5 | Dev server ativo + smoke test com falha |
353
- | Step 5 | Dev server não detectado sem confirmação explícita do usuário |
354
- | Step 6 | Qualquer item CRITICAL não resolvido no checklist manual |
355
- | Step 8 | Tests failing in worktree before merge/PR |
356
- | Step 9 | Item CRITICAL no `morph:checklist` não resolvido |
357
-
358
- **Todos os BLOCKs devem ser resolvidos antes de criar o PR.**
359
-
360
- ---
361
-
362
- *MORPH-SPEC by Polymorphism Tech*
@@ -1,61 +0,0 @@
1
- ---
2
- name: morph:terminal-title
3
- description: Manually set the terminal window title for the current task. Use when you need to override the automatic title set by the hook, or to set a specific descriptive title for the current work context.
4
- argument-hint: "[title]"
5
- user-invocable: true
6
- allowed-tools: Bash
7
- ---
8
-
9
- # Terminal Title
10
-
11
- ## Overview
12
-
13
- Manually sets the terminal window title. The hook `set-terminal-title.js` sets titles automatically on every prompt — use this skill only for manual overrides.
14
-
15
- ## When to Use
16
-
17
- - Override the automatic title with something more descriptive
18
- - Set a custom title at the start of a focused work session
19
- - Invoke explicitly: `/terminal-title`
20
-
21
- ## Title Format
22
-
23
- ```
24
- [Action]: [Specific Focus]
25
- ```
26
-
27
- **Good titles (max 40 chars):**
28
- - `Fix: Auth Login Bug`
29
- - `Build: Dashboard UI`
30
- - `Refactor: Payment Module`
31
- - `DB Migration: Users Table`
32
- - `Test: Checkout Flow`
33
-
34
- The script (`set_title.sh`) prepends the current directory name automatically:
35
- ```
36
- morph-spec-framework | Fix: Auth Login Bug
37
- ```
38
-
39
- The hook (`set-terminal-title.js`) sets the task title directly, without a directory prefix:
40
- ```
41
- Fix: Auth Login Bug
42
- ```
43
-
44
- ## Implementation
45
-
46
- Run the title script with the desired title:
47
-
48
- ```bash
49
- bash .claude/skills/terminal-title/scripts/set_title.sh "Fix: Auth Login Bug"
50
- ```
51
-
52
- No confirmation needed — executes silently in the background.
53
-
54
- ## Optional Custom Prefix
55
-
56
- Set `CLAUDE_TITLE_PREFIX` in your environment to add a custom prefix:
57
-
58
- ```bash
59
- export CLAUDE_TITLE_PREFIX="🤖"
60
- # Results in: 🤖 morph-spec-framework | Fix: Auth Login Bug
61
- ```
@@ -1,65 +0,0 @@
1
- #!/bin/bash
2
- # Set terminal window title
3
- # Usage: ./set_title.sh "Your Title Here"
4
- #
5
- # The script automatically prefixes the title with the current directory name
6
- # (usually the repo/project name) for easy identification across multiple terminals.
7
- #
8
- # Optional: Set CLAUDE_TITLE_PREFIX environment variable for additional custom prefix
9
- # Example: export CLAUDE_TITLE_PREFIX="🤖"
10
- # Results in: "🤖 my-project | Your Title"
11
-
12
- # Exit silently if no title provided (fail-safe behavior)
13
- if [ -z "$1" ]; then
14
- exit 0
15
- fi
16
-
17
- # Validate and sanitize input
18
- # Remove control characters (0x00-0x1F) and limit length to 80 characters
19
- TITLE=$(echo "$1" | tr -d '\000-\037' | head -c 80)
20
-
21
- # Ensure title is not empty after sanitization
22
- if [ -z "$TITLE" ]; then
23
- exit 0
24
- fi
25
-
26
- # Get the current directory name (usually the repo/project name)
27
- DIR_NAME=$(basename "$PWD")
28
-
29
- # Build the final title with directory prefix and optional custom prefix
30
- if [ -n "$CLAUDE_TITLE_PREFIX" ]; then
31
- # Sanitize prefix as well
32
- PREFIX=$(echo "$CLAUDE_TITLE_PREFIX" | tr -d '\000-\037' | head -c 20)
33
- if [ -n "$PREFIX" ]; then
34
- FINAL_TITLE="${PREFIX} ${DIR_NAME} | ${TITLE}"
35
- else
36
- FINAL_TITLE="${DIR_NAME} | ${TITLE}"
37
- fi
38
- else
39
- FINAL_TITLE="${DIR_NAME} | ${TITLE}"
40
- fi
41
-
42
- # Store the title in a file that shell hooks can read
43
- # This allows precmd hooks (like update_terminal_cwd) to preserve the title
44
- # Use atomic write to prevent race conditions
45
- TITLE_FILE="${HOME}/.claude/terminal_title"
46
- mkdir -p "${HOME}/.claude"
47
-
48
- # Atomic write using temp file + rename
49
- TEMP_FILE="${TITLE_FILE}.tmp.$$"
50
- echo "$FINAL_TITLE" > "$TEMP_FILE"
51
- mv "$TEMP_FILE" "$TITLE_FILE" 2>/dev/null || rm -f "$TEMP_FILE"
52
-
53
- # Set the terminal title using ANSI escape sequences
54
- # Detect terminal type and set title accordingly
55
- case "$TERM" in
56
- xterm*|rxvt*|screen*|tmux*)
57
- # Standard xterm-compatible terminals
58
- printf '\033]0;%s\007' "$FINAL_TITLE"
59
- ;;
60
- *)
61
- # Fallback: try anyway, suppress errors
62
- # This works for iTerm2, Alacritty, and most modern terminals
63
- printf '\033]0;%s\007' "$FINAL_TITLE" 2>/dev/null
64
- ;;
65
- esac
@@ -1,216 +0,0 @@
1
- ---
2
- name: morph:phase-clarify
3
- description: MORPH-SPEC Phase 3 (Clarify). Reviews spec.md for ambiguities, generates 3-7 targeted clarification questions, waits for user answers, then updates spec with edge cases and clarification sections. Use after design approval to eliminate spec ambiguities before task breakdown begins.
4
- argument-hint: "[feature-name]"
5
- user-invocable: false
6
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
7
- cliVersion: "4.9.0"
8
- ---
9
-
10
- # MORPH Clarify - FASE 3
11
-
12
- > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
13
-
14
- Identifique ambiguidades na especificação e faça perguntas de clarificação para garantir que todos os edge cases estão cobertos.
15
-
16
- ## Pré-requisitos
17
-
18
- - [ ] FASE 2 (Design) concluída
19
- - [ ] `spec.md` aprovado pelo usuário
20
- - [ ] `contracts.cs` definidos
21
-
22
- ## Ferramentas Recomendadas
23
-
24
- > **Ref:** `framework/skills/level-0-meta/tool-usage-guide/SKILL.md` para guia completo.
25
- > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` para referência MCP.
26
- > **Example:** `references/clarifications-example.md` — filled-in clarifications.md showing expected Q&A format.
27
-
28
- | Ação | Ferramenta | Alternativa |
29
- |------|------------|-------------|
30
- | Ler spec.md completo | **Read** spec.md | — |
31
- | Ler contracts.cs | **Read** contracts.cs | — |
32
- | Ler schema-analysis.md | **Read** schema-analysis.md | — |
33
- | Verificar viabilidade de requisito | **Context7 MCP** `query_docs()` | **WebSearch** + **WebFetch** |
34
- | Verificar issues/limitações conhecidas | **GitHub MCP** `search_issues()` | **Bash** `gh issue list --search "..."` |
35
- | Pesquisar edge cases externos | **WebSearch** | — |
36
- | Verificar comportamento UI existente | **Playwright MCP** `browser_navigate()` + `browser_snapshot()` | **WebFetch** URL |
37
- | Atualizar spec com clarificações | **Edit** spec.md | — |
38
- | Criar clarifications.md | **Bash** `npx morph-spec template render docs/clarifications .morph/features/$ARGUMENTS/2-clarify/clarifications.md` | — |
39
- | Atualizar state | **Bash** `npx morph-spec state mark-output $ARGUMENTS clarifications` | — |
40
-
41
- **MCPs desta fase:** Context7 (validar viabilidade), GitHub (issues conhecidas), Playwright (verificar UI existente).
42
-
43
- **Anti-padrões:**
44
- - ❌ Task agent para ler spec (use Read direto)
45
- - ❌ Reescrever spec do zero (use Edit para atualizar seções)
46
- - ❌ Pular cross-reference com schema-analysis.md (crítico para precisão)
47
-
48
- ---
49
-
50
- ## Workflow
51
-
52
- ### Passo 1: Analisar Spec
53
-
54
- Leia `.morph/features/$ARGUMENTS/1-design/spec.md` em detalhes e identifique:
55
-
56
- #### 1.1. Ambiguidades
57
- - Requisitos vagos ou genéricos
58
- - Termos sem definição clara
59
- - Comportamentos não especificados
60
-
61
- #### 1.2. Edge Cases Não Documentados
62
- - O que acontece se...?
63
- - Como lidar com entradas inválidas?
64
- - Comportamento em caso de erro?
65
- - Estados intermediários (loading, empty)
66
-
67
- #### 1.3. Requisitos Conflitantes
68
- - Duas funcionalidades que parecem incompatíveis
69
- - Prioridades não claras (o que vem primeiro?)
70
-
71
- #### 1.4. Dados Faltantes
72
- - Validações de negócio não especificadas
73
- - Limites e constraints (tamanhos, quantidades)
74
- - Formatos de dados (datas, moedas, etc.)
75
-
76
- ### Passo 2: Gerar Perguntas de Clarificação
77
-
78
- Com base na análise, gere **3-7 perguntas** focadas e específicas:
79
-
80
- **Formato de pergunta:**
81
- ```markdown
82
- ### Q{N}: {Categoria} - {Título}
83
-
84
- **Context:** {Por que esta pergunta é importante}
85
-
86
- **Question:** {Pergunta clara e objetiva}
87
-
88
- **Options (if applicable):**
89
- - A) {Opção 1}
90
- - B) {Opção 2}
91
- - C) {Deixar em aberto/usuário decidir}
92
-
93
- **Impact:** {Como a resposta afeta a implementação}
94
- ```
95
-
96
- ### Passo 3: Categorizar Perguntas
97
-
98
- Organize perguntas por categoria:
99
-
100
- | Categoria | Descrição | Exemplos |
101
- |-----------|-----------|----------|
102
- | **Validação** | Regras de negócio, constraints | Limites de tamanho, formatos aceitos |
103
- | **Comportamento** | O que acontece quando... | Error handling, estados vazios |
104
- | **Prioridade** | O que é must-have vs nice-to-have | MVP vs futuras iterações |
105
- | **Integração** | Como interage com sistemas externos | APIs, webhooks, formato de dados |
106
- | **Performance** | Requisitos de velocidade/volume | Quantos registros? Tempo de resposta? |
107
- | **UX** | Experiência do usuário | Feedback visual, mensagens de erro |
108
-
109
- ### Passo 4: Apresentar Perguntas ao Usuário via AskUserQuestion
110
-
111
- Use o tool `AskUserQuestion` para coletar as respostas — **NUNCA liste perguntas como texto simples**.
112
-
113
- **Regras:**
114
- - `AskUserQuestion` aceita **1-4 perguntas por chamada**
115
- - Se houver 5-7 perguntas, faça **2 chamadas sequenciais** (ex: Q1-Q4 → Q5-Q7)
116
- - Cada pergunta deve ter `header` (≤12 chars), `question` clara e 2-4 `options`
117
- - Se a pergunta for aberta sem opções fixas, defina 2-3 opções representativas (o usuário pode usar "Other" para resposta livre)
118
- - Use `multiSelect: true` quando múltiplas respostas forem igualmente válidas
119
- - Aguarde o retorno do tool antes de prosseguir para qualquer próximo passo
120
-
121
- **Exemplo de estrutura:**
122
- ```json
123
- {
124
- "questions": [
125
- {
126
- "header": "Validação",
127
- "question": "Qual o limite de tamanho para o campo Nome?",
128
- "multiSelect": false,
129
- "options": [
130
- { "label": "100 chars", "description": "Padrão comum para nomes curtos" },
131
- { "label": "255 chars", "description": "Máximo típico de banco de dados" },
132
- { "label": "Sem limite fixo", "description": "Apenas validação no frontend" }
133
- ]
134
- }
135
- ]
136
- }
137
- ```
138
-
139
- **IMPORTANTE:** Não prossiga para o Passo 5 até receber respostas de TODAS as perguntas!
140
-
141
- ### Passo 5: Atualizar `spec.md` com Respostas
142
-
143
- Após receber respostas do usuário, atualize o spec com:
144
-
145
- 1. **Seção de Clarificações** no início do spec:
146
- ```markdown
147
- ## Clarifications (FASE 3)
148
-
149
- ### Q1: {Título}
150
- **Answer:** {Resposta do usuário}
151
- **Date:** {YYYY-MM-DD}
152
- ```
153
-
154
- 2. **Atualizar seções relevantes** com detalhes adicionados
155
-
156
- ### CHECKPOINT: Validar Respostas Completas
157
-
158
- **⏸️ PAUSE - Antes de atualizar spec:**
159
-
160
- - [ ] Todas as perguntas foram respondidas pelo usuário?
161
- - [ ] Nenhuma resposta é ambígua ou contraditória?
162
- - [ ] Respostas são consistentes com `contracts.cs` existente?
163
- - [ ] Respostas são consistentes com `schema-analysis.md`?
164
-
165
- **❌ Se alguma checkbox NÃO estiver marcada:**
166
- → Voltar e pedir esclarecimento adicional ao usuário
167
-
168
- **✅ Se TODAS as checkboxes estiverem marcadas:**
169
- → Prosseguir para atualizar spec.md
170
-
171
- ### Passo 6: Validar Edge Cases
172
-
173
- Documente no spec como lidar com cada edge case identificado:
174
-
175
- ```markdown
176
- ## Edge Cases
177
-
178
- ### EC001: {Nome do Edge Case}
179
- **Scenario:** {Quando acontece}
180
- **Expected Behavior:** {Como o sistema deve reagir}
181
- **Implementation Notes:** {Dicas para implementação}
182
- ```
183
-
184
- ### Passo 7: Atualizar State
185
-
186
- ## Outputs Gerados/Atualizados
187
-
188
- - `.morph/features/$ARGUMENTS/1-design/spec.md` - Atualizado com:
189
- - Seção "Clarifications" com perguntas e respostas
190
- - Edge cases documentados
191
- - Requisitos mais específicos
192
- - `.morph/features/$ARGUMENTS/2-clarify/clarifications.md` - Novo arquivo com Q&A estruturado
193
-
194
- ## Critérios de Avanço
195
-
196
- - [x] Perguntas de clarificação identificadas (3-7)
197
- - [x] Perguntas apresentadas ao usuário
198
- - [x] Respostas do usuário recebidas
199
- - [x] `spec.md` atualizado com clarificações
200
- - [x] Edge cases documentados
201
- - [x] State atualizado
202
- - [x] Nenhuma ambiguidade crítica remanescente
203
-
204
- ---
205
-
206
- ## Integração com Superpowers
207
-
208
- > Disponível quando o plugin `superpowers` está instalado.
209
-
210
- | Skill | Quando Usar | Invocação |
211
- |-------|-------------|-----------|
212
- | `systematic-debugging` | Para investigar ambiguidades técnicas complexas | `Skill(superpowers:systematic-debugging)` |
213
-
214
- ---
215
-
216
- Continuar automaticamente para FASE 4 (Tasks) após clarificações resolvidas.