@polymorphism-tech/morph-spec 4.11.1 → 4.12.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/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/agents.json +16 -6
- package/framework/hooks/claude-code/post-tool-use/agent-complete.js +122 -0
- package/framework/hooks/shared/dispatch-helpers.js +17 -0
- package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +248 -14
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
- package/framework/standards/STANDARDS.json +31 -0
- package/framework/standards/frontend/design-system/aesthetic-direction.md +60 -7
- package/framework/standards/frontend/design-system/design-trends.md +171 -0
- package/framework/templates/context/CONTEXT.md +2 -2
- package/framework/templates/context/design-system.md +346 -211
- package/framework/templates/meta-prompts/squad-leaders/frontend-squad.md +1 -1
- package/package.json +1 -1
- package/src/commands/mcp/mcp-setup.js +28 -6
- package/src/commands/project/init.js +20 -1
- package/src/lib/generators/design-system-generator.js +340 -51
- package/src/lib/validators/design-system/design-system-validator.js +11 -5
- package/src/utils/hooks-installer.js +11 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> Spec-driven development framework for multi-stack projects. Turns feature requests into implementation-ready code through structured, AI-orchestrated phases.
|
|
4
4
|
|
|
5
5
|
**Package:** `@polymorphism-tech/morph-spec`
|
|
6
|
-
**Version:** 4.
|
|
6
|
+
**Version:** 4.12.0
|
|
7
7
|
**Requires:** Node.js 18+, Claude Code
|
|
8
8
|
|
|
9
9
|
---
|
|
@@ -370,4 +370,4 @@ Code generated by morph-spec (contracts, templates, implementation output) belon
|
|
|
370
370
|
|
|
371
371
|
---
|
|
372
372
|
|
|
373
|
-
*morph-spec v4.
|
|
373
|
+
*morph-spec v4.12.0 by [Polymorphism Tech](https://polymorphism.tech)*
|
package/claude-plugin.json
CHANGED
package/docs/CHEATSHEET.md
CHANGED
package/docs/QUICKSTART.md
CHANGED
package/framework/agents.json
CHANGED
|
@@ -1282,7 +1282,7 @@
|
|
|
1282
1282
|
"teammate": {
|
|
1283
1283
|
"role": "CSS & Design System Specialist",
|
|
1284
1284
|
"icon": "🎨",
|
|
1285
|
-
"spawn_prompt": "You are the CSS & Design System Specialist (FASE 5 only). MANDATORY FIRST STEP: Read .morph/context/design-system.md. Validate all CSS follows the design system (
|
|
1285
|
+
"spawn_prompt": "You are the CSS & Design System Specialist (FASE 5 only). MANDATORY FIRST STEP: Read .morph/context/design-system.md. Validate all CSS follows the design system — colors (var(--color-*)), spacing (var(--space-*)), typography (var(--font-*, --text-*)), motion (var(--duration-*, --easing-*)), shadows (var(--shadow-*)), and advanced effects (var(--glass-*, --aurora-*, --perspective-*)). No off-palette hardcoded colors, no inline styles with raw values. Enforce naming conventions (BEM for custom classes). Verify WCAG AA contrast (4.5:1 text, 3:1 UI). Ref: framework/standards/frontend/design-system/design-trends.md for modern technique catalog. Run design-system, css, contrast validators. Any missing tokens must be added to design-system.md before proceeding."
|
|
1286
1286
|
}
|
|
1287
1287
|
},
|
|
1288
1288
|
"seo-growth-hacker": {
|
|
@@ -1988,7 +1988,11 @@
|
|
|
1988
1988
|
"design system",
|
|
1989
1989
|
"css",
|
|
1990
1990
|
"color palette",
|
|
1991
|
-
"spacing"
|
|
1991
|
+
"spacing",
|
|
1992
|
+
"motion tokens",
|
|
1993
|
+
"glassmorphism",
|
|
1994
|
+
"design trends",
|
|
1995
|
+
"advanced effects"
|
|
1992
1996
|
],
|
|
1993
1997
|
"validators": [
|
|
1994
1998
|
"design-system"
|
|
@@ -2008,13 +2012,16 @@
|
|
|
2008
2012
|
"teammate": {
|
|
2009
2013
|
"icon": "🎨",
|
|
2010
2014
|
"role": "Design System Validator (read-only)",
|
|
2011
|
-
"spawn_prompt": "You are the Design System Validator (Tier 4, READ-ONLY). Scan CSS/SCSS and component files for design system compliance:\n\n1. Color palette — look for hardcoded hex/rgb colors instead of CSS variables (var(--color-primary), var(--color-
|
|
2015
|
+
"spawn_prompt": "You are the Design System Validator (Tier 4, READ-ONLY). Scan CSS/SCSS and component files for design system compliance:\n\n1. Color palette — look for hardcoded hex/rgb colors instead of CSS variables (var(--color-primary), var(--color-accent), var(--color-surface-*), var(--color-text-*), etc.)\n2. Spacing — look for hardcoded px/rem values instead of spacing variables (var(--space-*))\n3. Typography — look for hardcoded font-size/font-family instead of typography variables (var(--font-display), var(--font-body), var(--text-*))\n4. Motion — look for hardcoded transition/animation durations instead of motion tokens (var(--duration-*), var(--easing-*))\n5. Shadows — look for hardcoded box-shadow instead of shadow tokens (var(--shadow-*), var(--shadow-colored-*), var(--shadow-layered-*))\n6. Advanced effects — verify glassmorphism uses tokens (var(--glass-*)), aurora uses tokens (var(--aurora-*)), perspective uses tokens (var(--perspective-*))\n7. Component naming — verify PascalCase for Blazor components (.razor) and kebab-case for CSS classes\n8. Check .morph/context/design-system.md for project-specific design tokens\n9. Ref: framework/standards/frontend/design-system/design-trends.md for modern technique catalog\n\nUse Grep and Glob to scan. Do NOT modify any files.\n\nOutput a JSON object: { \"passed\": boolean, \"issues\": [{ \"file\": string, \"line\": number, \"message\": string, \"severity\": \"warning\" }] }"
|
|
2012
2016
|
},
|
|
2013
2017
|
"hook_behavior": {
|
|
2014
2018
|
"validates": [
|
|
2015
|
-
"CSS color palette compliance (primary,
|
|
2016
|
-
"Spacing values (use var(--
|
|
2017
|
-
"Typography scale (use var(--font-*))",
|
|
2019
|
+
"CSS color palette compliance (primary, accent, surface, text, neutral, semantic)",
|
|
2020
|
+
"Spacing values (use var(--space-*))",
|
|
2021
|
+
"Typography scale (use var(--font-display), var(--font-body), var(--text-*))",
|
|
2022
|
+
"Motion tokens (use var(--duration-*), var(--easing-*))",
|
|
2023
|
+
"Shadow tokens (use var(--shadow-*), var(--shadow-colored-*), var(--shadow-layered-*))",
|
|
2024
|
+
"Advanced effects (glassmorphism: var(--glass-*), aurora: var(--aurora-*), perspective: var(--perspective-*))",
|
|
2018
2025
|
"Component naming (PascalCase for Blazor, kebab-case for CSS)"
|
|
2019
2026
|
],
|
|
2020
2027
|
"severity": "warning",
|
|
@@ -2129,6 +2136,9 @@
|
|
|
2129
2136
|
"active_phases": [
|
|
2130
2137
|
"implement"
|
|
2131
2138
|
],
|
|
2139
|
+
"domains": [
|
|
2140
|
+
"frontend-nextjs"
|
|
2141
|
+
],
|
|
2132
2142
|
"keywords": [
|
|
2133
2143
|
"nextjs",
|
|
2134
2144
|
"tsx",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PostToolUse Hook: Agent Completion Tracker
|
|
5
|
+
*
|
|
6
|
+
* Event: PostToolUse | Matcher: Agent
|
|
7
|
+
*
|
|
8
|
+
* Detects when morph-spec subagents complete (dispatched via the Agent tool)
|
|
9
|
+
* and injects status notifications:
|
|
10
|
+
* - Partial: shows which agents are still pending
|
|
11
|
+
* - Complete: instructs to run validate-feature
|
|
12
|
+
*
|
|
13
|
+
* Only tracks tier 1-3 agents (not validators: morph-validator-*).
|
|
14
|
+
*
|
|
15
|
+
* Fail-open: exits 0 on any error.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { readStdin } from '../../shared/stdin-reader.js';
|
|
19
|
+
import { stateExists, getActiveFeature, getFeature, getFeaturePhase } from '../../shared/state-reader.js';
|
|
20
|
+
import { pass, injectContext } from '../../shared/hook-response.js';
|
|
21
|
+
import { logHookActivity } from '../../shared/activity-logger.js';
|
|
22
|
+
import { subagentTypeToAgentId } from '../../shared/dispatch-helpers.js';
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
if (!stateExists()) pass();
|
|
26
|
+
|
|
27
|
+
const payload = await readStdin();
|
|
28
|
+
if (!payload) pass();
|
|
29
|
+
|
|
30
|
+
const subagentType = payload?.tool_input?.subagent_type || '';
|
|
31
|
+
if (!subagentType) pass();
|
|
32
|
+
|
|
33
|
+
// Only track morph-* agents (not external subagents)
|
|
34
|
+
if (!subagentType.startsWith('morph-')) pass();
|
|
35
|
+
|
|
36
|
+
// Skip validators (tier 4) — they have their own tracking
|
|
37
|
+
if (subagentType.startsWith('morph-validator-')) pass();
|
|
38
|
+
|
|
39
|
+
const result = buildAgentCompleteContext(subagentType);
|
|
40
|
+
if (result) {
|
|
41
|
+
logHookActivity('agent-complete', 'PostToolUse', result.type);
|
|
42
|
+
injectContext(result.text);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
pass();
|
|
46
|
+
} catch {
|
|
47
|
+
// Fail-open
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Build the agent completion notification context.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} subagentType - e.g. 'morph-nextjs-expert'
|
|
55
|
+
* @returns {{ text: string, type: string }|null}
|
|
56
|
+
*/
|
|
57
|
+
function buildAgentCompleteContext(subagentType) {
|
|
58
|
+
// Get active feature
|
|
59
|
+
const active = getActiveFeature();
|
|
60
|
+
if (!active) return null;
|
|
61
|
+
|
|
62
|
+
const { name: featureName, feature } = active;
|
|
63
|
+
|
|
64
|
+
// Only track during implement phase
|
|
65
|
+
const phase = getFeaturePhase(featureName);
|
|
66
|
+
if (phase !== 'implement') return null;
|
|
67
|
+
|
|
68
|
+
// Get dispatch log
|
|
69
|
+
const dispatchLog = feature.dispatchLog;
|
|
70
|
+
if (!Array.isArray(dispatchLog) || dispatchLog.length === 0) return null;
|
|
71
|
+
|
|
72
|
+
// Get the most recent dispatch entry
|
|
73
|
+
const latestDispatch = dispatchLog[dispatchLog.length - 1];
|
|
74
|
+
const agents = latestDispatch?.agents;
|
|
75
|
+
if (!Array.isArray(agents) || agents.length === 0) return null;
|
|
76
|
+
|
|
77
|
+
// Find the completing agent in the dispatch
|
|
78
|
+
const agentId = subagentTypeToAgentId(subagentType);
|
|
79
|
+
let matchedAgent = agents.find(a => a.subagentType === subagentType);
|
|
80
|
+
if (!matchedAgent && agentId) {
|
|
81
|
+
matchedAgent = agents.find(a => a.id === agentId);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!matchedAgent) return null;
|
|
85
|
+
|
|
86
|
+
// Mark this agent as completed (in-memory for evaluation only)
|
|
87
|
+
// Check which agents are still pending (no completedAt)
|
|
88
|
+
const pendingAgents = agents.filter(a => {
|
|
89
|
+
if (a === matchedAgent) return false; // The one just completed
|
|
90
|
+
return !a.completedAt;
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const totalAgents = agents.length;
|
|
94
|
+
const completedCount = totalAgents - pendingAgents.length;
|
|
95
|
+
|
|
96
|
+
if (pendingAgents.length === 0) {
|
|
97
|
+
// All agents complete
|
|
98
|
+
return {
|
|
99
|
+
type: 'all_complete',
|
|
100
|
+
text: [
|
|
101
|
+
'✅ ALL MORPH-SPEC AGENTS COMPLETE',
|
|
102
|
+
'════════════════════════════════════════',
|
|
103
|
+
`All ${totalAgents} dispatched agents have completed their tasks.`,
|
|
104
|
+
'',
|
|
105
|
+
'NEXT STEP:',
|
|
106
|
+
` morph-spec validate-feature ${featureName} --phase implement`,
|
|
107
|
+
].join('\n'),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Partial completion
|
|
112
|
+
const remainingList = pendingAgents
|
|
113
|
+
.map(a => a.title || a.id || 'unknown')
|
|
114
|
+
.join(', ');
|
|
115
|
+
|
|
116
|
+
const agentTitle = matchedAgent.title || matchedAgent.id || subagentType;
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
type: 'partial_complete',
|
|
120
|
+
text: `✅ Agent '${agentTitle}' completed (${completedCount}/${totalAgents}). Remaining: ${remainingList}`,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -112,6 +112,23 @@ export function parseDispatchAgentsCommand(command) {
|
|
|
112
112
|
return { featureName: match[1], phase: match[2] };
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Convert a subagent_type string back to a morph agent ID.
|
|
117
|
+
* Reverses the mapping used when dispatching agents as subagents.
|
|
118
|
+
*
|
|
119
|
+
* Example: 'morph-nextjs-expert' → 'nextjs-expert'
|
|
120
|
+
*
|
|
121
|
+
* @param {string} subagentType - The subagent_type value (e.g. 'morph-nextjs-expert')
|
|
122
|
+
* @returns {string|null} - Agent ID without 'morph-' prefix, or null if invalid
|
|
123
|
+
*/
|
|
124
|
+
export function subagentTypeToAgentId(subagentType) {
|
|
125
|
+
if (!subagentType || typeof subagentType !== 'string') return null;
|
|
126
|
+
if (!subagentType.startsWith('morph-')) return null;
|
|
127
|
+
const agentId = subagentType.slice('morph-'.length);
|
|
128
|
+
if (!agentId) return null;
|
|
129
|
+
return agentId;
|
|
130
|
+
}
|
|
131
|
+
|
|
115
132
|
/**
|
|
116
133
|
* Extract the tool result string from a PostToolUse hook payload.
|
|
117
134
|
* Handles multiple possible formats.
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 3 (Clarify). Iterative clarification loop driven b
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.12.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Clarify — Phase 3
|
|
@@ -3,7 +3,7 @@ name: morph-phase-codebase-analysis
|
|
|
3
3
|
description: MORPH-SPEC Design sub-phase that analyzes existing codebase and database schema, producing schema-analysis.md with real column names, types, relationships, and field mismatches. Use at the start of Design phase before generating contracts.cs to prevent incorrect field names or types.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
6
|
-
cliVersion: "4.
|
|
6
|
+
cliVersion: "4.12.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# MORPH Codebase Analysis - Design Sub-phase
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 2 (Design). Schema-first interactive design: reads
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.12.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Design — Phase 2
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 4 (Plan). Generates a detailed implementation plan
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.12.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Plan — Phase 4
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 1 (Setup). Reads project context, detects tech sta
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.12.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Setup — Phase 1
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 4 (Tasks). Breaks approved spec into bottom-up ord
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.12.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH Tasks — Phase 4
|
|
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 1.5 (UI/UX). Creates design-system.md, mockups.md,
|
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.12.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MORPH UI/UX Design - Phase 1.5
|
|
@@ -39,6 +39,11 @@ Conditional phase for features with front-end. Collects UI/UX requirements, gene
|
|
|
39
39
|
| Render UI templates | **Bash** `morph-spec template render docs/ui-mockups ...` | — |
|
|
40
40
|
| Generate design system from existing CSS | **Bash** `morph-spec generate design-system --scan` | — |
|
|
41
41
|
| Update state | **Bash** `morph-spec state mark-output ...` | — |
|
|
42
|
+
| Auto-detect dev server | **Glob** `next.config.*`, `vite.config.*`, `*.csproj` | **Read** `package.json` scripts |
|
|
43
|
+
| Capture existing app | **Playwright MCP** `browser_navigate()` + `browser_take_screenshot()` | — |
|
|
44
|
+
| Read Tailwind config | **Read** `tailwind.config.{js,ts}` | **Grep** `colors:` |
|
|
45
|
+
| Read MudBlazor theme | **Glob** `**/MudTheme*.cs` → **Read** | **Grep** `PaletteLight` |
|
|
46
|
+
| Trend research | **Read** `design-trends.md` standard | **Context7 MCP** / **WebSearch** |
|
|
42
47
|
|
|
43
48
|
**MCPs for this phase:** Playwright (preview, inspection, responsiveness), Context7 (component docs).
|
|
44
49
|
|
|
@@ -70,15 +75,123 @@ Check the `"phase"` field in the output:
|
|
|
70
75
|
|
|
71
76
|
---
|
|
72
77
|
|
|
78
|
+
### Step 0.2: Capture Existing App (Playwright)
|
|
79
|
+
|
|
80
|
+
> **Purpose:** Before analyzing tokens, capture visual screenshots of the existing app to understand current design patterns.
|
|
81
|
+
> **Skip if:** Greenfield project (no existing UI pages).
|
|
82
|
+
|
|
83
|
+
#### 0.2.1 — Auto-detect dev server
|
|
84
|
+
|
|
85
|
+
Check in priority order:
|
|
86
|
+
|
|
87
|
+
1. **`config.json`**: Read `.morph/config/config.json` → check for `project.devServerUrl` field → use if present
|
|
88
|
+
2. **`package.json` port flags**: Read `package.json` scripts → scan for `--port`, `-p` flags → extract port
|
|
89
|
+
3. **Next.js**: Glob `next.config.*` → try `http://localhost:3000`
|
|
90
|
+
4. **Vite**: Glob `vite.config.*` → try `http://localhost:5173`
|
|
91
|
+
5. **.NET launchSettings**: Glob `**/Properties/launchSettings.json` → Read → extract `applicationUrl`
|
|
92
|
+
6. **.NET fallback**: Glob `*.csproj` → try `https://localhost:5001`
|
|
93
|
+
|
|
94
|
+
Track: `detectedUrl` (string or null).
|
|
95
|
+
|
|
96
|
+
#### 0.2.2 — Attempt connection
|
|
97
|
+
|
|
98
|
+
If `detectedUrl` is not null:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
mcp__plugin_playwright_playwright__browser_navigate({ url: detectedUrl })
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- **Timeout:** 5 seconds
|
|
105
|
+
- **If connects:** proceed to 0.2.3
|
|
106
|
+
- **If fails (timeout/error):**
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"questions": [{
|
|
111
|
+
"header": "Dev Server",
|
|
112
|
+
"question": "Could not connect to dev server at {detectedUrl}. How to proceed?",
|
|
113
|
+
"multiSelect": false,
|
|
114
|
+
"options": [
|
|
115
|
+
{ "label": "Start server first", "description": "I'll start the dev server — wait for me" },
|
|
116
|
+
{ "label": "Use different URL", "description": "I'll provide the correct URL (Other)" },
|
|
117
|
+
{ "label": "Skip screenshots", "description": "Continue without existing app screenshots" }
|
|
118
|
+
]
|
|
119
|
+
}]
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
If `detectedUrl` is null (no indicators found):
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"questions": [{
|
|
128
|
+
"header": "Existing UI?",
|
|
129
|
+
"question": "Does this project have existing UI pages I should capture?",
|
|
130
|
+
"multiSelect": false,
|
|
131
|
+
"options": [
|
|
132
|
+
{ "label": "Yes, provide URL", "description": "I'll provide the URL in the field below (Other)" },
|
|
133
|
+
{ "label": "No, greenfield", "description": "Skip — this is a new project" }
|
|
134
|
+
]
|
|
135
|
+
}]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### 0.2.3 — Screenshot main pages
|
|
140
|
+
|
|
141
|
+
Once connected, take screenshots of up to 5 pages:
|
|
142
|
+
|
|
143
|
+
1. **Current page** (usually home/root)
|
|
144
|
+
2. Navigate to common routes: `/dashboard`, `/admin`, `/settings`, or detect from sidebar links via `browser_snapshot()`
|
|
145
|
+
3. For each page:
|
|
146
|
+
```
|
|
147
|
+
mcp__plugin_playwright_playwright__browser_resize({ width: 1440, height: 900 })
|
|
148
|
+
mcp__plugin_playwright_playwright__browser_take_screenshot({})
|
|
149
|
+
```
|
|
150
|
+
4. Save screenshots to `.morph/features/$ARGUMENTS/2-ui/existing-*.png`
|
|
151
|
+
|
|
152
|
+
#### 0.2.4 — Visual analysis
|
|
153
|
+
|
|
154
|
+
Analyze the captured screenshots and write `.morph/features/$ARGUMENTS/2-ui/existing-ui-analysis.md`:
|
|
155
|
+
|
|
156
|
+
> **Note:** This is an intermediate artifact — NOT a tracked output in `output-schema.js`. It will not appear in `state mark-output`. Advisory warnings from `task-tracking-guard.js` are expected.
|
|
157
|
+
|
|
158
|
+
```markdown
|
|
159
|
+
# Existing UI Analysis — {Feature}
|
|
160
|
+
|
|
161
|
+
## Visual Summary
|
|
162
|
+
- **Color palette:** [dominant colors observed]
|
|
163
|
+
- **Typography:** [serif/sans/mono, approximate weights, scale]
|
|
164
|
+
- **Layout:** [sidebar/topbar/fullwidth, grid system, card patterns]
|
|
165
|
+
- **Sophistication level:** [basic/intermediate/advanced]
|
|
166
|
+
- **Dark/Light mode:** [which mode detected, or both]
|
|
167
|
+
|
|
168
|
+
## Design Tokens Detected Visually
|
|
169
|
+
- Primary color: [approx hex from screenshots]
|
|
170
|
+
- Background: [surface colors observed]
|
|
171
|
+
- Border style: [rounded/sharp, thickness]
|
|
172
|
+
- Shadow style: [flat/elevated/colored]
|
|
173
|
+
|
|
174
|
+
## Patterns Worth Preserving
|
|
175
|
+
- [List patterns that work well and should be maintained]
|
|
176
|
+
|
|
177
|
+
## Opportunities for Improvement
|
|
178
|
+
- [List areas where modern techniques could improve the UI]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
This analysis feeds into Step 0.5 (cross-check with extracted tokens) and Step 1.5 (domain-adaptive direction).
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
73
185
|
### Step 0.5: Check Design System
|
|
74
186
|
|
|
75
187
|
**This step is MANDATORY and must always run before Step 1.**
|
|
76
188
|
|
|
77
|
-
#### Step 0.5.1 — Scan frontend for
|
|
189
|
+
#### Step 0.5.1 — Scan frontend for design tokens (ALWAYS)
|
|
78
190
|
|
|
79
|
-
Search for existing
|
|
191
|
+
Search for existing design tokens across ALL supported stacks. Run these scans in parallel:
|
|
80
192
|
|
|
81
|
-
|
|
193
|
+
**A. CSS Custom Properties (all stacks):**
|
|
194
|
+
Glob these patterns (exclude `node_modules/`, `.next/`, `dist/`, `build/`, `obj/`, `bin/`):
|
|
82
195
|
```
|
|
83
196
|
wwwroot/**/*.css
|
|
84
197
|
wwwroot/**/*.scss
|
|
@@ -88,16 +201,43 @@ src/**/*.css
|
|
|
88
201
|
src/**/*.scss
|
|
89
202
|
src/**/*.module.css
|
|
90
203
|
public/**/*.css
|
|
204
|
+
app/**/*.css
|
|
91
205
|
```
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
206
|
+
For each file found, Grep for `:root {` blocks containing `--` custom properties.
|
|
207
|
+
|
|
208
|
+
**B. Tailwind Config (Next.js / Vite):**
|
|
209
|
+
Glob: `tailwind.config.{js,ts,mjs,cjs}`
|
|
210
|
+
If found, Read the file and extract:
|
|
211
|
+
- `theme.colors` / `theme.extend.colors` → map to color tokens
|
|
212
|
+
- `theme.fontFamily` → map to font tokens
|
|
213
|
+
- `theme.spacing` → map to spacing tokens
|
|
214
|
+
- `theme.borderRadius` → map to radius tokens
|
|
215
|
+
|
|
216
|
+
**C. shadcn/ui Config:**
|
|
217
|
+
Glob: `components.json`
|
|
218
|
+
If found and contains `"style"` field, also scan `src/lib/utils.ts` or `lib/utils.ts` for CSS var references.
|
|
219
|
+
|
|
220
|
+
**D. MudBlazor Theme (.NET):**
|
|
221
|
+
Glob: `**/MudTheme*.cs`, `**/*Theme*.cs`, `**/CustomTheme*.cs`
|
|
222
|
+
If found, Grep for `PaletteLight`, `PaletteDark`, `Typography` property assignments.
|
|
223
|
+
Extract: Primary, Secondary, Tertiary, Background, Surface colors + font families.
|
|
224
|
+
|
|
225
|
+
**E. Fluent UI Theme (.NET):**
|
|
226
|
+
Glob: `**/FluentDesignTheme*.cs`, `**/DesignTheme*.cs`
|
|
227
|
+
If found, Grep for `DesignThemePalette` properties.
|
|
228
|
+
|
|
229
|
+
**F. Global theme files:**
|
|
230
|
+
Glob: `**/theme.{ts,js}`, `**/tokens.{ts,js}`, `**/design-tokens.{ts,js}`
|
|
231
|
+
If found, Read and extract exported color/spacing/font objects.
|
|
232
|
+
|
|
233
|
+
Classify ALL found tokens into:
|
|
234
|
+
- **Colors**: `--color-*`, hex values, rgb(), Palette assignments
|
|
235
|
+
- **Fonts**: `--font-*`, `font-family:`, fontFamily config
|
|
236
|
+
- **Spacing**: `--space-*`, `--gap-*`, spacing config
|
|
237
|
+
- **Radius**: `--radius-*`, borderRadius config
|
|
238
|
+
- **Shadows**: `--shadow-*`, boxShadow config
|
|
239
|
+
|
|
240
|
+
Track: `tokensFound` (object by category), `tokenSources` (array of {file, stack, tokenCount}).
|
|
101
241
|
|
|
102
242
|
#### Step 0.5.2 — Check if design-system.md exists
|
|
103
243
|
|
|
@@ -113,7 +253,7 @@ Track: `dsExists` (bool).
|
|
|
113
253
|
|------|-----------|--------|
|
|
114
254
|
| **A** | `dsExists` AND `cssTokensFound` | Cross-check DS vs scanned tokens. If >2 colors diverge, flag misalignment and ask user if they want to update DS with `AskUserQuestion`. Proceed to Step 1. |
|
|
115
255
|
| **B** | `dsExists` AND NOT `cssTokensFound` | Print: `✓ Design system found (no CSS tokens to cross-check)`. Proceed to Step 1. |
|
|
116
|
-
| **C** | NOT `dsExists` AND
|
|
256
|
+
| **C** | NOT `dsExists` AND tokens found | Auto-generate `.morph/context/design-system.md` from ALL scanned token sources (CSS vars, Tailwind config, MudBlazor theme, etc.). Merge tokens from multiple sources, preferring Tailwind/Theme config over raw CSS. If Step 0.2 produced `existing-ui-analysis.md`, cross-reference visual analysis with extracted tokens. Proceed to Step 1. |
|
|
117
257
|
| **D** | NOT `dsExists` AND NOT `cssTokensFound` | Greenfield project. Ask user for aesthetic direction + brand color using `AskUserQuestion` (same options as morph-init). Scaffold from template. Proceed to Step 1. |
|
|
118
258
|
|
|
119
259
|
**Case C — auto-generate from scanned tokens:**
|
|
@@ -147,6 +287,60 @@ morph-spec state get $ARGUMENTS
|
|
|
147
287
|
|
|
148
288
|
If `ui-designer` is NOT in `activeAgents`, skip this phase and continue to Phase 2 (Design).
|
|
149
289
|
|
|
290
|
+
### Step 1.3: Trend Research
|
|
291
|
+
|
|
292
|
+
> **Purpose:** Before defining aesthetic direction, research current design trends relevant to this project's domain.
|
|
293
|
+
> **Ref:** `framework/standards/frontend/design-system/design-trends.md`
|
|
294
|
+
|
|
295
|
+
#### 1.3.1 — Consult curated catalog
|
|
296
|
+
|
|
297
|
+
Read `framework/standards/frontend/design-system/design-trends.md` and identify techniques relevant to the project.
|
|
298
|
+
|
|
299
|
+
#### 1.3.2 — Detect project domain
|
|
300
|
+
|
|
301
|
+
Scan `.morph/features/$ARGUMENTS/0-proposal/proposal.md` for domain keywords:
|
|
302
|
+
|
|
303
|
+
| Domain | Keywords |
|
|
304
|
+
|--------|----------|
|
|
305
|
+
| SaaS Dashboard | dashboard, analytics, metrics, monitoring, kpi, chart |
|
|
306
|
+
| E-commerce | e-commerce, store, product, cart, checkout, catalog |
|
|
307
|
+
| Landing Page | landing, marketing, site, hero, launch, waitlist |
|
|
308
|
+
| Internal Tool | admin, backoffice, internal, settings, management |
|
|
309
|
+
| Social/Community | social, feed, community, chat, post, notification |
|
|
310
|
+
|
|
311
|
+
Count keyword hits per domain. Use the domain with most hits. If zero hits across all domains, skip domain-specific filtering.
|
|
312
|
+
|
|
313
|
+
#### 1.3.3 — Research current trends (optional enhancement)
|
|
314
|
+
|
|
315
|
+
If Context7 MCP or WebSearch is available:
|
|
316
|
+
- Search: "{currentYear} UI design trends {detectedDomain}"
|
|
317
|
+
- Extract 2-3 additional techniques not in the curated catalog
|
|
318
|
+
- Evaluate if they are production-ready (browser support, performance)
|
|
319
|
+
|
|
320
|
+
#### 1.3.4 — Present recommendations
|
|
321
|
+
|
|
322
|
+
Use `AskUserQuestion` to present 3-4 recommended modern techniques:
|
|
323
|
+
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"questions": [{
|
|
327
|
+
"header": "Trends",
|
|
328
|
+
"question": "Based on your project domain ({detectedDomain}), these modern techniques are recommended. Which ones do you want to incorporate?",
|
|
329
|
+
"multiSelect": true,
|
|
330
|
+
"options": [
|
|
331
|
+
{ "label": "{Technique 1}", "description": "{Brief description + when to use}" },
|
|
332
|
+
{ "label": "{Technique 2}", "description": "{Brief description + when to use}" },
|
|
333
|
+
{ "label": "{Technique 3}", "description": "{Brief description + when to use}" },
|
|
334
|
+
{ "label": "None / custom", "description": "Skip trends or describe your own preference (Other)" }
|
|
335
|
+
]
|
|
336
|
+
}]
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Selected trends feed into Step 1.5 (Aesthetic Direction) and Step 4 (Deliverables).
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
150
344
|
### Step 1.5: Design Thinking — Aesthetic Direction
|
|
151
345
|
|
|
152
346
|
> **Ref:** `framework/standards/frontend/design-system/aesthetic-direction.md`
|
|
@@ -161,6 +355,46 @@ If `ui-designer` is NOT in `activeAgents`, skip this phase and continue to Phase
|
|
|
161
355
|
**CRITICAL:** Commit to direction BEFORE technical specs. Document in `ui-design-system.md`
|
|
162
356
|
in section `## Aesthetic Direction` (template available in the standard above).
|
|
163
357
|
|
|
358
|
+
#### Domain-Adaptive Patterns
|
|
359
|
+
|
|
360
|
+
After defining aesthetic direction, apply domain-specific pattern suggestions:
|
|
361
|
+
|
|
362
|
+
> **Ref:** `framework/standards/frontend/design-system/aesthetic-direction.md` → `## Domain Adaptation`
|
|
363
|
+
|
|
364
|
+
Based on the domain detected in Step 1.3.2, suggest patterns from the Domain Adaptation guide:
|
|
365
|
+
|
|
366
|
+
| Domain | Preferred Directions | Key Patterns to Suggest |
|
|
367
|
+
|--------|---------------------|------------------------|
|
|
368
|
+
| SaaS Dashboard | Industrial, Minimal Refined | Dense bento grid KPIs, skeleton loaders, sidebar glassmorphism, dark mode default |
|
|
369
|
+
| E-commerce | Modern Luxury, Soft Professional | Product card hover lift, CTA colored shadows, image-first layouts, scroll galleries |
|
|
370
|
+
| Landing Page | Editorial, Modern Luxury | Hero aurora gradient, scroll-driven narrative, fluid typography, overlapping layers |
|
|
371
|
+
| Internal Tool | Industrial, Minimal Refined | Compact forms, dense tables, status chips, monospace data displays |
|
|
372
|
+
| Social/Community | Soft Professional, Editorial | Card feed, notification badges, avatar systems, drawer navigation |
|
|
373
|
+
|
|
374
|
+
If the user's chosen direction conflicts with domain recommendations (e.g., Industrial for E-commerce), present an `AskUserQuestion` advisory:
|
|
375
|
+
|
|
376
|
+
```json
|
|
377
|
+
{
|
|
378
|
+
"questions": [{
|
|
379
|
+
"header": "Direction",
|
|
380
|
+
"question": "You chose {direction} for a {domain} project. The recommended directions are {recommended}. Keep your choice or adapt?",
|
|
381
|
+
"multiSelect": false,
|
|
382
|
+
"options": [
|
|
383
|
+
{ "label": "Keep {direction}", "description": "I have specific reasons for this choice" },
|
|
384
|
+
{ "label": "Switch to {recommended[0]}", "description": "{Brief rationale}" }
|
|
385
|
+
]
|
|
386
|
+
}]
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
#### Integration with Selected Trends
|
|
391
|
+
|
|
392
|
+
Incorporate the trends selected in Step 1.3.4 into the aesthetic direction documentation:
|
|
393
|
+
|
|
394
|
+
- Add selected trends to `## Aesthetic Direction` in `ui-design-system.md`
|
|
395
|
+
- Reference the specific implementation from `design-trends.md`
|
|
396
|
+
- Document how each trend maps to the chosen direction
|
|
397
|
+
|
|
164
398
|
**Anti-patterns to avoid:**
|
|
165
399
|
- Purple gradient on white background (AI cliche)
|
|
166
400
|
- Inter/Roboto as display font
|
|
@@ -4,7 +4,7 @@ description: Guided workflow for mid-implementation scope escalation — analyze
|
|
|
4
4
|
user-invocable: true
|
|
5
5
|
argument-hint: "[feature-name]"
|
|
6
6
|
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.
|
|
7
|
+
cliVersion: "4.12.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Scope Escalation Workflow
|