@polymorphism-tech/morph-spec 4.8.19 → 4.10.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.
- package/CLAUDE.md +21 -0
- package/README.md +2 -2
- package/bin/morph-spec.js +44 -55
- package/bin/task-manager.js +133 -20
- package/bin/validate.js +67 -33
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +201 -203
- package/docs/QUICKSTART.md +2 -2
- package/framework/CLAUDE.md +99 -77
- package/framework/agents.json +734 -182
- package/framework/commands/commit.md +166 -0
- package/framework/commands/morph-apply.md +13 -2
- package/framework/commands/morph-archive.md +8 -2
- package/framework/commands/morph-infra.md +6 -0
- package/framework/commands/morph-preflight.md +6 -0
- package/framework/commands/morph-proposal.md +56 -7
- package/framework/commands/morph-status.md +6 -0
- package/framework/commands/morph-troubleshoot.md +6 -0
- package/framework/hooks/claude-code/notification/approval-reminder.js +3 -2
- package/framework/hooks/claude-code/post-tool-use/context-refresh.js +1 -1
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +155 -32
- package/framework/hooks/claude-code/post-tool-use/skill-reminder.js +78 -0
- package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +8 -17
- package/framework/hooks/claude-code/pre-compact/save-morph-context.js +16 -3
- package/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +4 -3
- package/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +4 -3
- package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +60 -0
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +124 -2
- package/framework/hooks/claude-code/session-start/post-compact-restore.js +41 -0
- package/framework/hooks/claude-code/statusline.py +76 -30
- package/framework/hooks/claude-code/stop/validate-completion.js +2 -15
- package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +23 -5
- package/framework/hooks/claude-code/user-prompt/set-terminal-title.js +14 -6
- package/framework/hooks/shared/activity-logger.js +0 -24
- package/framework/hooks/shared/compact-restore.js +100 -0
- package/framework/hooks/shared/dispatch-helpers.js +116 -0
- package/framework/hooks/shared/phase-utils.js +12 -5
- package/framework/hooks/shared/skill-reminder-helpers.js +79 -0
- package/framework/hooks/shared/stale-task-reset.js +57 -0
- package/framework/hooks/shared/state-reader.js +29 -5
- package/framework/hooks/shared/worktree-helpers.js +53 -0
- package/framework/phases.json +69 -14
- package/framework/rules/morph-workflow.md +88 -86
- package/framework/skills/level-0-meta/mcp-registry.json +86 -51
- package/framework/skills/level-0-meta/{brainstorming → morph-brainstorming}/SKILL.md +14 -17
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +2 -2
- package/framework/skills/level-0-meta/{code-review → morph-code-review}/SKILL.md +2 -2
- package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/SKILL.md +163 -163
- package/framework/skills/level-0-meta/{frontend-review → morph-frontend-review}/SKILL.md +9 -9
- package/framework/skills/level-0-meta/morph-init/SKILL.md +77 -12
- package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/SKILL.md +62 -15
- package/framework/skills/level-0-meta/morph-replicate/SKILL.md +5 -5
- package/framework/skills/level-0-meta/morph-replicate/references/blazor-html-mapping.md +1 -1
- package/framework/skills/level-0-meta/{simulation-checklist → morph-simulation-checklist}/SKILL.md +1 -1
- package/framework/skills/level-0-meta/{terminal-title → morph-terminal-title}/SKILL.md +2 -2
- package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/SKILL.md +3 -4
- package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/references/tools-per-phase.md +7 -7
- package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/SKILL.md +2 -2
- package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/scripts/check-phase-outputs.mjs +2 -2
- package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +238 -0
- package/framework/skills/level-1-workflows/{phase-codebase-analysis → morph-phase-codebase-analysis}/SKILL.md +3 -3
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +507 -0
- package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/SKILL.md +168 -27
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +50 -0
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +45 -0
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +47 -0
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +254 -0
- package/framework/skills/level-1-workflows/{phase-setup → morph-phase-setup}/SKILL.md +50 -3
- package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/SKILL.md +48 -11
- package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/scripts/validate-tasks.mjs +3 -3
- package/framework/skills/level-1-workflows/{phase-uiux → morph-phase-uiux}/SKILL.md +46 -11
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +97 -0
- package/framework/standards/STANDARDS.json +640 -88
- package/framework/standards/infrastructure/vercel/vercel-database.md +106 -0
- package/framework/standards/integration/mcp/mcp-tools.md +25 -7
- package/framework/templates/REGISTRY.json +1825 -1909
- package/framework/templates/context/CONTEXT-FEATURE.md +276 -276
- package/framework/templates/docs/onboarding.md +3 -7
- package/package.json +2 -7
- package/src/commands/agents/dispatch-agents.js +104 -6
- package/src/commands/mcp/mcp-setup.js +39 -2
- package/src/commands/phase/phase-reset.js +74 -0
- package/src/commands/project/doctor.js +34 -51
- package/src/commands/project/init.js +1 -1
- package/src/commands/project/status.js +2 -2
- package/src/commands/project/update.js +381 -365
- package/src/commands/project/worktree.js +154 -0
- package/src/commands/scope/escalate.js +215 -0
- package/src/commands/state/advance-phase.js +132 -68
- package/src/commands/state/approve.js +2 -2
- package/src/commands/state/index.js +7 -8
- package/src/commands/state/phase-runner.js +1 -1
- package/src/commands/state/state.js +61 -6
- package/src/commands/task/expand.js +100 -0
- package/src/commands/tasks/task.js +78 -99
- package/src/commands/templates/template-render.js +93 -173
- package/src/commands/trust/trust.js +26 -21
- package/src/core/paths/output-schema.js +19 -3
- package/src/core/state/phase-state-machine.js +7 -4
- package/src/core/state/state-manager.js +32 -57
- package/src/core/workflows/workflow-detector.js +9 -87
- package/src/lib/detectors/claude-config-detector.js +93 -347
- package/src/lib/detectors/design-system-detector.js +189 -189
- package/src/lib/detectors/index.js +155 -57
- package/src/lib/generators/context-generator.js +2 -2
- package/src/lib/installers/mcp-installer.js +37 -5
- package/src/lib/phase-chain/phase-validator.js +336 -0
- package/src/lib/scope/impact-analyzer.js +106 -0
- package/src/lib/stack/stack-profile.js +88 -0
- package/src/lib/tasks/task-classifier.js +16 -0
- package/src/lib/tasks/task-parser.js +1 -1
- package/src/lib/tasks/test-runner.js +77 -0
- package/src/lib/trust/trust-manager.js +32 -144
- package/src/lib/validators/shared/emit-validator-dispatch.js +64 -0
- package/src/lib/validators/spec-validator.js +58 -4
- package/src/lib/validators/validation-runner.js +23 -11
- package/src/scripts/setup-infra.js +255 -224
- package/src/utils/agents-installer.js +34 -14
- package/src/utils/banner.js +1 -1
- package/src/utils/claude-settings-manager.js +1 -1
- package/src/utils/file-copier.js +1 -1
- package/src/utils/hooks-installer.js +272 -8
- package/framework/hooks/dev/check-sync-health.js +0 -117
- package/framework/hooks/dev/guard-version-numbers.js +0 -57
- package/framework/hooks/dev/sync-standards-registry.js +0 -60
- package/framework/hooks/dev/sync-template-registry.js +0 -60
- package/framework/hooks/dev/validate-skill-format.js +0 -70
- package/framework/hooks/dev/validate-standard-format.js +0 -73
- package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +0 -190
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +0 -366
- package/framework/templates/meta-prompts/hops/hop-retry.md +0 -78
- package/framework/templates/meta-prompts/hops/hop-validation.md +0 -97
- package/framework/templates/meta-prompts/hops/hop-wrapper.md +0 -36
- package/framework/workflows/configs/design-impl.json +0 -49
- package/framework/workflows/configs/express.json +0 -45
- package/framework/workflows/configs/fast-track.json +0 -42
- package/framework/workflows/configs/full-morph.json +0 -79
- package/framework/workflows/configs/fusion.json +0 -39
- package/framework/workflows/configs/long-running.json +0 -33
- package/framework/workflows/configs/spec-only.json +0 -43
- package/framework/workflows/configs/ui-refresh.json +0 -49
- package/framework/workflows/configs/zero-touch.json +0 -82
- package/src/commands/project/index.js +0 -8
- package/src/commands/project/monitor.js +0 -295
- package/src/commands/project/tutorial.js +0 -115
- package/src/commands/state/validate-phase.js +0 -238
- package/src/commands/templates/generate-contracts.js +0 -445
- package/src/core/index.js +0 -10
- package/src/core/orchestrator.js +0 -171
- package/src/core/registry/command-registry.js +0 -28
- package/src/core/registry/index.js +0 -8
- package/src/core/registry/validator-registry.js +0 -204
- package/src/core/state/index.js +0 -8
- package/src/core/templates/index.js +0 -9
- package/src/core/templates/template-data-sources.js +0 -325
- package/src/core/templates/template-validator.js +0 -296
- package/src/core/workflows/index.js +0 -7
- package/src/generator/config-generator.js +0 -206
- package/src/generator/templates/config.json.template +0 -40
- package/src/generator/templates/project.md.template +0 -67
- package/src/lib/agents/micro-agent-factory.js +0 -161
- package/src/lib/analysis/complexity-analyzer.js +0 -441
- package/src/lib/analysis/index.js +0 -7
- package/src/lib/analytics/analytics-engine.js +0 -345
- package/src/lib/checkpoints/checkpoint-hooks.js +0 -298
- package/src/lib/checkpoints/index.js +0 -7
- package/src/lib/context/context-bundler.js +0 -241
- package/src/lib/context/context-optimizer.js +0 -212
- package/src/lib/context/context-tracker.js +0 -273
- package/src/lib/context/core-four-tracker.js +0 -201
- package/src/lib/context/mcp-optimizer.js +0 -200
- package/src/lib/detectors/config-detector.js +0 -223
- package/src/lib/detectors/standards-generator.js +0 -335
- package/src/lib/detectors/structure-detector.js +0 -275
- package/src/lib/execution/fusion-executor.js +0 -304
- package/src/lib/execution/parallel-executor.js +0 -270
- package/src/lib/hooks/stop-hook-executor.js +0 -286
- package/src/lib/hops/hop-composer.js +0 -221
- package/src/lib/monitor/agent-resolver.js +0 -144
- package/src/lib/monitor/renderer.js +0 -230
- package/src/lib/orchestration/index.js +0 -7
- package/src/lib/orchestration/team-orchestrator.js +0 -404
- package/src/lib/phase-chain/eligibility-checker.js +0 -243
- package/src/lib/threads/thread-coordinator.js +0 -238
- package/src/lib/threads/thread-manager.js +0 -317
- package/src/lib/tracking/artifact-trail.js +0 -202
- package/src/sanitizer/context-sanitizer.js +0 -221
- package/src/sanitizer/patterns.js +0 -163
- package/src/scanner/project-scanner.js +0 -242
- package/src/ui/diff-display.js +0 -91
- package/src/ui/interactive-wizard.js +0 -96
- package/src/ui/user-review.js +0 -211
- package/src/ui/wizard-questions.js +0 -188
- package/src/utils/color-utils.js +0 -70
- package/src/utils/process-handler.js +0 -97
- package/src/writer/file-writer.js +0 -86
- /package/framework/skills/level-0-meta/{brainstorming → morph-brainstorming}/references/proposal-example.md +0 -0
- /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-example.md +0 -0
- /package/framework/skills/level-0-meta/{code-review → morph-code-review}/references/review-guidelines.md +0 -0
- /package/framework/skills/level-0-meta/{code-review → morph-code-review}/scripts/scan-csharp.mjs +0 -0
- /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/references/review-example-nextjs.md +0 -0
- /package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/scripts/scan-nextjs.mjs +0 -0
- /package/framework/skills/level-0-meta/{frontend-review → morph-frontend-review}/scripts/scan-accessibility.mjs +0 -0
- /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-dev-server.mjs +0 -0
- /package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/scripts/detect-stack.mjs +0 -0
- /package/framework/skills/level-0-meta/{terminal-title → morph-terminal-title}/scripts/set_title.sh +0 -0
- /package/framework/skills/level-1-workflows/{phase-clarify → morph-phase-clarify}/references/clarifications-example.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/architecture-analysis-guide.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-authoring-guide.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-design → morph-phase-design}/references/spec-example.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/recap-example.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/references/vsa-implementation-guide.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/task-planning-patterns.md +0 -0
- /package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/references/tasks-example.md +0 -0
package/framework/skills/level-1-workflows/{phase-implement → morph-phase-implement}/SKILL.md
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: phase-implement
|
|
2
|
+
name: morph:phase-implement
|
|
3
3
|
description: MORPH-SPEC Phase 5 (Implement). Executes feature tasks using TDD with checkpoint validation every 3 tasks, smoke tests via Playwright, and generates code + recap.md. Use after task list approval when starting feature implementation.
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
disable-model-invocation: true
|
|
6
6
|
context: fork
|
|
7
7
|
agent: general-purpose
|
|
8
8
|
user-invocable: false
|
|
9
|
-
cliVersion: "4.
|
|
9
|
+
cliVersion: "4.10.0"
|
|
10
10
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -23,16 +23,61 @@ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap
|
|
|
23
23
|
- [ ] Tasks gate (`morph-spec approve $ARGUMENTS tasks`) aprovado
|
|
24
24
|
- [ ] Todos os outputs de design existem (spec.md, contracts.cs, decisions.md)
|
|
25
25
|
|
|
26
|
+
## Passo 0: Garantir fase implement
|
|
27
|
+
|
|
28
|
+
**PASSO 0 (ANTES de qualquer leitura ou escrita) — Garantir fase implement:**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx morph-spec state get $ARGUMENTS
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Verifique o campo `"phase"` no output:
|
|
35
|
+
|
|
36
|
+
**Se `"phase": "implement"`** → ✅ fase correta, prossiga.
|
|
37
|
+
|
|
38
|
+
**Se `"phase": "tasks"`** → execute em sequência:
|
|
39
|
+
1. `npx morph-spec state mark-output $ARGUMENTS tasks`
|
|
40
|
+
2. `npx morph-spec approve $ARGUMENTS tasks`
|
|
41
|
+
3. `npx morph-spec phase advance $ARGUMENTS` (→ implement)
|
|
42
|
+
|
|
43
|
+
**Qualquer outro valor** → ⛔ não prossiga — estado inconsistente, reporte ao usuário.
|
|
44
|
+
|
|
45
|
+
> **Regra:** Nunca escreva em `5-implement/` enquanto a fase não for `implement`. O hook bloqueará a escrita.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Pre-flight — Validação Mecânica (OBRIGATÓRIO)
|
|
50
|
+
|
|
51
|
+
Antes de qualquer task, valide que as fases anteriores estão realmente completas. O `state.json` pode ter sido setado manualmente — estes comandos verificam os artefatos reais no filesystem.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 1. Verifica outputs obrigatórios de todas as fases anteriores
|
|
55
|
+
npx morph-spec validate-feature $ARGUMENTS
|
|
56
|
+
|
|
57
|
+
# 2. Confirma que todos os approval gates foram aprovados
|
|
58
|
+
npx morph-spec approval-status $ARGUMENTS
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Se qualquer check falhar → **STOP**. Não inicie nenhuma task. Reporte ao usuário o que está faltando e quais comandos rodar para resolver:
|
|
62
|
+
|
|
63
|
+
| Problema | Comando de resolução |
|
|
64
|
+
|----------|---------------------|
|
|
65
|
+
| Output faltando (spec.md, contracts, etc.) | Volte à fase correspondente e gere o output |
|
|
66
|
+
| Gate não aprovado (design, tasks) | `npx morph-spec approve $ARGUMENTS <gate>` |
|
|
67
|
+
| Phase inválida | `npx morph-spec phase advance $ARGUMENTS` |
|
|
68
|
+
|
|
69
|
+
**Esta etapa não é opcional.** Só prossiga quando ambos os comandos retornarem sem erros.
|
|
70
|
+
|
|
26
71
|
## Ferramentas Recomendadas
|
|
27
72
|
|
|
28
|
-
> **Ref:** `framework/skills/level-0-meta/tool-usage-guide/SKILL.md` para guia completo.
|
|
73
|
+
> **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` para guia completo.
|
|
29
74
|
> **Ref:** `framework/standards/integration/mcp/mcp-tools.md` para referência MCP.
|
|
30
75
|
> **Example:** `references/recap-example.md` — filled-in recap.md showing expected output quality.
|
|
31
76
|
|
|
32
77
|
| Ação | Ferramenta | Alternativa |
|
|
33
78
|
|------|------------|-------------|
|
|
34
79
|
| Verificar modo de execução (single/subagents/agent-teams) | **Bash** `npx morph-spec dispatch-agents $ARGUMENTS implement` | Grupos de tasks + prompts de subagents |
|
|
35
|
-
| **Dispatch implementadores por domínio** (subagents) | **
|
|
80
|
+
| **Dispatch implementadores por domínio** (subagents) | **Agent** `subagent_type=<taskGroups[grupo].agentId>` + `prompt=taskPrompt` do dispatch config | Backend + frontend + infra em paralelo |
|
|
36
81
|
| **Criar Agent Team** (features críticas multi-domínio) | Linguagem natural — veja Passo 0.5b | — |
|
|
37
82
|
| Ler task details | **Read** tasks.json, spec.md, contracts.cs | — |
|
|
38
83
|
| Criar novos arquivos | **Write** source files | — |
|
|
@@ -46,10 +91,11 @@ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap
|
|
|
46
91
|
| Smoke test no browser | **Playwright MCP** `browser_navigate()` + `browser_snapshot()` | Manual |
|
|
47
92
|
| Verificar erros de console | **Playwright MCP** `browser_console_messages()` | — |
|
|
48
93
|
| Screenshot para recap | **Playwright MCP** `browser_take_screenshot()` | — |
|
|
94
|
+
| Deploy e logs Vercel | **Vercel MCP** `list_projects()`, `get_deployments()`, `manage_env_vars()` | **Bash** `vercel deploy` |
|
|
49
95
|
| Criar PR | **Bash** `gh pr create ...` | **GitHub MCP** `create_pull_request()` |
|
|
50
96
|
| Atualizar state | **Bash** `npx morph-spec state set ...` | — |
|
|
51
97
|
|
|
52
|
-
**MCPs desta fase:** Supabase (migrations, RLS), Context7 (API lookup), Playwright (smoke test), GitHub (PRs).
|
|
98
|
+
**MCPs desta fase:** Supabase (migrations, RLS), Context7 (API lookup), Playwright (smoke test), GitHub (PRs), Vercel (deploy, logs, env vars).
|
|
53
99
|
|
|
54
100
|
**Anti-padrões:**
|
|
55
101
|
- ❌ Task agent para editar um único arquivo (use Edit direto)
|
|
@@ -66,6 +112,47 @@ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap
|
|
|
66
112
|
- ❌ **(VSA)** Registrar handlers/endpoints manualmente no Program.cs — auto-discovery via reflection
|
|
67
113
|
- ❌ **(VSA)** Colocar Request/Response em arquivos separados do Handler
|
|
68
114
|
- ❌ **(VSA)** Usar `Guid.NewGuid()` — use `Guid.CreateVersion7()`
|
|
115
|
+
- ❌ **Tentar corrigir um bug sem invocar `systematic-debugging` primeiro** — "a mudança é pequena" não é justificativa
|
|
116
|
+
- ✅ Ao encontrar bug: `Skill(superpowers:systematic-debugging)` → causa raiz → fix mínimo → verificar
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Pre-flight MCP — Validacao de Conexoes
|
|
121
|
+
|
|
122
|
+
Antes de iniciar as tasks, verifique que os MCPs necessarios para a fase implement estao funcionando.
|
|
123
|
+
|
|
124
|
+
**1. Coletar MCPs da fase implement:**
|
|
125
|
+
- Leia `framework/skills/level-0-meta/mcp-registry.json` → campo `phaseMatrix.implement`
|
|
126
|
+
- Leia `.claude/settings.local.json` → identifique quais MCPs estao configurados
|
|
127
|
+
|
|
128
|
+
**2. Para cada MCP CONFIGURADO que aparece em `phaseMatrix.implement`:**
|
|
129
|
+
1. Procure nas ferramentas disponiveis por uma que contenha `healthCheck.toolPattern` no nome
|
|
130
|
+
2. Se encontrada → execute `healthCheck.testCall` com `healthCheck.testParams`
|
|
131
|
+
3. Avalie:
|
|
132
|
+
|
|
133
|
+
| Resultado | Acao |
|
|
134
|
+
|-----------|------|
|
|
135
|
+
| **Sucesso** | `✓ {MCP} — pronto` |
|
|
136
|
+
| **Ferramenta nao encontrada** | `○ {MCP} — precisa restart` |
|
|
137
|
+
| **Erro** | → **AskUserQuestion** (abaixo) |
|
|
138
|
+
|
|
139
|
+
**Em caso de erro — pergunte ao usuario:**
|
|
140
|
+
|
|
141
|
+
Use `AskUserQuestion` com header `"{MCP}"` e opcoes:
|
|
142
|
+
- **Continuar sem {MCP}** — Mostre `fallback` do registry (ex: "Bash `gh` CLI" para GitHub). A implementacao usara o fallback automaticamente.
|
|
143
|
+
- **Reconfigurar credenciais** — Colete credenciais e atualize `.claude/settings.local.json`. Re-teste apos reconfigurar.
|
|
144
|
+
- **Parar implementacao** — Aborte. Usuario deve corrigir o MCP e re-rodar `/morph-apply`.
|
|
145
|
+
|
|
146
|
+
**3. Resumo MCP Readiness:**
|
|
147
|
+
```
|
|
148
|
+
MCP Readiness (implement phase):
|
|
149
|
+
✓ context7 — pronto
|
|
150
|
+
✓ supabase — pronto
|
|
151
|
+
○ playwright — precisa restart (fallback: manual testing)
|
|
152
|
+
— docker — nao configurado
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
> **Design:** Este check e fail-open — consistente com a filosofia morph-spec. O usuario tem escolha explicita em vez de tasks falhando silenciosamente.
|
|
69
156
|
|
|
70
157
|
---
|
|
71
158
|
|
|
@@ -75,10 +162,11 @@ Implemente as tasks definidas na FASE 4, com checkpoints a cada 3 tasks e recap
|
|
|
75
162
|
|
|
76
163
|
```
|
|
77
164
|
# Uma única chamada, não sequencial:
|
|
78
|
-
Read: .morph/features/{feature}/
|
|
165
|
+
Read: .morph/features/{feature}/4-tasks/tasks.md
|
|
79
166
|
+ Read: .morph/features/{feature}/1-design/spec.md
|
|
80
167
|
+ Read: .morph/features/{feature}/1-design/contracts.cs
|
|
81
168
|
+ Read: .morph/config/config.json (→ architecture.style)
|
|
169
|
+
+ Read: .morph/features/{feature}/3-plan/plan.md
|
|
82
170
|
```
|
|
83
171
|
|
|
84
172
|
### 2. Criar native tasks individuais por T001-T00N
|
|
@@ -110,26 +198,38 @@ TaskUpdate(taskId="<id de T003>", addBlockedBy=["<id de T001>", "<id de T002>"])
|
|
|
110
198
|
|
|
111
199
|
### Passo 0.5: Planejar Modo de Execução
|
|
112
200
|
|
|
113
|
-
**
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
npx morph-spec dispatch-agents $ARGUMENTS implement
|
|
201
|
+
**Ler estratégia do plano:**
|
|
117
202
|
```
|
|
203
|
+
Read: .morph/features/{feature}/3-plan/plan.md → extrair campo "Execution Strategy"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
A estratégia já foi definida e aprovada na fase Plan. Use-a diretamente:
|
|
118
207
|
|
|
119
|
-
**O
|
|
208
|
+
**O campo `Execution Strategy` determina o caminho de execução:**
|
|
120
209
|
|
|
121
|
-
|
|
|
210
|
+
| Estratégia | Ação |
|
|
122
211
|
|--------|------|
|
|
123
212
|
| `"single"` | → Continue para o workflow sequencial normal (Passo 1) |
|
|
124
213
|
| `"subagents"` | → Dispatch Task subagents em paralelo (abaixo) |
|
|
125
214
|
| `"agent-teams"` | → Crie Agent Team com plan approval (Passo 0.5b) |
|
|
126
215
|
|
|
216
|
+
Se `plan.md` não existir ou o campo não estiver presente, execute como fallback:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
npx morph-spec dispatch-agents $ARGUMENTS implement
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**O output inclui um campo `mode` equivalente à estratégia do plano.**
|
|
223
|
+
|
|
127
224
|
---
|
|
128
225
|
|
|
129
226
|
#### Modo `"subagents"` (se `mode: "subagents"` no output):
|
|
130
227
|
|
|
131
228
|
1. Leia os `taskGroups` retornados (ex: `backend`, `frontend`, `infra`)
|
|
132
|
-
2. Para cada grupo com ≥ 3 tasks e sem dependências cruzadas, use **
|
|
229
|
+
2. Para cada grupo com ≥ 3 tasks e sem dependências cruzadas, use o **Agent tool** com o `subagent_type=<agentId>` do grupo e o `taskPrompt` do dispatch config:
|
|
230
|
+
|
|
231
|
+
> **Mapeamento:** `taskGroups[grupo].agentId` do dispatch config = `subagent_type` no Agent tool.
|
|
232
|
+
> Exemplo: `agentId: "dotnet-senior"` → `Agent(subagent_type=dotnet-senior, prompt=taskPrompt)`.
|
|
133
233
|
|
|
134
234
|
```
|
|
135
235
|
[Task tool — grupo backend, por exemplo]
|
|
@@ -155,6 +255,7 @@ Para cada task do grupo, em ordem:
|
|
|
155
255
|
3. Leia a descrição completa da task
|
|
156
256
|
4. Implemente os arquivos — use Write (novo) ou Edit (existente)
|
|
157
257
|
5. Verifique build: [dotnet build / npm run build]
|
|
258
|
+
5b. Invoke Skill(verification-before-completion) — só prossiga para o passo 6 se passar
|
|
158
259
|
6. Execute: npx morph-spec task done $ARGUMENTS TXXX
|
|
159
260
|
7. Se task done retornar sem erro: TaskUpdate(taskId="<native id de T00X>", status="completed")
|
|
160
261
|
|
|
@@ -234,22 +335,29 @@ Sintetize os resultados de todos os teammates no recap.md (Passo 6).
|
|
|
234
335
|
- [ ] `spec.md` atualizado com clarificações?
|
|
235
336
|
- [ ] `contracts.cs` corresponde ao schema real?
|
|
236
337
|
- [ ] Build base do projeto compila sem erros?
|
|
338
|
+
- [ ] `activeAgents` estão populados? (`morph-spec state get $ARGUMENTS` → campo `activeAgents` não vazio)
|
|
237
339
|
|
|
238
340
|
```bash
|
|
239
341
|
npx morph-spec state get $ARGUMENTS
|
|
240
342
|
npx morph-spec approval-status $ARGUMENTS
|
|
343
|
+
# Se activeAgents estiver vazio → pare aqui e execute /phase-setup $ARGUMENTS primeiro
|
|
344
|
+
npx morph-spec state get $ARGUMENTS | grep -A5 activeAgents
|
|
241
345
|
```
|
|
242
346
|
|
|
243
347
|
**❌ Se alguma checkbox NÃO estiver marcada:**
|
|
244
348
|
→ Voltar para a fase correspondente
|
|
245
349
|
|
|
350
|
+
**❌ Se `activeAgents` estiver vazio:**
|
|
351
|
+
→ Execute o skill `phase-setup` primeiro: `/phase-setup $ARGUMENTS`
|
|
352
|
+
→ Agentes não detectados = standards não carregados = implementação sem contexto correto
|
|
353
|
+
|
|
246
354
|
---
|
|
247
355
|
|
|
248
356
|
### Passo 1: Carregar Contexto Completo
|
|
249
357
|
|
|
250
358
|
Leia todos os outputs antes de implementar:
|
|
251
359
|
|
|
252
|
-
1. `.morph/features/$ARGUMENTS/
|
|
360
|
+
1. `.morph/features/$ARGUMENTS/4-tasks/tasks.md` — Lista de tasks
|
|
253
361
|
2. `.morph/features/$ARGUMENTS/1-design/spec.md` — Especificação completa
|
|
254
362
|
3. `.morph/features/$ARGUMENTS/1-design/contracts.cs` — Interfaces e DTOs
|
|
255
363
|
4. `.morph/features/$ARGUMENTS/1-design/decisions.md` — ADRs
|
|
@@ -296,6 +404,12 @@ Para cada task (T001 → T00N):
|
|
|
296
404
|
4. **Ler contracts.cs** para DTOs/interfaces relevantes
|
|
297
405
|
5. **Implementar** usando Write (novo) ou Edit (existente)
|
|
298
406
|
6. **Verificar** — build, lint, testes
|
|
407
|
+
6b. **⚠️ OBRIGATÓRIO — Verificação antes de `task done`:**
|
|
408
|
+
Invoke `Skill(verification-before-completion)` ou execute manualmente:
|
|
409
|
+
```bash
|
|
410
|
+
npx morph-spec validate-feature $ARGUMENTS --phase implement
|
|
411
|
+
```
|
|
412
|
+
Só prossiga para o passo 7 se a verificação passar. Se falhar → corrija antes de marcar `task done`.
|
|
299
413
|
7. **Marcar como done via CLI:**
|
|
300
414
|
```bash
|
|
301
415
|
npx morph-spec task done $ARGUMENTS T001
|
|
@@ -389,6 +503,7 @@ Execute o skill `post-implementation` antes de criar o PR. Ele orquestra:
|
|
|
389
503
|
- `validate-feature` final
|
|
390
504
|
- Smoke test via Playwright (obrigatório se dev server ativo)
|
|
391
505
|
- Checklist de code review (CRITICAL + HIGH)
|
|
506
|
+
- **`morph-checklist`** — compliance (segurança, SEO, performance, acessibilidade, LGPD)
|
|
392
507
|
- Checkpoint + recap final
|
|
393
508
|
|
|
394
509
|
### Passo 9: Frontend Review (NEXTJS/FULLSTACK)
|
|
@@ -404,17 +519,43 @@ screenshots responsivos (mobile/tablet/desktop), e verificação de SEO metadata
|
|
|
404
519
|
|
|
405
520
|
---
|
|
406
521
|
|
|
407
|
-
##
|
|
522
|
+
## Dispatch Morph-Nativo
|
|
523
|
+
|
|
524
|
+
O morph-spec usa seus próprios agentes e validadores para implementação, dispatch e review.
|
|
525
|
+
|
|
526
|
+
### Implementação
|
|
527
|
+
|
|
528
|
+
Implementadores são despachados via `dispatch-agents`:
|
|
529
|
+
```bash
|
|
530
|
+
npx morph-spec dispatch-agents $ARGUMENTS implement
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
Use o `agentId` de cada grupo como `subagent_type` no Agent tool:
|
|
534
|
+
```
|
|
535
|
+
Agent(subagent_type=<agentId>, prompt=<conteúdo de prompts/implementer-prompt.md preenchido>)
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### Review (Two-Stage)
|
|
539
|
+
|
|
540
|
+
**Stage 1 — Spec Compliance (obrigatório):**
|
|
541
|
+
```
|
|
542
|
+
Agent(subagent_type=<tier-4 validator>, prompt=<conteúdo de prompts/spec-reviewer-prompt.md>)
|
|
543
|
+
```
|
|
544
|
+
Use validadores do `dispatch-agents --mode validate`. Spec compliance DEVE passar antes de prosseguir.
|
|
545
|
+
|
|
546
|
+
**Stage 2 — Code Quality (obrigatório):**
|
|
547
|
+
```
|
|
548
|
+
Agent(subagent_type=standards-architect, prompt=<conteúdo de prompts/code-quality-reviewer-prompt.md>)
|
|
549
|
+
```
|
|
550
|
+
Issues `critical` bloqueiam. Issues `important` devem ser corrigidas. `suggestion` é opcional.
|
|
408
551
|
|
|
409
|
-
|
|
552
|
+
### Prompt Templates
|
|
410
553
|
|
|
411
|
-
|
|
|
412
|
-
|
|
413
|
-
| `
|
|
414
|
-
| `
|
|
415
|
-
| `
|
|
416
|
-
| `verification-before-completion` | Antes de marcar feature como done | Use `verification-before-completion` (morph-spec version) |
|
|
417
|
-
| `post-implementation` | Antes de criar o PR (scans + smoke test + review) | `/post-implementation {feature}` |
|
|
554
|
+
| Template | Uso |
|
|
555
|
+
|----------|-----|
|
|
556
|
+
| `prompts/implementer-prompt.md` | Dispatch para agentes implementadores |
|
|
557
|
+
| `prompts/spec-reviewer-prompt.md` | Review de compliance com spec |
|
|
558
|
+
| `prompts/code-quality-reviewer-prompt.md` | Review de qualidade de código |
|
|
418
559
|
|
|
419
560
|
---
|
|
420
561
|
|
|
@@ -422,7 +563,7 @@ screenshots responsivos (mobile/tablet/desktop), e verificação de SEO metadata
|
|
|
422
563
|
|
|
423
564
|
- Código fonte implementado (vários arquivos)
|
|
424
565
|
- Testes unitários e de integração
|
|
425
|
-
- `.morph/features/$ARGUMENTS/
|
|
566
|
+
- `.morph/features/$ARGUMENTS/5-implement/recap.md` — Resumo da implementação
|
|
426
567
|
|
|
427
568
|
## Critérios de Conclusão
|
|
428
569
|
|
|
@@ -433,7 +574,7 @@ screenshots responsivos (mobile/tablet/desktop), e verificação de SEO metadata
|
|
|
433
574
|
- [x] `recap.md` gerado
|
|
434
575
|
- [x] State atualizado para `status: done`
|
|
435
576
|
- [x] Checkpoints salvos a cada 3 tasks
|
|
436
|
-
- [x] `/post-implementation` executado sem BLOCKs (smoke test, scans, code review)
|
|
577
|
+
- [x] `/post-implementation` executado sem BLOCKs (smoke test, scans, code review, `morph-checklist`)
|
|
437
578
|
|
|
438
579
|
---
|
|
439
580
|
|
|
@@ -442,9 +583,9 @@ screenshots responsivos (mobile/tablet/desktop), e verificação de SEO metadata
|
|
|
442
583
|
<!-- morph:outputs:implement -->
|
|
443
584
|
| Output | Caminho |
|
|
444
585
|
|--------|---------|
|
|
445
|
-
| `recap` | `.morph/features/{feature}/
|
|
586
|
+
| `recap` | `.morph/features/{feature}/5-implement/recap.md` |
|
|
446
587
|
<!-- /morph:outputs -->
|
|
447
588
|
|
|
448
589
|
---
|
|
449
590
|
|
|
450
|
-
Feature completa! Considere criar um PR e rodar `morph-spec
|
|
591
|
+
Feature completa! Considere criar um PR e rodar `morph-spec generate recap $ARGUMENTS`.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Morph-Spec Code Quality Review
|
|
2
|
+
|
|
3
|
+
You are the standards-architect reviewer for feature '{{FEATURE_NAME}}'.
|
|
4
|
+
|
|
5
|
+
## Review Scope
|
|
6
|
+
|
|
7
|
+
Review the implementation for code quality, architecture compliance, and adherence to project standards.
|
|
8
|
+
|
|
9
|
+
## Reference Documents
|
|
10
|
+
|
|
11
|
+
Read these before reviewing:
|
|
12
|
+
- `.morph/context/standards.md` — Project coding standards
|
|
13
|
+
- `.morph/context/README.md` — Project architecture overview
|
|
14
|
+
- `framework/standards/` — Framework-level standards (reference as needed)
|
|
15
|
+
|
|
16
|
+
## Review Checklist
|
|
17
|
+
|
|
18
|
+
1. **Naming Conventions** — PascalCase for types, camelCase for variables, kebab-case for files (or as defined in standards)
|
|
19
|
+
2. **Architecture Compliance** — Code follows the project's architecture pattern (VSA slices, DDD layers, etc.)
|
|
20
|
+
3. **Async Patterns** — CancellationToken propagated, no fire-and-forget, proper await
|
|
21
|
+
4. **Error Handling** — Appropriate exceptions, no swallowed errors, consistent patterns
|
|
22
|
+
5. **Security** — No hardcoded secrets, SQL injection, XSS vectors, or OWASP top 10 issues
|
|
23
|
+
6. **DI Lifetimes** — Correct service registration (Scoped for DB, Singleton for config, etc.)
|
|
24
|
+
7. **Test Quality** — Tests follow Arrange-Act-Assert, meaningful assertions, no test duplication
|
|
25
|
+
|
|
26
|
+
## Output Format
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"passed": true/false,
|
|
31
|
+
"issues": [
|
|
32
|
+
{
|
|
33
|
+
"severity": "critical|important|suggestion",
|
|
34
|
+
"file": "path/to/file",
|
|
35
|
+
"line": 42,
|
|
36
|
+
"description": "What the issue is",
|
|
37
|
+
"fix": "How to fix it"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
|
|
45
|
+
- `critical` issues MUST be fixed before merge
|
|
46
|
+
- `important` issues SHOULD be fixed
|
|
47
|
+
- `suggestion` issues are optional improvements
|
|
48
|
+
- Only `critical` issues cause `passed: false`
|
|
49
|
+
- Be specific — always include file path and line number
|
|
50
|
+
- Prefer minimal fixes over refactoring
|
package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Morph-Spec Implementer Dispatch
|
|
2
|
+
|
|
3
|
+
You are implementing tasks for the feature '{{FEATURE_NAME}}' as agent '{{AGENT_ID}}'.
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
**Spec:** Read `.morph/features/{{FEATURE_NAME}}/1-design/spec.md`
|
|
8
|
+
**Contracts:** Read `.morph/features/{{FEATURE_NAME}}/1-design/contracts.cs`
|
|
9
|
+
**Plan:** Read `.morph/features/{{FEATURE_NAME}}/3-plan/plan.md`
|
|
10
|
+
**Standards:** Read `.morph/context/standards.md` and relevant files in `framework/standards/`
|
|
11
|
+
|
|
12
|
+
## Agent Briefing
|
|
13
|
+
|
|
14
|
+
{{AGENT_BRIEFING}}
|
|
15
|
+
|
|
16
|
+
## Tasks Assigned
|
|
17
|
+
|
|
18
|
+
{{TASK_LIST}}
|
|
19
|
+
|
|
20
|
+
## Execution Rules
|
|
21
|
+
|
|
22
|
+
1. Before starting each task:
|
|
23
|
+
- Execute: `npx morph-spec task start {{FEATURE_NAME}} {{TASK_ID}}`
|
|
24
|
+
|
|
25
|
+
2. For each task, follow TDD:
|
|
26
|
+
- Write the failing test first
|
|
27
|
+
- Run it to verify it fails
|
|
28
|
+
- Write minimal implementation to pass
|
|
29
|
+
- Run tests to verify they pass
|
|
30
|
+
- Commit
|
|
31
|
+
|
|
32
|
+
3. Before marking any task done:
|
|
33
|
+
- Verify build compiles: `dotnet build` or `npm run build`
|
|
34
|
+
- Run relevant tests
|
|
35
|
+
- Execute: `npx morph-spec task done {{FEATURE_NAME}} {{TASK_ID}}`
|
|
36
|
+
|
|
37
|
+
4. Every 3 tasks:
|
|
38
|
+
- Execute: `npx morph-spec checkpoint-save {{FEATURE_NAME}}`
|
|
39
|
+
- Execute: `npx morph-spec validate-feature {{FEATURE_NAME}} --phase implement`
|
|
40
|
+
|
|
41
|
+
5. Contracts are the source of truth — all DTOs, interfaces, and types MUST match `contracts.cs` exactly
|
|
42
|
+
|
|
43
|
+
6. Modify ONLY files listed in your assigned tasks. Do NOT touch files outside your domain.
|
|
44
|
+
|
|
45
|
+
7. If you encounter a dependency on another agent's work, STOP and report it.
|
package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Morph-Spec Spec Compliance Review
|
|
2
|
+
|
|
3
|
+
You are a Tier-4 spec reviewer for feature '{{FEATURE_NAME}}'.
|
|
4
|
+
|
|
5
|
+
## Review Scope
|
|
6
|
+
|
|
7
|
+
Review the implementation against the specification. Your job is to ensure the code matches the spec EXACTLY — no more, no less.
|
|
8
|
+
|
|
9
|
+
## Reference Documents
|
|
10
|
+
|
|
11
|
+
Read these before reviewing:
|
|
12
|
+
- `.morph/features/{{FEATURE_NAME}}/1-design/spec.md` — The specification
|
|
13
|
+
- `.morph/features/{{FEATURE_NAME}}/1-design/contracts.cs` — The contracts (source of truth)
|
|
14
|
+
- `.morph/features/{{FEATURE_NAME}}/3-plan/plan.md` — The implementation plan
|
|
15
|
+
|
|
16
|
+
## Review Checklist
|
|
17
|
+
|
|
18
|
+
For each task implemented, verify:
|
|
19
|
+
|
|
20
|
+
1. **Completeness** — All acceptance criteria from spec.md are implemented
|
|
21
|
+
2. **Correctness** — DTOs, interfaces, and types match contracts.cs exactly
|
|
22
|
+
3. **No over-building** — No features, flags, or abstractions not in the spec
|
|
23
|
+
4. **No under-building** — No missing error handling, validations, or edge cases from the spec
|
|
24
|
+
5. **Naming** — All names match the contracts (exact casing and spelling)
|
|
25
|
+
|
|
26
|
+
## Output Format
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"passed": true/false,
|
|
31
|
+
"issues": [
|
|
32
|
+
{
|
|
33
|
+
"severity": "error|warning",
|
|
34
|
+
"file": "path/to/file",
|
|
35
|
+
"description": "What doesn't match the spec",
|
|
36
|
+
"specReference": "Which section of spec.md"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Rules
|
|
43
|
+
|
|
44
|
+
- Only flag issues that represent spec non-compliance
|
|
45
|
+
- Do NOT flag style preferences or minor improvements
|
|
46
|
+
- Every issue MUST reference a specific section of spec.md or contracts.cs
|
|
47
|
+
- If the implementation matches the spec, output `{ "passed": true, "issues": [] }`
|