@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,312 @@
1
+ ---
2
+ name: morph:phase-tasks
3
+ description: MORPH-SPEC Phase 4 (Tasks). Breaks approved spec into bottom-up ordered implementation tasks (T001...TXXX) with dependencies, checkpoints every 3 tasks, and effort estimates, producing tasks.md. Use after design and clarification phases to create a structured implementation plan before coding starts.
4
+ argument-hint: "[feature-name]"
5
+ disable-model-invocation: true
6
+ user-invocable: false
7
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
8
+ cliVersion: "4.10.1"
9
+ ---
10
+
11
+ # MORPH Tasks — Phase 4
12
+
13
+ > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
14
+
15
+ Break the approved specification into executable tasks, define execution order, and establish checkpoints.
16
+
17
+ ## Prerequisites
18
+
19
+ - [ ] Phase 3 (Clarify) completed
20
+ - [ ] `spec.md` updated with clarifications
21
+ - [ ] All edge cases documented
22
+
23
+ ## Recommended Tools
24
+
25
+ > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
26
+ > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for MCP reference.
27
+ > **Example:** `references/tasks-example.md` — filled-in tasks.md showing expected granularity and format.
28
+ > **Script:** `scripts/validate-tasks.mjs` — validates tasks.md structure, T### IDs, and required fields.
29
+
30
+ | Action | Tool | Alternative |
31
+ |--------|------|-------------|
32
+ | Read spec + contracts + decisions | **Read** all outputs | — |
33
+ | Analyze implementation complexity | **Grep** patterns in existing code | — |
34
+ | Count similar existing patterns | **Glob** `**/Services/**/*.cs` | — |
35
+ | Look up implementation patterns | **Context7 MCP** `query_docs()` | **WebSearch** |
36
+ | Create GitHub issues from tasks | **GitHub MCP** `create_issue()` | **Bash** `gh issue create ...` |
37
+ | Render tasks template | **Bash** `npx morph-spec template render docs/tasks ...` | — |
38
+ | Update state with task count | **Bash** `npx morph-spec state set ... tasks.total N` | — |
39
+
40
+ **Phase MCPs:** Context7 (estimate complexity), GitHub (create issues).
41
+
42
+ **Anti-patterns:**
43
+ - Task agent to break down a simple single-domain spec (do it directly)
44
+ - Creating tasks without reading all design outputs first
45
+ - **(VSA)** Creating separate tasks for Handler, Validator, and Endpoint — one slice = one task
46
+ - **(VSA)** Using DDD categories (`domain`, `application`, `infrastructure`) in VSA projects — use VSA categories: `entity`, `errors`, `tags`, `migration`, `slice`, `frontend`, `tests`
47
+ - **(VSA)** Creating a "Implement Service layer" task — there is no Service layer in VSA
48
+ - Using vague effort labels ("Low", "Medium", "S/M") — always use specific minute estimates
49
+ - Using non-standard task IDs (TASK-001, T01) — always use **T001** format (T + 3 digits)
50
+
51
+ ---
52
+
53
+ ## Pre-flight (before starting task breakdown)
54
+
55
+ ### 0. Ensure tasks phase
56
+
57
+ ```bash
58
+ npx morph-spec state get $ARGUMENTS
59
+ ```
60
+
61
+ Check the `"phase"` field:
62
+
63
+ **If `"phase": "tasks"`** → correct phase, proceed.
64
+
65
+ **If `"phase": "clarify"`** → run in sequence:
66
+ 1. `npx morph-spec state mark-output $ARGUMENTS clarifications`
67
+ 2. `npx morph-spec phase advance $ARGUMENTS` (→ tasks)
68
+
69
+ **Any other value** → STOP — inconsistent state, report to user.
70
+
71
+ > **Rule:** Never write to `4-tasks/` until the phase is `tasks`. The hook will block writes.
72
+
73
+ ---
74
+
75
+ ### 1. Read all prerequisites in PARALLEL
76
+
77
+ ```
78
+ # Single parallel call, not sequential:
79
+ Read: .morph/features/{feature}/1-design/spec.md
80
+ + Read: .morph/features/{feature}/1-design/contracts.cs (or contracts.ts for TypeScript projects)
81
+ + Read: .morph/features/{feature}/1-design/decisions.md
82
+ + Read: .morph/features/{feature}/1-design/schema-analysis.md (if exists)
83
+ + Read: .morph/config/config.json (→ architecture.style)
84
+ ```
85
+
86
+ ### 2. Create session tasks for visibility
87
+
88
+ ```
89
+ TaskCreate: "Analyze spec and define tasks" → activeForm: "Analyzing spec"
90
+ TaskCreate: "Generate tasks.md" → activeForm: "Generating tasks.md"
91
+ TaskCreate: "Phase advance" → activeForm: "Advancing phase"
92
+ ```
93
+
94
+ > **Note:** Individual T001-T00N tasks are created as native tasks during the implementation phase (`phase-implement`). Here we only keep the 3 high-level tasks for this planning session.
95
+
96
+ ---
97
+
98
+ ### 3. Entry checkpoint — verify prerequisites
99
+
100
+ Before starting the breakdown:
101
+
102
+ - [ ] `spec.md` exists and approved by user?
103
+ - [ ] `contracts.cs`/`.ts` exists and matches real schema?
104
+ - [ ] `schema-analysis.md` validated (if applicable)?
105
+ - [ ] `decisions.md` contains ADRs for all critical choices?
106
+ - [ ] Design gate (`morph-spec approve $ARGUMENTS design`) approved?
107
+ - [ ] Clarifications (Phase 3) resolved and spec updated?
108
+
109
+ If any checkbox is NOT checked → return to corresponding phase and resolve.
110
+
111
+ ```bash
112
+ npx morph-spec state get $ARGUMENTS
113
+ npx morph-spec approval-status $ARGUMENTS
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Workflow
119
+
120
+ ### Step 0: Detect Architecture Style
121
+
122
+ Before anything else, determine if the project is VSA or DDD:
123
+
124
+ ```bash
125
+ cat .morph/config/config.json | grep -A3 '"architecture"'
126
+ ```
127
+
128
+ **If `config.architecture.style === "vertical-slice"`** → follow **Step 0.5 (VSA)** and skip DDD path.
129
+ **Otherwise** → follow **Step 0.6 (DDD)** below.
130
+
131
+ ---
132
+
133
+ ### Step 0.5: VSA Task Plan
134
+
135
+ > For VSA task patterns and DDD-level mappings, see `references/task-planning-patterns.md`
136
+
137
+ Read the `## Architecture Style: Vertical Slice` section from spec.md for the **VSA Blueprint**:
138
+
139
+ ```bash
140
+ grep -A30 "## Architecture Style" ".morph/features/$ARGUMENTS/1-design/spec.md"
141
+ ```
142
+
143
+ Create one task per slice following this order: entity → errors → tags → migration → CRUD slices → custom slices → frontend → tests. Each slice = Handler + Validator + Endpoint in a **single task**. `GetAll` operations do NOT have a Validator (no input parameters to validate).
144
+
145
+ Use VSA-specific categories: `entity`, `errors`, `tags`, `migration`, `slice`, `frontend`, `tests`.
146
+
147
+ **After defining VSA tasks, skip directly to Step 3 (Dependencies).**
148
+
149
+ ---
150
+
151
+ ### Step 0.6: Read Domain Level — DDD
152
+
153
+ Read the `## Domain Complexity` section from spec.md:
154
+
155
+ ```bash
156
+ grep -A15 "## Domain Complexity" ".morph/features/$ARGUMENTS/1-design/spec.md"
157
+ ```
158
+
159
+ > If the section doesn't exist, assume **Level 1 (CRUD)**.
160
+
161
+ Use the level to constrain categories:
162
+ - **Level 1**: domain → infrastructure → application → presentation → tests
163
+ - **Level 2**: adds AggregateRoot, ValueObjects, DomainEvents, CQRS handlers
164
+ - **Level 3**: adds BC setup, Integration Events
165
+
166
+ See `references/task-planning-patterns.md` for the complete table.
167
+
168
+ ---
169
+
170
+ ### Step 1: Analyze Spec
171
+
172
+ > **VSA:** If coming from Step 0.5, the task breakdown was already defined — use the generated examples as a base and skip to Step 3 (Dependencies).
173
+
174
+ Read `.morph/features/$ARGUMENTS/1-design/spec.md` and identify:
175
+
176
+ 1. **Functional requirements** (FR001, FR002, ...)
177
+ 2. **Technical components** (Entities, Services/Slices, Controllers/Endpoints, Pages)
178
+ 3. **Infrastructure** (Bicep, migrations, configs)
179
+ 4. **Tests** (Unit tests, integration tests)
180
+
181
+ ### Step 2: Break Into Tasks
182
+
183
+ > For structure, categories, and implementation order, see `references/task-planning-patterns.md`
184
+
185
+ Create tasks using the **T{NNN}** format (T001, T002, ...) following bottom-up order: domain → infrastructure → application → presentation → tests → infra → docs.
186
+
187
+ The T### format is mandatory — it is used by `morph-spec task start/done` commands and the validate-tasks script. Do not use TASK-001, T01, or other formats.
188
+
189
+ ### Step 3: Define Dependencies
190
+
191
+ For each task, specify dependencies:
192
+
193
+ ```json
194
+ {
195
+ "id": "T005",
196
+ "title": "Create {Name}Service",
197
+ "dependencies": ["T001", "T002"],
198
+ "status": "pending"
199
+ }
200
+ ```
201
+
202
+ **Rule:** A task can only be executed when all its dependencies are `completed`.
203
+
204
+ ### Step 4: Establish Checkpoints
205
+
206
+ Define checkpoints after every **3 tasks** — this cadence matches the implementation phase's checkpoint-save frequency. Regular checkpoints catch integration issues early rather than at the end.
207
+
208
+ ```json
209
+ {
210
+ "id": "CHECKPOINT_001",
211
+ "title": "Domain Layer Complete",
212
+ "afterTasks": ["T001", "T002", "T003"],
213
+ "validations": [
214
+ "All entities created",
215
+ "Migrations applied",
216
+ "Domain tests passing"
217
+ ]
218
+ }
219
+ ```
220
+
221
+ ### Step 5: Estimate Effort
222
+
223
+ For each task, estimate time **in minutes** (not vague labels like "Low/Medium"). Specific estimates help the plan phase determine execution strategy and parallelization.
224
+
225
+ | Complexity | Estimated Time |
226
+ |------------|----------------|
227
+ | Trivial (basic CRUD) | 15-30 min |
228
+ | Simple (Service, Controller) | 30-60 min |
229
+ | Medium (Business logic, validations) | 60-120 min |
230
+ | Complex (Integrations, AI) | 120-240 min |
231
+
232
+ ### Step 6: Generate `tasks.md`
233
+
234
+ Create `.morph/features/$ARGUMENTS/4-tasks/tasks.md` with the complete task structure, checkpoints, and estimates.
235
+
236
+ ### Step 7: Include IaC Tasks (if needed)
237
+
238
+ If there are Azure resources, add Bicep and migration tasks.
239
+
240
+ ### Step 8: Update State
241
+
242
+ ```bash
243
+ npx morph-spec state set $ARGUMENTS tasks.total {N}
244
+ npx morph-spec state mark-output $ARGUMENTS tasks
245
+ ```
246
+
247
+ ## Outputs
248
+
249
+ - `.morph/features/$ARGUMENTS/4-tasks/tasks.md` — Complete task breakdown
250
+
251
+ ## Mandatory Approval Pause
252
+
253
+ Use `AskUserQuestion` to capture explicit approval before advancing. This gate prevents implementation from starting with an unapproved task list.
254
+
255
+ ```json
256
+ {
257
+ "questions": [{
258
+ "header": "Approval",
259
+ "question": "Tasks generated. Approve to start implementation?",
260
+ "multiSelect": false,
261
+ "options": [
262
+ { "label": "Approve and implement", "description": "Advance to implementation phase" },
263
+ { "label": "I have feedback", "description": "Type what you want to change" }
264
+ ]
265
+ }]
266
+ }
267
+ ```
268
+
269
+ - **"Approve and implement"** →
270
+ ```bash
271
+ npx morph-spec approve $ARGUMENTS tasks
272
+ npx morph-spec phase advance $ARGUMENTS
273
+ ```
274
+ - **"I have feedback" or "Other"** → apply the feedback and repeat this PAUSE
275
+
276
+ ## Completion Criteria
277
+
278
+ - [x] `tasks.md` created with all tasks
279
+ - [x] Tasks use T### format (T001, T002, ...) consistently
280
+ - [x] Tasks categorized correctly (DDD layers or VSA categories)
281
+ - [x] Dependencies mapped
282
+ - [x] Checkpoints defined (every 3 tasks)
283
+ - [x] Effort estimated in minutes per task
284
+ - [x] Execution order clear
285
+ - [x] IaC tasks included (if applicable)
286
+ - [x] State updated with total tasks (`state set tasks.total`)
287
+ - [x] User approved breakdown via `AskUserQuestion`
288
+
289
+ ---
290
+
291
+ ## Superpowers Integration
292
+
293
+ > Available when the `superpowers` plugin is installed.
294
+
295
+ | Skill | When to Use | Invocation |
296
+ |-------|-------------|-----------|
297
+ | `writing-plans` | After task breakdown, to plan implementation sequence | `Skill(superpowers:writing-plans)` |
298
+ | `executing-plans` | To execute the task plan in a separate session | `Skill(superpowers:executing-plans)` |
299
+
300
+ ---
301
+
302
+ ## Phase Outputs
303
+
304
+ <!-- morph:outputs:tasks -->
305
+ | Output | Path |
306
+ |--------|------|
307
+ | `tasks` | `.morph/features/{feature}/4-tasks/tasks.md` |
308
+ <!-- /morph:outputs -->
309
+
310
+ ---
311
+
312
+ After approval: "Planning complete! Run `/morph-apply $ARGUMENTS` to start implementation."
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Usage:
9
9
  * node validate-tasks.mjs <tasks-file>
10
- * node validate-tasks.mjs .morph/features/my-feature/3-tasks/tasks.md
10
+ * node validate-tasks.mjs .morph/features/my-feature/4-tasks/tasks.md
11
11
  *
12
12
  * Checks:
13
13
  * - Summary table exists with T### IDs and valid statuses
@@ -57,9 +57,9 @@ if (summaryTasks.length === 0) {
57
57
  errors.push('No summary table found — expected rows matching | T### | Type | Title | Status |');
58
58
  }
59
59
 
60
- // 2. Parse task headers (### T001: Title)
60
+ // 2. Parse task headers (### T001: Title or ### T001 — Title or ### T001 - Title)
61
61
  const taskHeaders = lines
62
- .map((l, i) => ({ line: i + 1, match: l.match(/^###\s+(T\d{3}):\s+(.+)/) }))
62
+ .map((l, i) => ({ line: i + 1, match: l.match(/^###\s+(T\d{3})\s*[—–:\-]\s+(.+)/) }))
63
63
  .filter(r => r.match);
64
64
 
65
65
  // Check sequential IDs
@@ -0,0 +1,324 @@
1
+ ---
2
+ name: morph:phase-uiux
3
+ description: MORPH-SPEC Phase 1.5 (UI/UX). Creates design-system.md, mockups.md, components.md, and flows.md using Playwright/Context7 MCPs. Use after setup for features with frontend UI components, pages, dashboards, forms, wizards, or visual interactions requiring design documentation.
4
+ argument-hint: "[feature-name]"
5
+ user-invocable: false
6
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
+ cliVersion: "4.10.1"
8
+ ---
9
+
10
+ # MORPH UI/UX Design - Phase 1.5
11
+
12
+ > INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
13
+
14
+ Conditional phase for features with front-end. Collects UI/UX requirements, generates wireframes, component specs, and user flows.
15
+
16
+ ## Prerequisites
17
+
18
+ - [ ] Phase 1 (Setup) completed
19
+ - [ ] Feature has detected UI keywords (blazor, ui, component, page, dashboard, wizard, form, chart)
20
+ - [ ] `uiux-designer` agent activated
21
+
22
+ ## Recommended Tools
23
+
24
+ > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
25
+ > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for MCP reference.
26
+
27
+ | Action | Tool | Alternative |
28
+ |--------|------|-------------|
29
+ | Check existing design system | **Read** `.morph/context/design-system.md` | — |
30
+ | Read user screenshots | **Read** (image file) | — |
31
+ | Search for existing CSS variables | **Grep** `--root:` in `*.css,*.scss` | — |
32
+ | Find existing components | **Glob** `**/Components/**/*.razor` or `**/components/**/*.tsx` | — |
33
+ | UI component documentation | **Context7 MCP** `query_docs({ libraryId, query })` | **WebSearch** + **WebFetch** |
34
+ | Preview existing page | **Playwright MCP** `browser_navigate()` + `browser_take_screenshot()` | **WebFetch** URL |
35
+ | Inspect page structure | **Playwright MCP** `browser_snapshot()` | **WebFetch** + manual parse |
36
+ | Test responsive layout | **Playwright MCP** `browser_resize()` + `browser_take_screenshot()` | Manual testing |
37
+ | External design references | **WebSearch** + **WebFetch** | — |
38
+ | Render UI templates | **Bash** `npx morph-spec template render docs/ui-mockups ...` | — |
39
+ | Generate design system from existing CSS | **Bash** `npx morph-spec generate design-system --scan` | — |
40
+ | Update state | **Bash** `npx morph-spec state mark-output ...` | — |
41
+
42
+ **MCPs for this phase:** Playwright (preview, inspection, responsiveness), Context7 (component docs).
43
+
44
+ **Anti-patterns:**
45
+ - WebSearch for MudBlazor docs (use Context7 MCP — more precise)
46
+ - Task agent to read a screenshot (use Read directly on image)
47
+ - Guess component props (use Context7 for actual API)
48
+
49
+ ---
50
+
51
+ ## Workflow
52
+
53
+ ### Step 0: Ensure uiux phase
54
+
55
+ ```bash
56
+ npx morph-spec state get $ARGUMENTS
57
+ ```
58
+
59
+ Check the `"phase"` field in the output:
60
+
61
+ **If `"phase": "uiux"`** → correct phase, proceed.
62
+
63
+ **If `"phase": "setup"`** → execute:
64
+ 1. `npx morph-spec phase advance $ARGUMENTS` (→ uiux)
65
+
66
+ **Any other value** → do not proceed — inconsistent state, report to user.
67
+
68
+ > **Rule:** Never write to `2-ui/` until the phase is `uiux`. The hook will block writes.
69
+
70
+ ---
71
+
72
+ ### Step 0.5: Check Design System Exists
73
+
74
+ **CRITICAL:** Before starting UI/UX phase, check if a design system exists:
75
+
76
+ ```
77
+ Read: .morph/context/design-system.md
78
+ ```
79
+
80
+ If the file doesn't exist (design system not found):
81
+
82
+ 1. **Option A - Automatic scaffold:**
83
+ - The system will automatically create a design system when advancing to implementation
84
+ - You can generate manually now: `npx morph-spec generate design-system`
85
+
86
+ 2. **Option B - Create manually:**
87
+ - Create `.morph/context/design-system.md` (project-level, shared)
88
+ - Or `.morph/features/$ARGUMENTS/2-ui/design-system.md` (feature-specific)
89
+
90
+ 3. **Option C - Scan existing CSS:**
91
+ - If the project already has CSS with variables: `npx morph-spec generate design-system --scan`
92
+
93
+ **IMPORTANT:**
94
+ - Design system is **mandatory** for UI features
95
+ - Automatic gate will block implementation (Phase 5) if design system doesn't exist
96
+ - Better to create now to ensure visual consistency
97
+
98
+ ### Step 1: Detect If Phase Is Needed
99
+
100
+ Check if active agents include `uiux-designer`:
101
+
102
+ ```bash
103
+ npx morph-spec state get $ARGUMENTS
104
+ ```
105
+
106
+ If `uiux-designer` is NOT in `activeAgents`, skip this phase and continue to Phase 2 (Design).
107
+
108
+ ### Step 1.5: Design Thinking — Aesthetic Direction
109
+
110
+ > **Ref:** `framework/standards/frontend/design-system/aesthetic-direction.md`
111
+
112
+ **BEFORE collecting technical requirements**, define visual direction with 4 questions:
113
+
114
+ 1. **Purpose**: What problem does it solve? Who uses it? What is the professional context?
115
+ 2. **Tone**: What direction? (Minimal Refined / Editorial / Soft Professional / Industrial / Modern Luxury)
116
+ 3. **Differentiation**: What is the 1 memorable element of this interface?
117
+ 4. **Constraints**: Framework, performance budget, existing brand guidelines
118
+
119
+ **CRITICAL:** Commit to direction BEFORE technical specs. Document in `ui-design-system.md`
120
+ in section `## Aesthetic Direction` (template available in the standard above).
121
+
122
+ **Anti-patterns to avoid:**
123
+ - Purple gradient on white background (AI cliche)
124
+ - Inter/Roboto as display font
125
+ - 3-column card grid without visual differentiation
126
+ - 5-color palette with equal weight (without dominant + accent)
127
+
128
+ ### Step 2: Collect User Input
129
+
130
+ **ALWAYS ask the user FIRST:**
131
+
132
+ 1. **Layout and style**:
133
+ - Do you have any layout ideas in mind?
134
+ - Do you have visual references? (sites, apps, screenshots)
135
+ - How do you envision the user flow?
136
+
137
+ 2. **Components and interactions**:
138
+ - What are the main components of this screen/page?
139
+ - What states need to be considered? (loading, error, empty, success)
140
+
141
+ 3. **Reference images**:
142
+ - Do you have example images I can analyze?
143
+ - If YES: use Read tool to read screenshots and extract patterns
144
+
145
+ ### Step 3: Choose UI Library
146
+
147
+ Detect the stack from `.morph/config/config.json` and recommend the appropriate library:
148
+
149
+ **Blazor stack:**
150
+ - **Fluent UI Blazor** — dashboards, simple forms, AI components, Microsoft design language
151
+ - **MudBlazor** — advanced data grids, complex charts, material design
152
+
153
+ **Next.js stack:**
154
+ - **shadcn/ui + Radix** (recommended) — composable primitives, full control, Tailwind-native
155
+ - **MUI** — feature-rich, enterprise-grade, material design
156
+
157
+ **Document the decision as an ADR in `decisions.md`** with: context, options considered, decision, and rationale.
158
+
159
+ ### Step 4: Generate Deliverables
160
+
161
+ Create the following files in `.morph/features/$ARGUMENTS/`:
162
+
163
+ > **Use templates:** Use `npx morph-spec template render` to generate files from templates in `.morph/framework/templates/docs/`. Available templates: `ui-design-system`, `ui-mockups`, `ui-components`, `ui-flows`.
164
+
165
+ #### 4.1. `ui-design-system.md`
166
+
167
+ **If project-level design system exists (`.morph/context/design-system.md`):**
168
+ - Reference it in specs: "Uses project design system at .morph/context/design-system.md"
169
+ - Create `ui-design-system.md` only if there are feature-specific colors/components
170
+
171
+ **If it doesn't exist:**
172
+ - Create complete feature-level design system with:
173
+ - **Section `## Aesthetic Direction`** (use template from `aesthetic-direction.md`):
174
+ direction, font pair, color philosophy, motion intent, composition approach
175
+ - Color palette (primary, secondary, accent, semantic)
176
+ - Typography (heading scales, body text, code)
177
+ - Spacing and layout (grid, margins, paddings)
178
+ - Base components (buttons, inputs, cards)
179
+
180
+ #### 4.2. `ui-mockups.md`
181
+
182
+ ASCII wireframes + descriptions:
183
+ - General layout of each screen/page
184
+ - Component positioning
185
+ - Responsiveness (desktop, tablet, mobile)
186
+ - States (loading, error, empty, success)
187
+
188
+ #### 4.3. `ui-components.md`
189
+
190
+ Technical specs for Fluent UI/MudBlazor components:
191
+ - Component to use (FluentButton, MudDataGrid, etc.)
192
+ - Props and configurations
193
+ - Events and bindings
194
+ - Validations and states
195
+
196
+ #### 4.4. `ui-flows.md`
197
+
198
+ Complete user flows:
199
+ - User stories
200
+ - Flow diagrams (text/ASCII)
201
+ - Edge cases (what happens if...?)
202
+ - Validations and feedback
203
+
204
+ ### CHECKPOINT: Validate UI Deliverables
205
+
206
+ **PAUSE - Before proceeding to accessibility:**
207
+
208
+ - [ ] Aesthetic direction defined and documented in `ui-design-system.md`?
209
+ - [ ] Font pair specified (not just Inter/Roboto for display)?
210
+ - [ ] Color philosophy: dominant + accent + rationale documented?
211
+ - [ ] Design system defined (project-level or feature-level)?
212
+ - [ ] Wireframes cover all states (loading, error, empty, success)?
213
+ - [ ] Components specified with actual props from chosen UI library?
214
+ - [ ] Complete user flows with edge cases?
215
+ - [ ] Chosen UI library documented as ADR in `decisions.md`?
216
+
217
+ **If any checkbox is NOT checked:**
218
+ → Go back and complete the missing deliverable
219
+
220
+ **If ALL checkboxes are checked:**
221
+ → Proceed to accessibility validation
222
+
223
+ ---
224
+
225
+ ### Step 5: Validate Accessibility and Responsiveness
226
+
227
+ Document in UI files:
228
+ - **WCAG 2.1 Level AA** compliance
229
+ - Adequate color contrast
230
+ - Accessible labels for screen readers
231
+ - Keyboard navigation
232
+ - **Responsive breakpoints**
233
+ - Desktop (>1200px)
234
+ - Tablet (768px - 1199px)
235
+ - Mobile (<768px)
236
+
237
+ ### Step 6: Update State
238
+
239
+ ```bash
240
+ npx morph-spec state mark-output $ARGUMENTS ui-design-system
241
+ npx morph-spec state mark-output $ARGUMENTS ui-mockups
242
+ npx morph-spec state mark-output $ARGUMENTS ui-components
243
+ npx morph-spec state mark-output $ARGUMENTS ui-flows
244
+ ```
245
+
246
+ > **Format note:** The `mark-output` commands accept BOTH kebab-case (`ui-design-system`)
247
+ > AND camelCase (`uiDesignSystem`). Both formats work equally! Use whichever is more
248
+ > comfortable for you. Examples:
249
+ > - `npx morph-spec state mark-output my-feature uiDesignSystem`
250
+ > - `npx morph-spec state mark-output my-feature ui-design-system`
251
+
252
+ ## Generated Outputs
253
+
254
+ - `.morph/features/$ARGUMENTS/2-ui/design-system.md`
255
+ - `.morph/features/$ARGUMENTS/2-ui/mockups.md`
256
+ - `.morph/features/$ARGUMENTS/2-ui/components.md`
257
+ - `.morph/features/$ARGUMENTS/2-ui/flows.md`
258
+ - `.morph/features/$ARGUMENTS/1-design/decisions.md` (updated with UI library ADR)
259
+
260
+ ### Step 7: Validate Design with Frontend Review
261
+
262
+ After generating all 4 UI outputs and updating state (Step 6):
263
+
264
+ ```bash
265
+ /frontend-review $ARGUMENTS
266
+ ```
267
+
268
+ The skill validates: WCAG token contrast, existence of all outputs, static design accessibility, and generates mockup screenshots if dev server is available.
269
+
270
+ **If frontend-review blocks**, fix issues before presenting to user.
271
+
272
+ ---
273
+
274
+ ## MANDATORY PAUSE
275
+
276
+ Use `AskUserQuestion` to capture explicit approval before advancing:
277
+
278
+ ```json
279
+ {
280
+ "questions": [{
281
+ "header": "Approval",
282
+ "question": "UI/UX generated. Approve to advance to technical design?",
283
+ "multiSelect": false,
284
+ "options": [
285
+ { "label": "Approve UI/UX", "description": "Advance to technical design phase" },
286
+ { "label": "I have feedback", "description": "Type what you want to adjust in the field below (Other)" }
287
+ ]
288
+ }]
289
+ }
290
+ ```
291
+
292
+ - **"Approve UI/UX"** →
293
+ ```bash
294
+ npx morph-spec approve $ARGUMENTS uiux
295
+ npx morph-spec phase advance $ARGUMENTS
296
+ ```
297
+ - **"I have feedback" or "Other"** → apply the received feedback and repeat this PAUSE
298
+
299
+ ## Advancement Criteria
300
+
301
+ - [x] User input collected (layout, references)
302
+ - [x] UI library chosen and justified (ADR)
303
+ - [x] 4 deliverables created (design-system, mockups, components, flows)
304
+ - [x] WCAG 2.1 accessibility documented
305
+ - [x] Responsiveness specified
306
+ - [x] State updated
307
+ - [x] User approved UI/UX
308
+
309
+ ---
310
+
311
+ ## Phase Outputs
312
+
313
+ <!-- morph:outputs:uiux -->
314
+ | Output | Path |
315
+ |--------|------|
316
+ | `uiDesignSystem` | `.morph/features/{feature}/2-ui/design-system.md` |
317
+ | `uiMockups` | `.morph/features/{feature}/2-ui/mockups.md` |
318
+ | `uiComponents` | `.morph/features/{feature}/2-ui/components.md` |
319
+ | `uiFlows` | `.morph/features/{feature}/2-ui/flows.md` |
320
+ <!-- /morph:outputs -->
321
+
322
+ ---
323
+
324
+ Continue automatically to Phase 2 (Design) after approval.