@polymorphism-tech/morph-spec 4.9.0 → 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/README.md +2 -2
- package/bin/morph-spec.js +30 -0
- package/bin/task-manager.js +34 -22
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +99 -98
- package/framework/agents.json +37 -7
- 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/dispatch.js +154 -31
- package/framework/hooks/claude-code/post-tool-use/skill-reminder.js +7 -84
- 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 +3 -2
- 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 +55 -2
- package/framework/hooks/claude-code/session-start/post-compact-restore.js +41 -0
- 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/shared/compact-restore.js +100 -0
- package/framework/hooks/shared/dispatch-helpers.js +116 -0
- package/framework/hooks/shared/phase-utils.js +9 -5
- package/framework/hooks/shared/state-reader.js +27 -3
- package/framework/phases.json +30 -7
- 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 +13 -16
- package/framework/skills/level-0-meta/{code-review → morph-code-review}/SKILL.md +1 -1
- package/framework/skills/level-0-meta/{code-review-nextjs → morph-code-review-nextjs}/SKILL.md +2 -2
- package/framework/skills/level-0-meta/{frontend-review → morph-frontend-review}/SKILL.md +5 -5
- package/framework/skills/level-0-meta/morph-init/SKILL.md +72 -7
- package/framework/skills/level-0-meta/{post-implementation → morph-post-implementation}/SKILL.md +9 -9
- package/framework/skills/level-0-meta/morph-replicate/SKILL.md +1 -1
- package/framework/skills/level-0-meta/{terminal-title → morph-terminal-title}/SKILL.md +1 -1
- package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/SKILL.md +2 -3
- package/framework/skills/level-0-meta/{tool-usage-guide → morph-tool-usage-guide}/references/tools-per-phase.md +1 -2
- package/framework/skills/level-0-meta/{verification-before-completion → morph-verification-before-completion}/SKILL.md +1 -1
- 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 +251 -251
- 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 +590 -491
- 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 +237 -194
- package/framework/skills/level-1-workflows/{phase-tasks → morph-phase-tasks}/SKILL.md +307 -270
- 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 +320 -285
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +97 -0
- package/framework/standards/integration/mcp/mcp-tools.md +25 -7
- package/framework/templates/docs/onboarding.md +2 -2
- package/package.json +1 -2
- package/src/commands/agents/dispatch-agents.js +50 -3
- package/src/commands/mcp/mcp-setup.js +39 -2
- package/src/commands/phase/phase-reset.js +74 -0
- package/src/commands/project/doctor.js +19 -5
- package/src/commands/scope/escalate.js +215 -0
- package/src/commands/state/advance-phase.js +27 -53
- package/src/commands/state/state.js +1 -1
- package/src/commands/task/expand.js +100 -0
- package/src/core/paths/output-schema.js +4 -3
- package/src/core/state/phase-state-machine.js +7 -4
- package/src/core/state/state-manager.js +4 -3
- 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 +22 -16
- package/src/lib/scope/impact-analyzer.js +106 -0
- package/src/lib/tasks/task-parser.js +1 -1
- package/src/lib/validators/shared/emit-validator-dispatch.js +64 -0
- package/src/scripts/setup-infra.js +15 -0
- package/src/utils/agents-installer.js +32 -12
- package/src/utils/file-copier.js +0 -1
- package/src/utils/hooks-installer.js +15 -1
- package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +0 -216
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +0 -383
- package/src/commands/project/index.js +0 -8
- package/src/core/index.js +0 -10
- 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/workflows/index.js +0 -7
- 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/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/sanitizer/context-sanitizer.js +0 -221
- package/src/sanitizer/patterns.js +0 -163
- 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/{simulation-checklist → morph-simulation-checklist}/SKILL.md +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
|
@@ -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": [] }`
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: morph:phase-plan
|
|
3
|
+
description: MORPH-SPEC Phase 4 (Plan). Generates a detailed implementation plan with exact file paths, TDD code blocks, and execution strategy analysis. Produces plan.md in 3-plan/. Use after clarify phase to create an actionable implementation plan before task breakdown.
|
|
4
|
+
argument-hint: "[feature-name]"
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
user-invocable: false
|
|
7
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
8
|
+
cliVersion: "4.10.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# MORPH Plan - FASE 4
|
|
12
|
+
|
|
13
|
+
> INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
|
|
14
|
+
|
|
15
|
+
Gere um plano de implementacao detalhado com paths exatos, codigo TDD e estrategia de execucao.
|
|
16
|
+
|
|
17
|
+
## Pre-requisitos
|
|
18
|
+
|
|
19
|
+
- [ ] FASE 3 (Clarify) concluida
|
|
20
|
+
- [ ] `spec.md` atualizado com clarificacoes
|
|
21
|
+
- [ ] `contracts.cs` ou `contracts.ts` definidos
|
|
22
|
+
|
|
23
|
+
## Ferramentas Recomendadas
|
|
24
|
+
|
|
25
|
+
> **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` para guia completo.
|
|
26
|
+
|
|
27
|
+
| Acao | Ferramenta | Alternativa |
|
|
28
|
+
|------|------------|-------------|
|
|
29
|
+
| Ler spec + contracts + decisions | **Read** todos os outputs | --- |
|
|
30
|
+
| Analisar codebase existente | **Glob** + **Grep** padroes | --- |
|
|
31
|
+
| Consultar docs de libs | **Context7 MCP** `query_docs()` | **WebSearch** |
|
|
32
|
+
| Dispatch agents para analise | **Bash** `npx morph-spec dispatch-agents $ARGUMENTS plan` | --- |
|
|
33
|
+
| Atualizar state | **Bash** `npx morph-spec state mark-output $ARGUMENTS plan` | --- |
|
|
34
|
+
|
|
35
|
+
**Anti-padroes:**
|
|
36
|
+
- :x: Gerar plano sem ler contracts.cs (contracts sao a fonte de verdade!)
|
|
37
|
+
- :x: Paths genericos ("adicione o arquivo") -- sempre paths exatos
|
|
38
|
+
- :x: Codigo incompleto no plano ("adicione validacao") -- sempre codigo completo
|
|
39
|
+
- :x: Pular analise de codebase existente (padroes existentes guiam o plano)
|
|
40
|
+
- :x: Ignorar `config.architecture.style` -- VSA e DDD tem estruturas diferentes
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## PRE-VOO OBRIGATORIO
|
|
45
|
+
|
|
46
|
+
### 0. Garantir fase plan
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx morph-spec state get $ARGUMENTS
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Verifique o campo `"phase"` no output:
|
|
53
|
+
- `"phase": "plan"` -> fase correta, prossiga
|
|
54
|
+
- qualquer outro valor -> execute `npx morph-spec phase advance $ARGUMENTS` e volte a verificar
|
|
55
|
+
|
|
56
|
+
> **Regra:** Nunca escreva em `3-plan/` enquanto a fase nao for `plan`.
|
|
57
|
+
|
|
58
|
+
### 1. Ler todos os prerequisitos em PARALELO
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Read: .morph/features/{feature}/1-design/spec.md
|
|
62
|
+
+ Read: .morph/features/{feature}/1-design/contracts.cs
|
|
63
|
+
+ Read: .morph/features/{feature}/1-design/decisions.md
|
|
64
|
+
+ Read: .morph/features/{feature}/1-design/clarifications.md
|
|
65
|
+
+ Read: .morph/features/{feature}/1-design/schema-analysis.md (se existir)
|
|
66
|
+
+ Read: .morph/config/config.json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Criar tasks de sessao
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
TaskCreate: "Analisar spec e planejar" -> activeForm: "Analisando spec"
|
|
73
|
+
TaskCreate: "Gerar plan.md" -> activeForm: "Gerando plano"
|
|
74
|
+
TaskCreate: "Avanco de fase" -> activeForm: "Avancando fase"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Workflow
|
|
80
|
+
|
|
81
|
+
### Passo 1: Analisar Feature para Contexto
|
|
82
|
+
|
|
83
|
+
1. **Ler codebase existente** -- Glob para encontrar arquivos que serao modificados/criados
|
|
84
|
+
2. **Identificar padroes** -- Grep por padroes similares ao que sera implementado
|
|
85
|
+
3. **Verificar libs/frameworks** -- Context7 para docs das dependencias
|
|
86
|
+
4. **Detectar arquitetura:**
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
cat .morph/config/config.json | grep -A3 '"architecture"'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| Valor de `config.architecture.style` | Caminho |
|
|
93
|
+
|--------------------------------------|---------|
|
|
94
|
+
| `"vertical-slice"` | -> Estrutura VSA: `Features/{Entity}Feature/{Op}/` |
|
|
95
|
+
| qualquer outro valor | -> Estrutura DDD por layer |
|
|
96
|
+
|
|
97
|
+
### Passo 2: Determinar Estrategia de Execucao
|
|
98
|
+
|
|
99
|
+
Execute a analise:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx morph-spec dispatch-agents $ARGUMENTS plan
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Fatores para recomendacao:**
|
|
106
|
+
|
|
107
|
+
| Fator | Calculo |
|
|
108
|
+
|-------|---------|
|
|
109
|
+
| `taskCount` | Numero de requisitos funcionais + componentes tecnicos no spec |
|
|
110
|
+
| `domainCount` | Dominios distintos nos activeAgents (backend, frontend, infra) |
|
|
111
|
+
| `agentCount` | Total de activeAgents |
|
|
112
|
+
| `independence` | % de tasks sem dependencias cross-domain |
|
|
113
|
+
|
|
114
|
+
**Decisao:**
|
|
115
|
+
|
|
116
|
+
| Cenario | Recomendacao |
|
|
117
|
+
|---------|--------------|
|
|
118
|
+
| `taskCount < 8` AND `domainCount <= 2` | **Single session** -- implementacao direta |
|
|
119
|
+
| `taskCount 8-20` AND `domainCount 2-3` | **Subagent-Driven** -- um subagent morph por grupo |
|
|
120
|
+
| `taskCount > 20` OR `domainCount > 3` | **Agent Teams** -- coordenacao multi-dominio |
|
|
121
|
+
|
|
122
|
+
### Passo 3: Gerar `plan.md`
|
|
123
|
+
|
|
124
|
+
Crie `.morph/features/$ARGUMENTS/3-plan/plan.md` com a estrutura:
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
# {Feature Name} Implementation Plan
|
|
128
|
+
|
|
129
|
+
> **For Claude:** Use morph:phase-implement to execute this plan.
|
|
130
|
+
|
|
131
|
+
**Goal:** {Uma frase descrevendo o que sera construido}
|
|
132
|
+
|
|
133
|
+
**Architecture:** {2-3 frases sobre a abordagem}
|
|
134
|
+
|
|
135
|
+
**Tech Stack:** {Tecnologias chave}
|
|
136
|
+
|
|
137
|
+
**Execution Strategy:** {single | subagents | agent-teams} (Recommended)
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## GROUP {A} --- {Nome do Grupo}
|
|
142
|
+
|
|
143
|
+
{Padrao e contexto do grupo}
|
|
144
|
+
|
|
145
|
+
### {A1} --- {Nome da task}
|
|
146
|
+
|
|
147
|
+
**Files:**
|
|
148
|
+
- Create: `exact/path/to/file.cs`
|
|
149
|
+
- Modify: `exact/path/to/existing.cs:123-145`
|
|
150
|
+
- Test: `tests/exact/path/to/test.cs`
|
|
151
|
+
|
|
152
|
+
**Step 1: Write the failing test**
|
|
153
|
+
|
|
154
|
+
(Codigo completo do teste)
|
|
155
|
+
|
|
156
|
+
**Step 2: Run test to verify it fails**
|
|
157
|
+
|
|
158
|
+
Run: `{comando exato}`
|
|
159
|
+
Expected: FAIL with "{mensagem}"
|
|
160
|
+
|
|
161
|
+
**Step 3: Write minimal implementation**
|
|
162
|
+
|
|
163
|
+
(Codigo completo da implementacao)
|
|
164
|
+
|
|
165
|
+
**Step 4: Run test to verify it passes**
|
|
166
|
+
|
|
167
|
+
Run: `{comando exato}`
|
|
168
|
+
Expected: PASS
|
|
169
|
+
|
|
170
|
+
**Step 5: Commit**
|
|
171
|
+
|
|
172
|
+
git add {files}
|
|
173
|
+
git commit -m "{mensagem}"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Regras obrigatorias:**
|
|
177
|
+
- Paths exatos SEMPRE (nunca genericos)
|
|
178
|
+
- Codigo COMPLETO no plano (nunca "adicione validacao")
|
|
179
|
+
- Comandos exatos com output esperado
|
|
180
|
+
- DRY, YAGNI, TDD, commits frequentes
|
|
181
|
+
- Cada step e uma acao de 2-5 minutos
|
|
182
|
+
|
|
183
|
+
### Passo 4: Atualizar State
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npx morph-spec state mark-output $ARGUMENTS plan
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## PAUSA OBRIGATORIA
|
|
192
|
+
|
|
193
|
+
Use `AskUserQuestion` para capturar aprovacao:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"questions": [
|
|
198
|
+
{
|
|
199
|
+
"header": "Aprovacao",
|
|
200
|
+
"question": "Plano de implementacao gerado. Aprovar para iniciar task breakdown?",
|
|
201
|
+
"multiSelect": false,
|
|
202
|
+
"options": [
|
|
203
|
+
{ "label": "Aprovar plano", "description": "Avancar para fase de task breakdown" },
|
|
204
|
+
{ "label": "Tenho feedback", "description": "Digite o que deseja mudar no campo abaixo (Other)" }
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"header": "Execucao",
|
|
209
|
+
"question": "Qual estrategia de execucao para implementacao?",
|
|
210
|
+
"multiSelect": false,
|
|
211
|
+
"options": [
|
|
212
|
+
{ "label": "{Recomendacao} (Recommended)", "description": "{Justificativa baseada na analise do Passo 2}" },
|
|
213
|
+
{ "label": "{Alternativa 1}", "description": "{Descricao}" },
|
|
214
|
+
{ "label": "{Alternativa 2}", "description": "{Descricao}" }
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
> A primeira opcao de "Execucao" deve ser a recomendacao context-aware calculada no Passo 2. As alternativas sao as outras estrategias.
|
|
222
|
+
|
|
223
|
+
- **"Aprovar plano"** -> execute:
|
|
224
|
+
```bash
|
|
225
|
+
npx morph-spec approve $ARGUMENTS plan
|
|
226
|
+
npx morph-spec phase advance $ARGUMENTS
|
|
227
|
+
```
|
|
228
|
+
- **"Tenho feedback" ou "Other"** -> aplique o feedback recebido e repita esta PAUSA
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Outputs desta Fase
|
|
233
|
+
|
|
234
|
+
<!-- morph:outputs:plan -->
|
|
235
|
+
| Output | Caminho |
|
|
236
|
+
|--------|---------|
|
|
237
|
+
| `plan` | `.morph/features/{feature}/3-plan/plan.md` |
|
|
238
|
+
<!-- /morph:outputs -->
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Criterios de Avanco
|
|
243
|
+
|
|
244
|
+
- [x] `plan.md` criado com todos os grupos e tasks
|
|
245
|
+
- [x] Paths exatos para todos os arquivos
|
|
246
|
+
- [x] Codigo completo em cada step
|
|
247
|
+
- [x] Comandos de teste com output esperado
|
|
248
|
+
- [x] Estrategia de execucao definida e aprovada
|
|
249
|
+
- [x] State atualizado (`mark-output plan`)
|
|
250
|
+
- [x] Usuario aprovou plano
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
Apos aprovacao: prosseguir automaticamente para FASE 5 (Tasks).
|