@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
@@ -0,0 +1,166 @@
1
+ ---
2
+ allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git diff:*), Bash(git log:*)
3
+ argument-hint: [message] | --no-verify | --amend
4
+ description: Create well-formatted commits with conventional commit format and emoji
5
+ ---
6
+
7
+ # Smart Git Commit
8
+
9
+ Create well-formatted commit: $ARGUMENTS
10
+
11
+ ## Current Repository State
12
+
13
+ - Git status: !git status --porcelain
14
+ - Current branch: !git branch --show-current
15
+ - Staged changes: !git diff --cached --stat
16
+ - Unstaged changes: !git diff --stat
17
+ - Recent commits: !git log --oneline -5
18
+
19
+ ## What This Command Does
20
+
21
+ 1. Unless specified with --no-verify, automatically runs pre-commit checks:
22
+ - pnpm lint to ensure code quality
23
+ - pnpm build to verify the build succeeds
24
+ - pnpm generate:docs to update documentation
25
+ 2. Checks which files are staged with git status
26
+ 3. If 0 files are staged, automatically adds all modified and new files with git add
27
+ 4. Performs a git diff to understand what changes are being committed
28
+ 5. Analyzes the diff to determine if multiple distinct logical changes are present
29
+ 6. If multiple distinct changes are detected, suggests breaking the commit into multiple smaller commits
30
+ 7. For each commit (or the single commit if not split), creates a commit message using emoji conventional commit format
31
+
32
+ ## Best Practices for Commits
33
+
34
+ - **Verify before committing**: Ensure code is linted, builds correctly, and documentation is updated
35
+ - **Atomic commits**: Each commit should contain related changes that serve a single purpose
36
+ - **Split large changes**: If changes touch multiple concerns, split them into separate commits
37
+ - **Conventional commit format**: Use the format <type>: <description> where type is one of:
38
+ - feat: A new feature
39
+ - fix: A bug fix
40
+ - docs: Documentation changes
41
+ - style: Code style changes (formatting, etc)
42
+ - refactor: Code changes that neither fix bugs nor add features
43
+ - perf: Performance improvements
44
+ - test: Adding or fixing tests
45
+ - chore: Changes to the build process, tools, etc.
46
+ - **Present tense, imperative mood**: Write commit messages as commands (e.g., "add feature" not "added feature")
47
+ - **Concise first line**: Keep the first line under 72 characters
48
+ - **Emoji**: Each commit type is paired with an appropriate emoji:
49
+ - ✨ feat: New feature
50
+ - 🐛 fix: Bug fix
51
+ - 📝 docs: Documentation
52
+ - 💄 style: Formatting/style
53
+ - ♻️ refactor: Code refactoring
54
+ - ⚡️ perf: Performance improvements
55
+ - ✅ test: Tests
56
+ - 🔧 chore: Tooling, configuration
57
+ - 🚀 ci: CI/CD improvements
58
+ - 🗑️ revert: Reverting changes
59
+ - 🧪 test: Add a failing test
60
+ - 🚨 fix: Fix compiler/linter warnings
61
+ - 🔒️ fix: Fix security issues
62
+ - 👥 chore: Add or update contributors
63
+ - 🚚 refactor: Move or rename resources
64
+ - 🏗️ refactor: Make architectural changes
65
+ - 🔀 chore: Merge branches
66
+ - 📦️ chore: Add or update compiled files or packages
67
+ - ➕ chore: Add a dependency
68
+ - ➖ chore: Remove a dependency
69
+ - 🌱 chore: Add or update seed files
70
+ - 🧑‍💻 chore: Improve developer experience
71
+ - 🧵 feat: Add or update code related to multithreading or concurrency
72
+ - 🔍️ feat: Improve SEO
73
+ - 🏷️ feat: Add or update types
74
+ - 💬 feat: Add or update text and literals
75
+ - 🌐 feat: Internationalization and localization
76
+ - 👔 feat: Add or update business logic
77
+ - 📱 feat: Work on responsive design
78
+ - 🚸 feat: Improve user experience / usability
79
+ - 🩹 fix: Simple fix for a non-critical issue
80
+ - 🥅 fix: Catch errors
81
+ - 👽️ fix: Update code due to external API changes
82
+ - 🔥 fix: Remove code or files
83
+ - 🎨 style: Improve structure/format of the code
84
+ - 🚑️ fix: Critical hotfix
85
+ - 🎉 chore: Begin a project
86
+ - 🔖 chore: Release/Version tags
87
+ - 🚧 wip: Work in progress
88
+ - 💚 fix: Fix CI build
89
+ - 📌 chore: Pin dependencies to specific versions
90
+ - 👷 ci: Add or update CI build system
91
+ - 📈 feat: Add or update analytics or tracking code
92
+ - ✏️ fix: Fix typos
93
+ - ⏪️ revert: Revert changes
94
+ - 📄 chore: Add or update license
95
+ - 💥 feat: Introduce breaking changes
96
+ - 🍱 assets: Add or update assets
97
+ - ♿️ feat: Improve accessibility
98
+ - 💡 docs: Add or update comments in source code
99
+ - 🗃️ db: Perform database related changes
100
+ - 🔊 feat: Add or update logs
101
+ - 🔇 fix: Remove logs
102
+ - 🤡 test: Mock things
103
+ - 🥚 feat: Add or update an easter egg
104
+ - 🙈 chore: Add or update .gitignore file
105
+ - 📸 test: Add or update snapshots
106
+ - ⚗️ experiment: Perform experiments
107
+ - 🚩 feat: Add, update, or remove feature flags
108
+ - 💫 ui: Add or update animations and transitions
109
+ - ⚰️ refactor: Remove dead code
110
+ - 🦺 feat: Add or update code related to validation
111
+ - ✈️ feat: Improve offline support
112
+
113
+ ## Guidelines for Splitting Commits
114
+
115
+ When analyzing the diff, consider splitting commits based on these criteria:
116
+
117
+ 1. **Different concerns**: Changes to unrelated parts of the codebase
118
+ 2. **Different types of changes**: Mixing features, fixes, refactoring, etc.
119
+ 3. **File patterns**: Changes to different types of files (e.g., source code vs documentation)
120
+ 4. **Logical grouping**: Changes that would be easier to understand or review separately
121
+ 5. **Size**: Very large changes that would be clearer if broken down
122
+
123
+ ## Examples
124
+
125
+ Good commit messages:
126
+ - ✨ feat: add user authentication system
127
+ - 🐛 fix: resolve memory leak in rendering process
128
+ - 📝 docs: update API documentation with new endpoints
129
+ - ♻️ refactor: simplify error handling logic in parser
130
+ - 🚨 fix: resolve linter warnings in component files
131
+ - 🧑‍💻 chore: improve developer tooling setup process
132
+ - 👔 feat: implement business logic for transaction validation
133
+ - 🩹 fix: address minor styling inconsistency in header
134
+ - 🚑️ fix: patch critical security vulnerability in auth flow
135
+ - 🎨 style: reorganize component structure for better readability
136
+ - 🔥 fix: remove deprecated legacy code
137
+ - 🦺 feat: add input validation for user registration form
138
+ - 💚 fix: resolve failing CI pipeline tests
139
+ - 📈 feat: implement analytics tracking for user engagement
140
+ - 🔒️ fix: strengthen authentication password requirements
141
+ - ♿️ feat: improve form accessibility for screen readers
142
+
143
+ Example of splitting commits:
144
+ - First commit: ✨ feat: add new solc version type definitions
145
+ - Second commit: 📝 docs: update documentation for new solc versions
146
+ - Third commit: 🔧 chore: update package.json dependencies
147
+ - Fourth commit: 🏷️ feat: add type definitions for new API endpoints
148
+ - Fifth commit: 🧵 feat: improve concurrency handling in worker threads
149
+ - Sixth commit: 🚨 fix: resolve linting issues in new code
150
+ - Seventh commit: ✅ test: add unit tests for new solc version features
151
+ - Eighth commit: 🔒️ fix: update dependencies with security vulnerabilities
152
+
153
+ ## Command Options
154
+
155
+ - --no-verify: Skip running the pre-commit checks (lint, build, generate:docs)
156
+
157
+ ## Important Notes
158
+
159
+ - By default, pre-commit checks (pnpm lint, pnpm build, pnpm generate:docs) will run to ensure code quality
160
+ - If these checks fail, you'll be asked if you want to proceed with the commit anyway or fix the issues first
161
+ - If specific files are already staged, the command will only commit those files
162
+ - If no files are staged, it will automatically stage all modified and new files
163
+ - The commit message will be constructed based on the changes detected
164
+ - Before committing, the command will review the diff to identify if multiple commits would be more appropriate
165
+ - If suggesting multiple commits, it will help you stage and commit the changes separately
166
+ - Always reviews the commit diff to ensure the message matches the changes
@@ -1,220 +1,221 @@
1
- # Apply MORPH Feature Implementation - FASE 5
1
+ ---
2
+ description: Implement the specified feature following the task breakdown from the MORPH-SPEC workflow. Orchestrates task execution with state tracking, checkpoints, agent dispatch, and verification.
3
+ argument-hint: <feature-name>
4
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
5
+ ---
2
6
 
3
- Implemente a feature especificada seguindo as tasks definidas.
7
+ # /morph-apply Feature Implementation
4
8
 
5
- ## Uso
9
+ Implement the feature by executing its task breakdown, tracking progress through the morph-spec state machine, and producing a recap at the end.
10
+
11
+ ## Usage
6
12
 
7
13
  ```
8
14
  /morph-apply {feature-name}
9
15
  ```
10
16
 
11
- ## Pré-requisitos
17
+ ## Recommended Tools
18
+
19
+ > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
20
+ > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for MCP reference.
21
+
22
+ | Action | Tool | Alternative |
23
+ |--------|------|-------------|
24
+ | Read spec, tasks, contracts | **Read** all outputs | — |
25
+ | Detect architecture style | **Bash** `cat .morph/config/config.json \| grep architecture` | — |
26
+ | Agent dispatch config | **Bash** `npx morph-spec dispatch-agents $ARGUMENTS implement` | — |
27
+ | Parallel task execution | **Agent** subagent per task group | Sequential fallback |
28
+ | Look up implementation patterns | **Context7 MCP** `query_docs()` | **WebSearch** |
29
+ | Track progress | **Bash** `npx morph-spec state get $ARGUMENTS` | — |
30
+
31
+ ---
12
32
 
13
- ### CRÍTICO: Validar Fases Anteriores
33
+ ## Pre-flight Validation
14
34
 
15
- **SEMPRE verifique que fases anteriores foram concluídas:**
35
+ Before writing any code, verify all prior phases are complete. This gate prevents implementation from starting with missing specs, unapproved designs, or incomplete task breakdowns.
36
+
37
+ ### 1. Check state and approvals
16
38
 
17
39
  ```bash
18
- # Obter estado da feature
19
- npx morph-spec state get {feature-name}
40
+ npx morph-spec state get $ARGUMENTS
41
+ npx morph-spec approval-status $ARGUMENTS
42
+ npx morph-spec validate-feature $ARGUMENTS
20
43
  ```
21
44
 
22
- **Validações obrigatórias:**
45
+ **All three must pass.** If any fails:
23
46
 
24
- 1. **FASE 0 (Proposal):**
25
- - [ ] Output `proposal` criado
26
- - [ ] Agentes detectados e registrados
47
+ ```
48
+ Feature is not ready for implementation.
49
+ Run /morph-proposal $ARGUMENTS to complete planning phases.
50
+ (Resumes automatically from the current phase.)
51
+ ```
27
52
 
28
- 2. **FASE 1 (Setup):**
29
- - [ ] Phase passou por "setup"
30
- - [ ] Contexto carregado
53
+ Do NOT proceed until all phases are complete and all gates approved.
31
54
 
32
- 3. **FASE 1.5 (UI/UX) - SE APLICÁVEL:**
33
- - [ ] Se `uiux-designer` está nos activeAgents → outputs ui-* devem existir
34
- - [ ] Se NÃO tem uiux-designer → pode pular
55
+ ### 2. Load context in PARALLEL
35
56
 
36
- 4. **FASE 2 (Design):**
37
- - [ ] Output `spec` criado
38
- - [ ] Output `contracts` criado
39
- - [ ] Output `decisions` criado
57
+ Read all prerequisite files in a single parallel call — every file listed here matters for implementation quality:
40
58
 
41
- 5. **FASE 3 (Clarify):**
42
- - [ ] Phase passou por "clarify"
43
- - [ ] Spec atualizado com clarificações
59
+ ```
60
+ Read: .morph/features/$ARGUMENTS/1-design/spec.md (→ functional requirements, API contracts)
61
+ + Read: .morph/features/$ARGUMENTS/1-design/contracts.cs (or contracts.ts / contracts-vsa.cs C# interfaces)
62
+ + Read: .morph/features/$ARGUMENTS/1-design/decisions.md (→ ADRs, architectural choices)
63
+ + Read: .morph/features/$ARGUMENTS/3-plan/plan.md (→ TDD structure, execution strategy)
64
+ + Read: .morph/features/$ARGUMENTS/4-tasks/tasks.md (→ task breakdown with T### IDs)
65
+ + Read: .morph/config/config.json (→ architecture.style for VSA routing)
66
+ ```
44
67
 
45
- 6. **FASE 4 (Tasks):**
46
- - [ ] Output `tasks` criado
47
- - [ ] `tasks.json` tem array de tasks
48
- - [ ] `tasks.total` > 0 no state
68
+ **For VSA projects** (`architecture.style: "vertical-slice"`), also read:
69
+ ```
70
+ Read: framework/standards/architecture/vertical-slice/vertical-slice.md
71
+ ```
72
+ This contains the 9 VSA implementation rules (Handler+Validator+Endpoint per feature folder, no cross-feature imports, etc.).
73
+
74
+ Also read relevant standards:
75
+ - `framework/standards/` — coding standards for the detected stack
76
+ - `.morph/context/` — project-specific patterns and conventions
77
+
78
+ ### 3. Detect architecture style
49
79
 
50
- **Se QUALQUER validação falhar:**
80
+ ```bash
81
+ cat .morph/config/config.json | grep -A3 '"architecture"'
51
82
  ```
52
- ❌ ERRO: Fase {X} não foi concluída!
53
83
 
54
- Para completar as fases de planejamento, execute:
55
- /morph-proposal {feature-name}
56
- (Resume automaticamente da fase atual: {current_phase})
84
+ - **`"vertical-slice"`** follow VSA implementation patterns from `framework/standards/architecture/vertical-slice/vertical-slice.md`. Each task is a complete slice (Handler + Validator + Endpoint in one folder).
85
+ - **Otherwise** → follow DDD/Clean Architecture patterns. Tasks map to domain layers.
86
+
87
+ ### 4. Get agent dispatch config
88
+
89
+ ```bash
90
+ npx morph-spec dispatch-agents $ARGUMENTS implement --table
57
91
  ```
58
92
 
59
- **NÃO prossiga com implementação até todas as fases estarem completas!**
93
+ This shows which agents are active for implementation and how tasks can be grouped. If agent teams are enabled and tasks have no dependencies between groups, consider dispatching parallel agents:
94
+
95
+ ```bash
96
+ npx morph-spec dispatch-agents $ARGUMENTS implement
97
+ ```
60
98
 
61
- ### Arquivos Necessários
99
+ The JSON output includes `shouldDispatch`, `agents[]`, and `taskGroups` for multi-agent coordination.
62
100
 
63
- - [ ] Feature existe em `.morph/features/{feature}/`
64
- - [ ] `spec.md` está aprovado
65
- - [ ] `tasks.json` tem tasks definidas
66
- - [ ] `contracts.cs` define as interfaces
101
+ ---
67
102
 
68
103
  ## Workflow
69
104
 
70
- 1. **Carregue o contexto**:
71
- - Leia `.morph/features/{feature}/1-design/spec.md`
72
- - Leia `.morph/features/{feature}/3-tasks/tasks.md`
73
- - Leia `.morph/features/{feature}/1-design/contracts.cs`
74
- - Leia framework/standards/ e .morph/context/ para padrões
75
-
76
- 2. **Inicialize state tracking**:
77
- ```bash
78
- # Atualizar fase para implement
79
- npx morph-spec state set {feature} phase implement
80
- npx morph-spec state set {feature} status in_progress
81
-
82
- # Definir total de tasks (baseado em tasks.json)
83
- npx morph-spec state set {feature} tasks.total {N}
84
- ```
85
-
86
- 3. **Execute tasks em ordem**:
87
- - Marque task como in progress: `npx morph-spec task start {feature} {task-id}`
88
- - Implemente seguindo os padrões e contracts.cs
89
- - Complete task: `npx morph-spec task done {feature} {task-id}`
90
- - **Validators run automatically** on task-done. If validation fails:
91
- - Read the error messages and fix violations
92
- - Re-run `task done` — do NOT use `--skip-validation` unless user authorizes
93
- - Framework auto-manages checkpoints (every 3 tasks, includes validation summary)
94
-
95
- 4. **Phase advancement**:
96
- ```bash
97
- # Advance to next phase (validates → advances → shows next steps)
98
- npx morph-spec phase advance {feature}
99
- ```
100
-
101
- 5. **Marcar outputs criados**:
102
- Sempre que gerar um arquivo de output:
103
- ```bash
104
- npx morph-spec state mark-output {feature} spec
105
- npx morph-spec state mark-output {feature} contracts
106
- npx morph-spec state mark-output {feature} tasks
107
- # etc.
108
- ```
109
-
110
- 6. **Ao finalizar**:
111
- - Generate recap automatically: `npx morph-spec generate recap {feature}`
112
- - Atualize state: `npx morph-spec state set {feature} status done`
113
- - Marque recap: `npx morph-spec state mark-output {feature} recap`
114
- - Liste arquivos criados/modificados
115
- - Calcule custo real vs estimado
116
-
117
- ## Padrões Obrigatórios
118
-
119
- Siga sempre (priorize context/ se houver):
120
- - `framework/standards/coding.md` - Padrões base do MORPH
121
- - `.morph/context/coding.md` - Padrões específicos do projeto
122
- - `.morph/context/architecture.md` - Estrutura de projeto
123
- - `.morph/context/azure.md` - Recursos e custos
105
+ ### Step 1: Advance to implement phase
124
106
 
125
- ---
107
+ ```bash
108
+ npx morph-spec phase advance $ARGUMENTS
109
+ ```
110
+
111
+ This validates phase eligibility and emits a SKILL DISPATCH block listing required skills for implementation (verification-before-completion, morph-checklist, etc.).
126
112
 
127
- ## Checklist Pré-Deploy Azure
113
+ ### Step 2: Initialize state tracking
114
+
115
+ ```bash
116
+ npx morph-spec state set $ARGUMENTS tasks.total {N}
117
+ ```
128
118
 
129
- **ANTES de fazer deploy para Azure, execute `/morph-preflight azure` ou verifique manualmente:**
119
+ Where `{N}` is the number of tasks in tasks.md (e.g., 6 for T001-T006).
130
120
 
131
- ### Packages e Build
121
+ ### Step 3: Execute tasks in order
132
122
 
133
- - [ ] Packages sem conflitos de versão (`dotnet restore` sem warnings NU1605/NU1608)
134
- - [ ] `Azure.Identity` especificado explicitamente no `.csproj`
135
- - [ ] Build passa sem erros (`dotnet build`)
123
+ For each task in the breakdown, follow this cycle:
136
124
 
137
- ### EF Core Migrations
125
+ ```bash
126
+ # 1. Start the task (activates task-tracking guard)
127
+ npx morph-spec task start $ARGUMENTS {task-id}
138
128
 
139
- - [ ] Sem pending model changes (`dotnet ef migrations has-pending-model-changes`)
140
- - [ ] Migration criada para todas as mudanças de schema
141
- - [ ] Migration script revisado (`dotnet ef migrations script --idempotent`)
129
+ # 2. Implement the task
130
+ # - Follow spec.md and contracts
131
+ # - Follow coding standards from framework/standards/ and .morph/context/
132
+ # - For VSA: create all slice files in one folder (Handler + Validator + Endpoint)
133
+ # - For DDD: implement in the correct domain layer
142
134
 
143
- ### Blazor .NET 10 (se aplicável)
135
+ # 3. Verify before completing — run validate-feature or check your work
136
+ # matches the spec and contracts before marking done
144
137
 
145
- - [ ] `.csproj` contém `<RequiresAspNetWebAssets>true</RequiresAspNetWebAssets>`
146
- - [ ] Static assets funcionando localmente
138
+ # 4. Complete the task (triggers Tier-4 validators automatically)
139
+ npx morph-spec task done $ARGUMENTS {task-id}
140
+ ```
147
141
 
148
- ### Container/Docker (se Container Apps)
142
+ **If validation fails on `task done`:**
143
+ - Read the error messages carefully
144
+ - Fix the violations in your code
145
+ - Re-run `task done` — do NOT use `--skip-validation` unless the user explicitly authorizes it
146
+ - After 3 consecutive failures, escalate to the user
149
147
 
150
- - [ ] Dockerfile válido e testado localmente
151
- - [ ] `docker build` funciona sem erros
152
- - [ ] Container roda localmente (`docker run`)
148
+ **Parallel execution (agent teams):**
149
+ If `dispatch-agents` identified parallelizable task groups and agent teams are enabled, dispatch independent tasks to separate agents. Each agent still calls `task start` and `task done` for its assigned task.
153
150
 
154
- ### Infraestrutura Azure
151
+ ### Step 4: Checkpoint every 3 tasks
155
152
 
156
- - [ ] Bicep sem erros de sintaxe (`az bicep build`)
157
- - [ ] Key Vault URI configurado em `appsettings.Production.json`
158
- - [ ] Connection strings em Key Vault (não hardcoded)
159
- - [ ] Managed Identity habilitada nos recursos
153
+ After every 3 completed tasks, save a checkpoint:
160
154
 
161
- ### Segurança
155
+ ```bash
156
+ npx morph-spec checkpoint-save $ARGUMENTS "after-T003"
157
+ npx morph-spec state get $ARGUMENTS
158
+ ```
162
159
 
163
- - [ ] Sem secrets em código ou `appsettings.json` (exceto Development)
164
- - [ ] HTTPS enforçado
165
- - [ ] CORS configurado corretamente
160
+ Checkpoints validate architecture compliance, check package versions, scan for security issues, and save a restorable snapshot. The cadence is every 3 tasks — for 6 tasks: checkpoint after T003 and T006. For 10 tasks: after T003, T006, T009, and at completion.
166
161
 
167
- ### Comandos de Verificação
162
+ After each checkpoint, check progress:
168
163
 
169
164
  ```bash
170
- # 1. Package conflicts
171
- dotnet restore 2>&1 | grep -E "NU1605|NU1608"
165
+ npx morph-spec state list
166
+ ```
172
167
 
173
- # 2. Pending migrations
174
- dotnet ef migrations has-pending-model-changes \
175
- --project src/Infrastructure \
176
- --startup-project src/Web
168
+ ### Step 5: Finalize implementation
177
169
 
178
- # 3. Bicep validation
179
- az bicep build --file infra/main.bicep --stdout > /dev/null
170
+ After all tasks are complete:
180
171
 
181
- # 4. Docker build
182
- docker build -t myapp:test .
172
+ ```bash
173
+ # Final validation
174
+ npx morph-spec validate-feature $ARGUMENTS
183
175
 
184
- # 5. Secret scan (basic)
185
- grep -rE "(Password=|Pwd=|Secret=)" appsettings*.json | grep -v Development
186
- ```
176
+ # Generate recap (auto-marks 'recap' output in state)
177
+ npx morph-spec generate recap $ARGUMENTS
187
178
 
188
- ### Se QUALQUER item falhar
179
+ # Verify final state
180
+ npx morph-spec state get $ARGUMENTS
189
181
 
182
+ # Advance to next phase
183
+ npx morph-spec phase advance $ARGUMENTS
190
184
  ```
191
- ❌ BLOQUEADO: Não faça deploy até resolver!
192
185
 
193
- Use /morph-preflight azure para diagnóstico detalhado.
194
- ```
186
+ ### Step 6: Post-implementation review
195
187
 
196
- ## Validações
188
+ After implementation, present a summary to the user:
197
189
 
198
- Antes de marcar task como completa:
199
- - [ ] Código compila
200
- - [ ] Segue padrões de nomenclatura
201
- - [ ] Testes unitários (se aplicável)
202
- - [ ] Sem hardcoded secrets
190
+ 1. Total tasks completed (X/Y)
191
+ 2. Files created/modified
192
+ 3. Validation results
193
+ 4. Any deviations from spec
203
194
 
204
- ## Output
195
+ For Azure projects, remind the user: "Run `/morph-preflight` before deploying to validate packages, migrations, Docker, and secrets."
205
196
 
206
- Ao final de cada task, mostre:
207
- 1. Task completada
208
- 2. Arquivos criados/modificados
209
- 3. Próxima task
210
- 4. Progresso geral (X/Y tasks) - usar `npx morph-spec state get {feature}`
197
+ ---
211
198
 
212
- Ao final de cada checkpoint:
213
- ```bash
214
- npx morph-spec state list
199
+ ## Task Output Format
200
+
201
+ After each task completion, show:
202
+
203
+ ```
204
+ Task {task-id} complete (X/Y tasks done)
205
+ Files: [list of created/modified files]
206
+ Next: {next-task-id} — {next-task-title}
215
207
  ```
216
208
 
217
- Isso mostra o progresso atualizado automaticamente.
209
+ ---
210
+
211
+ ## Anti-patterns
212
+
213
+ - Using `state set phase` instead of `phase advance` — phase advance validates eligibility first
214
+ - Skipping `task start` before implementing — the task-tracking guard will warn
215
+ - Using `--skip-validation` without user authorization
216
+ - Implementing without reading spec.md and contracts first
217
+ - Writing code before `phase advance` to implement — the hook will block writes
218
+ - Skipping checkpoints — they catch integration issues early
218
219
 
219
220
  ---
220
221
 
@@ -1,45 +1,51 @@
1
+ ---
2
+ description: Archive a completed feature by moving from features/ to archive/ and updating state
3
+ argument-hint: <feature-name>
4
+ allowed-tools: Read, Write, Edit, Bash
5
+ ---
6
+
1
7
  # Archive MORPH Feature
2
8
 
3
- Arquive uma feature concluída, movendo-a de `features/` para `archive/`.
9
+ Archive a completed feature, moving it from `features/` to `archive/`.
4
10
 
5
- ## Pré-requisitos
11
+ ## Prerequisites
6
12
 
7
- Verifique antes de arquivar:
8
- - [ ] Feature existe em `.morph/features/{feature}/`
9
- - [ ] Todas as tasks estão completas
10
- - [ ] `recap.md` está preenchido
11
- - [ ] Código está em produção (ou staging)
13
+ Verify before archiving:
14
+ - [ ] Feature exists in `.morph/features/{feature}/`
15
+ - [ ] All tasks are complete
16
+ - [ ] `recap.md` is filled in
17
+ - [ ] Code is in production (or staging)
12
18
 
13
19
  ## Workflow
14
20
 
15
- 1. **Valide a conclusão**:
16
- - Leia `.morph/features/{feature}/3-tasks/tasks.md`
17
- - Verifique que todas tasks estão completadas
18
- - Confirme com o usuário se pode arquivar
21
+ 1. **Validate completion**:
22
+ - Read `.morph/features/{feature}/4-tasks/tasks.md`
23
+ - Verify all tasks are completed
24
+ - Confirm with user before archiving
19
25
 
20
- 2. **Complete o recap**:
21
- - Atualize `.morph/features/{feature}/4-implement/recap.md`
22
- - Preencha métricas finais
23
- - Documente lições aprendidas
26
+ 2. **Complete the recap**:
27
+ - Update `.morph/features/{feature}/5-implement/recap.md`
28
+ - Fill in final metrics
29
+ - Document lessons learned
24
30
 
25
- 3. **Extraia specs**:
26
- - Se a feature define comportamento permanente
27
- - Copie spec relevante para `.morph/specs/`
28
- - Isso vira a "verdade atual" do sistema
31
+ 3. **Extract specs**:
32
+ - If the feature defines permanent behavior
33
+ - Copy relevant spec to `.morph/specs/`
34
+ - This becomes the "current truth" of the system
29
35
 
30
- 4. **Mova para archive**:
36
+ 4. **Move to archive**:
31
37
  ```
32
38
  .morph/features/{feature}/ → .morph/archive/{feature}/
33
39
  ```
34
40
 
35
- 5. **Atualize métricas do projeto**:
36
- - Incremente contador de features
37
- - Atualize custo total
38
- - Atualize tempo total
41
+ 5. **Update project metrics**:
42
+ - Increment feature counter
43
+ - Update total cost
44
+ - Update total time
39
45
 
40
46
  ## Output
41
47
 
42
- Apresente resumo do arquivamento:
48
+ Present archival summary:
43
49
 
44
50
  ```
45
51
  ╔════════════════════════════════════════════╗
@@ -66,9 +72,9 @@ Apresente resumo do arquivamento:
66
72
  ╚════════════════════════════════════════════╝
67
73
  ```
68
74
 
69
- ## Specs Extraídas
75
+ ## Extracted Specs
70
76
 
71
- Se houver specs extraídas:
77
+ If specs were extracted:
72
78
  ```
73
79
  Specs extracted to .morph/specs/:
74
80
  - {domain}/spec.md - {description}