maestro-flow-one 0.2.7 → 0.2.9

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.
@@ -64,8 +64,8 @@ These commands ask questions only "if unclear from codebase". When PRODUCT.md an
64
64
 
65
65
  1. **Load context**: Run `maestro impeccable load-context` to load PRODUCT.md and DESIGN.md
66
66
  2. **Validate command**: Check the requested command is in the allowed list above
67
- 3. **Execute**: `Skill({ skill: "maestro-impeccable", args: "{command} {target} --skip-harvest -y" })`
68
- - Always pass `-y` to auto-confirm where the skill allows
67
+ 3. **Execute**: Read `~/.maestro/workflows/impeccable/{command}.md` follow workflow instructions
68
+ - Pass `-y` to auto-confirm where the workflow allows
69
69
  - Pass `--skip-harvest` — the caller handles harvest if needed
70
70
  4. **Report**: Return the command output (scores, changes made, findings)
71
71
 
@@ -79,7 +79,7 @@ Phase 4: Output context.md for downstream plan --gaps
79
79
  **Next-step routing on completion:**
80
80
 
81
81
  Phase/Milestone scope:
82
- - Go recommendation, UI work needed → `/maestro-ui-craft --chain build {target}`
82
+ - Go recommendation, UI work needed → `/maestro-impeccable build {target}`
83
83
  - Go recommendation, ready to plan → `/maestro-plan` or `/maestro-plan {phase}`
84
84
  - No-Go recommendation → revisit requirements or `/maestro-brainstorm {topic}`
85
85
 
@@ -129,5 +129,5 @@ Both modes (full + quick):
129
129
  - [ ] Scope creep redirected to Deferred section
130
130
  - [ ] Deferred items auto-created as issues (if any)
131
131
  - [ ] Artifact registered in state.json with correct scope/milestone/phase
132
- - [ ] Next step routed (ui-craft/plan for Go, brainstorm for No-Go)
132
+ - [ ] Next step routed (impeccable/plan for Go, brainstorm for No-Go)
133
133
  </success_criteria>
@@ -69,7 +69,7 @@ Auto mode:
69
69
  - Project initialized, quick roadmap → Skill({ skill: "maestro-roadmap", args: "--from-brainstorm {session_id}" })
70
70
  - Need deeper analysis first → Skill({ skill: "maestro-analyze", args: "{topic}" })
71
71
  - `html-prototypes/` produced with 2+ files and user wants to browse → load `~/.maestro/workflows/brainstorm-visualize.md` and launch visualizer server (optional, user-triggered)
72
- - DESIGN.md established during Step 3.5 → suggest: "Run `/maestro-ui-craft <feature-description> --chain build` to build with the established design system"
72
+ - DESIGN.md established during Step 3.5 → suggest: "Run `/maestro-impeccable build <feature-description>` to build with the established design system"
73
73
 
74
74
  Single role mode:
75
75
  - More roles needed → Skill({ skill: "maestro-brainstorm", args: "{next_role} --session {session_id}" })
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro-impeccable
3
- description: Production-grade UI design with knowhow accumulation — 24 commands + integrated design search for build, evaluate, refine, enhance, fix
4
- argument-hint: "<command> [target] [--skip-harvest] [-y] | search <query> [-d <domain>] [--design-system]"
3
+ description: Production-grade UI design — 24 commands + chain orchestration with quality gates + design search
4
+ argument-hint: "<command|chain|intent> [target] [flags]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -9,118 +9,238 @@ allowed-tools:
9
9
  - Bash
10
10
  - Glob
11
11
  - Grep
12
- - Skill
12
+ - Agent
13
13
  - AskUserQuestion
14
+ - TodoWrite
14
15
  ---
15
- <purpose>
16
- Replaces impeccable as the primary UI design entry point. 24 commands covering the full design lifecycle:
17
- Build (craft, shape, teach, document, extract, explore), Evaluate (critique, audit), Refine (polish, bolder, quieter, distill, harden, onboard),
18
- Enhance (animate, colorize, typeset, layout, delight, overdrive), Fix (clarify, adapt, optimize), Iterate (live).
19
16
 
20
- Core innovation over impeccable: after each command execution, automatically harvests design decisions
21
- into `.workflow/knowhow/` (DCS-, AST-, TIP-, REF-) for cross-session accumulation. Other maestro commands
22
- consume this via `category: coding` auto-injection and keyword matching.
17
+ <purpose>
18
+ UI design command. Parse input prerequisites read workflow file → execute → track.
23
19
 
24
- Includes integrated `search` CLI subcommand for querying the UI/UX design knowledge base
25
- (BM25 search engine + 30+ CSV data files covering styles, colors, typography, UX guidelines, charts, stacks).
26
- Search is invoked directly via `maestro impeccable search`, not through the Skill dispatch.
20
+ - **Direct**: single command via workflow file
21
+ - **Chain**: orchestrate command sequence with quality gates
22
+ - **Search**: query design knowledge base via CLI
27
23
  </purpose>
28
24
 
29
- <deferred_reading>
30
- - [impeccable harvest workflow](~/.maestro/workflows/impeccable.md) — read after command execution for harvest logic
31
- </deferred_reading>
32
-
33
- <context>
34
- $ARGUMENTS — sub-command + target + optional flags.
35
-
36
- **Sub-commands** (24):
37
-
38
- | Category | Commands |
39
- |----------|----------|
40
- | Build | craft, shape, teach, document, extract, explore |
41
- | Evaluate | critique, audit |
42
- | Refine | polish, bolder, quieter, distill, harden, onboard |
43
- | Enhance | animate, colorize, typeset, layout, delight, overdrive |
44
- | Fix | clarify, adapt, optimize |
45
- | Iterate | live |
46
-
47
- **Flags:**
48
- - `--skip-harvest` — Execute command without knowhow capture
49
- - `-y` Auto-confirm where the skill allows
50
-
51
- **Harvest behavior**: After command completion, the harvest workflow extracts design decisions
52
- and writes knowhow entries. DCS-/AST- types also get spec index entries for discoverability.
53
- `live` command is exempt (too ephemeral). Use `--skip-harvest` to suppress.
54
- </context>
55
-
56
- <execution>
57
-
58
- ## 1. Route
59
-
60
- If first argument is `search` direct CLI dispatch (no Skill, no harvest):
61
-
62
- ```bash
63
- maestro impeccable search "<query>" [options]
64
- ```
65
-
66
- Options: `-d <domain>`, `-s <stack>`, `-n <max>`, `--design-system`, `-p <name>`, `-f <fmt>`, `--persist`, `--page <page>`, `-o <dir>`
67
-
68
- Domains: style, color, chart, landing, product, ux, typography, icons, react, web, google-fonts.
69
- Stacks: react, nextjs, vue, svelte, astro, swiftui, react-native, flutter, html-tailwind, shadcn, + more.
70
-
71
- Search uses `workflows/impeccable/ui-search/search.py` (BM25 engine + 30+ CSV knowledge files).
72
- Output goes to stdout. No Skill invocation, no harvest. Return after output.
73
-
74
- ## 2. Invoke Skill (all other sub-commands)
75
-
76
- ```
77
- Skill({ skill: "maestro-impeccable", args: "$ARGUMENTS" })
78
- ```
79
-
80
- The skill handles: context loading (spec load --category ui, with load-context fallback), register detection (brand/product),
81
- reference file loading, and command execution.
82
-
83
- ## 3. Harvest
84
-
85
- After the skill completes, read `~/.maestro/workflows/impeccable.md` and follow the harvest workflow.
86
-
87
- Skip harvest if:
88
- - `--skip-harvest` flag is set
89
- - Sub-command is `live` (interactive, no harvestable output)
90
- - Sub-command is unrecognized
91
-
92
- ## 4. Post-Execution Routing
93
-
94
- After harvest (or skip), determine whether this command was invoked as part of a larger pipeline by checking conversation context (e.g., brainstorm Step 3.5, ui-craft chain step).
95
-
96
- **Pipeline context detected** (called via Skill from brainstorm, ui-craft, etc.):
97
- - Report command result (output, scores, artifacts produced) and **stop**
98
- - Do NOT suggest next-step commands — the calling flow owns what happens next
99
-
100
- **Standalone invocation** (user directly ran `/maestro-impeccable`):
101
- - Show next-step suggestions based on what was executed:
102
- - `teach` suggest `explore` or `shape`
103
- - `explore` → suggest `shape` → `craft`
104
- - `shape` suggest `craft`
105
- - `craft` → suggest `critique`
106
- - `critique`/`audit` suggest commands from findings
107
- - Enhancement/fix commands → suggest `critique` to re-evaluate
108
-
109
- </execution>
110
-
111
- <error_codes>
112
- | Code | Severity | Description |
113
- |------|----------|-------------|
114
- | E001 | error | Invalid sub-command (not in 24 valid commands) |
115
- | E002 | error | No intent or target specified |
116
- | W001 | warning | Harvest failed design knowledge not captured (command still succeeded) |
117
- | W002 | warning | PRODUCT.md missing skill will auto-trigger teach |
118
- </error_codes>
119
-
120
- <success_criteria>
121
- - [ ] Sub-command recognized and routed to maestro-impeccable skill
122
- - [ ] Skill executed with context (spec load --category ui or load-context fallback, register identified)
123
- - [ ] Design changes applied to target files
124
- - [ ] Knowhow entry created in .workflow/knowhow/ (unless --skip-harvest or live)
125
- - [ ] Spec index entry created for DCS-/AST- types
126
- </success_criteria>
25
+ ## Input
26
+
27
+ $ARGUMENTS first word determines mode:
28
+
29
+ | First Word | Mode |
30
+ |------------|------|
31
+ | Known command (see routing table) | Direct |
32
+ | Chain name: build, redesign, improve, enhance, launch, harden, foundation, live | Chain |
33
+ | continue / next / -c | Resume |
34
+ | search | Search: `maestro impeccable search "$REST"` |
35
+ | Free text (concrete task) | Direct craft — has specific target + specs/reference |
36
+ | Free text (project intent) | Intent classify chain |
37
+ | (empty) | Menu: show commands by category |
38
+
39
+ ## Command Routing
40
+
41
+ All workflows at `~/.maestro/workflows/impeccable/{command}.md`:
42
+
43
+ | Command | Category | Description |
44
+ |---------|----------|-------------|
45
+ | craft | Build | Shape then build end-to-end full page/component implementation |
46
+ | shape | Build | Plan UX/UI before code — information architecture, wireframe, visual direction |
47
+ | teach | Build | Set up PRODUCT.md — users, brand, tone, anti-references, principles |
48
+ | document | Build | Generate DESIGN.md from existing code extract tokens, typography, colors |
49
+ | extract | Build | Pull tokens/components into reusable design system |
50
+ | explore | Build | Multi-style comparison — generate variants, render prototypes, visual compare, select/mix |
51
+ | critique | Evaluate | UX heuristic review with Nielsen scoring (/40) + P0/P1 findings |
52
+ | audit | Evaluate | Technical quality checks — a11y, performance, responsive, code quality (/20) |
53
+ | polish | Refine | Final quality pass — micro-adjustments, pixel perfection |
54
+ | bolder | Refine | Amplify bland/safe designs — stronger personality, more contrast |
55
+ | quieter | Refine | Tone down aggressive/overwhelming designs — reduce visual noise |
56
+ | distill | Refine | Strip to essence remove clutter, reduce cognitive load |
57
+ | harden | Refine | Production-ready — error states, i18n, edge cases, overflow, empty states |
58
+ | onboard | Refine | First-run flows, empty states, activation paths, progressive disclosure |
59
+ | animate | Enhance | Add purposeful motion — transitions, micro-interactions, scroll effects |
60
+ | colorize | Enhance | Add strategic color — OKLCH palette, contrast, color strategy |
61
+ | typeset | Enhance | Improve typography — scale, hierarchy, font pairing, line length |
62
+ | layout | Enhance | Fix spacing, rhythm, visual hierarchy, alignment, grid |
63
+ | delight | Enhance | Add personality — memorable details, joy, surprise moments |
64
+ | overdrive | Enhance | Push past conventional limits ambitious visual effects |
65
+ | clarify | Fix | Improve UX copy — labels, error messages, microcopy, CTAs |
66
+ | adapt | Fix | Adapt for devices/screens — responsive, touch targets, breakpoints |
67
+ | optimize | Fix | Fix UI performance loading, rendering, bundle, paint/layout jank |
68
+ | live | Iterate | Browser-based variant iteration real-time design in DevTools |
69
+
70
+ Reference files (loaded by workflow as needed, not standalone commands):
71
+ brand.md, product.md, design.md, codex.md, heuristics-scoring.md, cognitive-load.md,
72
+ color-and-contrast.md, interaction-design.md, motion-design.md, personas.md,
73
+ responsive-design.md, spatial-design.md, typography.md, ux-writing.md
74
+
75
+ ## Chains
76
+
77
+ | Chain | Steps | Scenario |
78
+ |-------|-------|----------|
79
+ | build | teach? → explore? → shape → craft → critique → [refine] → audit → polish | 从零新建 |
80
+ | redesign | document → explore → shape → craft → critique → [refine] → audit → polish | 基于现有代码重设计 |
81
+ | improve | critique [refine] polish audit | 迭代改进 |
82
+ | enhance | {cmd...} → critique → [refine] → polish | 定向增强(支持多命令) |
83
+ | launch | harden → adapt → optimize → audit → polish | 全方位上线准备 |
84
+ | harden | harden → audit → polish | 边界加固 |
85
+ | foundation | teach? explore document → extract | 纯设计系统建设 |
86
+ | live | live | 实时迭代 |
87
+
88
+ - `?` = conditional: teach if PRODUCT.md missing; explore if DESIGN.md missing and --skip-design not set
89
+ - `[refine]` = quality gate loop: gate fails → auto-select fix commands from findings → re-gate
90
+ - `{cmd...}` = enhance 支持多命令,逗号分隔:`enhance colorize,typeset landing-page`
91
+
92
+ Chain flags: --threshold <N> (default 26/40), --max-loops <N> (default 3), --skip-design, --styles <N>, -y
93
+
94
+ ## Free Text Routing
95
+
96
+ Free text 按优先级三层匹配。命中即停,不继续向下。
97
+
98
+ ### Layer 1: 意图匹配单个命令 Direct
99
+
100
+ 将用户描述与 Command Routing 表的 Description 列语义匹配。匹配最接近的**一个**命令。
101
+
102
+ | Intent signal | Command |
103
+ |---------------|---------|
104
+ | 评审, review, 检查UX, 评分, heuristic | critique |
105
+ | 审计, a11y, 可访问性, 技术检查, performance audit, 代码质量 | audit |
106
+ | 加动画, 动效, transitions, micro-interactions, 过渡 | animate |
107
+ | 配色, 颜色, palette, 色彩, OKLCH, contrast | colorize |
108
+ | 字体, 排版, typography, font, 字号, 行高 | typeset |
109
+ | 布局, 间距, spacing, grid, 对齐, alignment, 视觉层次 | layout |
110
+ | 太花, 太吵, tone down, 视觉噪音, 简洁点 | quieter |
111
+ | 太平淡, 加强, 更大胆, more personality, 更有个性 | bolder |
112
+ | 太复杂, 简化, strip, 去掉多余, cognitive load | distill |
113
+ | 打磨, 微调, pixel perfect, final pass, 最终润色 | polish |
114
+ | 文案, copy, 标签, 错误提示, UX writing, microcopy | clarify |
115
+ | 响应式, mobile, 适配, breakpoints, touch targets | adapt |
116
+ | 性能, loading, bundle, 卡顿, jank, 速度 | optimize |
117
+ | 边界, error states, i18n, 溢出, 空状态加固 | harden |
118
+ | 引导, 新手, 首次使用, onboarding, empty state, 激活 | onboard |
119
+ | 趣味, 惊喜, personality, memorable, joy | delight |
120
+ | 炫酷, 极限, extraordinary, 超常规, 技术极限 | overdrive |
121
+ | 规划, plan UX, wireframe, 信息架构, 视觉方向 | shape |
122
+ | 多风格, 变体, variants, compare styles, 风格对比 | explore |
123
+ | 品牌定义, PRODUCT.md, 产品上下文 | teach |
124
+ | 提取设计, DESIGN.md, 设计文档化 | document |
125
+ | 提取组件, pull tokens, 设计系统提取 | extract |
126
+ | 实时, browser iteration, 浏览器迭代 | live |
127
+
128
+ ### Layer 2: 具体构建任务 → Direct craft
129
+
130
+ Layer 1 未命中,但意图是"构建/创建某个具体东西":
131
+ - 包含具体文件路径或目标(`d:\path`, `src/pages/`, `index.html`)
132
+ - 包含详细视觉规格(布局、风格、配色方案)
133
+ - 包含参考素材(`参考...`, `based on...`, `like...`)
134
+
135
+ → 路由到 **craft**(Direct)
136
+
137
+ ### Layer 3: 项目意图 → Chain
138
+
139
+ Layer 1+2 未命中,意图是泛泛的项目方向:
140
+
141
+ | Pattern | Chain |
142
+ |---------|-------|
143
+ | 新建, create, build, new, 从零开始 | build |
144
+ | 重做, redesign, 重新设计, rethink, 换风格, 改版 | redesign |
145
+ | 改进, improve, iterate, better, 迭代 | improve |
146
+ | 增强, enhance, 视觉升级, visual upgrade | enhance |
147
+ | 上线, launch, deploy, ship, 发布准备, production-ready | launch |
148
+ | 加固, harden, 生产化, 边界情况 | harden |
149
+ | 设计系统, design system, tokens, 设计规范, 设计基建 | foundation |
150
+ | 实时, live, browser | live |
151
+
152
+ Ambiguous + no `-y` → AskUserQuestion.
153
+
154
+ ## Prerequisites
155
+
156
+ Before reading any command workflow:
157
+
158
+ 1. **Context**: `maestro spec load --category ui` → if empty → `maestro impeccable load-context`
159
+ 2. **PRODUCT.md**: missing/placeholder (<200 chars / `[TODO]`) → execute teach first, then resume original task
160
+ 3. **Register**: identify brand/product → Read `~/.maestro/workflows/impeccable/{brand|product}.md`
161
+
162
+ ## Direct Execution
163
+
164
+ 1. Prerequisites ✓
165
+ 2. **显示执行信息**:
166
+ ```
167
+ ── Command: {command} ────────────────────
168
+ Category: {category} | Target: {target}
169
+ ─────────────────────────────────────────
170
+ ```
171
+ 3. Read `~/.maestro/workflows/impeccable/{command}.md`
172
+ 4. **TodoWrite 跟踪**:按 workflow 文件中的主要阶段创建 todo 项
173
+ - 格式:`[{command}] {phase description}`
174
+ - 每个阶段完成后立即标记 completed
175
+ 5. Follow workflow file instructions
176
+ 6. Post: suggest logical next command (teach→shape, shape→craft, craft→critique, etc.)
177
+
178
+ ## Chain Execution
179
+
180
+ 1. Prerequisites ✓
181
+ 2. **显示执行链**:解析 chain 定义,输出完整步骤预览:
182
+ ```
183
+ ── Chain: build ──────────────────────────
184
+ 1. teach (conditional: PRODUCT.md missing)
185
+ 2. explore (conditional: DESIGN.md missing)
186
+ 3. shape
187
+ 4. craft
188
+ 5. critique ◆ quality gate (threshold: 26/40)
189
+ 6. [refine] ↺ auto-fix loop (max: 3)
190
+ 7. audit ◆ quality gate (threshold: 14/20)
191
+ 8. polish
192
+ ─────────────────────────────────────────
193
+ Target: {target}
194
+ ```
195
+ - `◆` 标记 quality gate 步骤,显示阈值
196
+ - `↺` 标记 refine loop,显示最大循环次数
197
+ - conditional 步骤注明触发条件
198
+ - 跳过的 conditional 步骤标记 `(skipped)`
199
+ 3. Create session: `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`
200
+ ```json
201
+ { "chain_type": "...", "target": "...", "steps": [...], "current_step": 0,
202
+ "gate_history": [], "loop_count": 0, "status": "running" }
203
+ ```
204
+ 4. **TodoWrite 初始化**:为 chain 所有步骤创建 todo 项
205
+ - 每步一项,格式:`[chain] step N: {command} — {description}`
206
+ - conditional 步骤若跳过,立即标记 completed
207
+ - quality gate 步骤标注阈值:`[chain] step 5: critique ◆ gate ≥26/40`
208
+ 5. For each step:
209
+ - Read `~/.maestro/workflows/impeccable/{command}.md` → execute
210
+ - **步骤开始**:TodoWrite 标记当前步骤 in_progress
211
+ - **步骤完成**:TodoWrite 标记 completed + update status.json (`current_step`, step `status`)
212
+ - **步骤失败**:TodoWrite 标记 completed(with note) + 记录原因
213
+ 6. **Quality gate** (critique/audit steps):
214
+ - Parse score: critique `**Total** | | **N/40**`, audit `**Total** | | **N/20**`
215
+ - Count `[P0]` / `[P1]` tags
216
+ - Pass: score ≥ threshold AND P0 == 0 → advance
217
+ - Fail: collect suggested commands from findings → execute → re-gate
218
+ - Max loops exceeded → force advance with warning
219
+ - TodoWrite:gate 结果记入当前步骤备注(score, P0/P1 count, pass/fail)
220
+ 7. Final report: scores + trend + commands executed
221
+
222
+ ## Resume
223
+
224
+ Scan `.workflow/.maestro/ui-craft-*/status.json` for `status == "running"` → most recent → resume from `current_step`.
225
+
226
+ ## Quality Gate — Finding → Command Fallback
227
+
228
+ When findings lack explicit suggested command:
229
+
230
+ | Finding Category | Command |
231
+ |-----------------|---------|
232
+ | Layout, spacing, hierarchy, alignment | layout |
233
+ | Color, contrast, palette | colorize |
234
+ | Typography, font, readability | typeset |
235
+ | Animation, motion, transitions | animate |
236
+ | Copy, labels, UX writing | clarify |
237
+ | Responsive, mobile, breakpoints | adapt |
238
+ | Performance, loading, speed | optimize |
239
+ | Complexity, overload, clutter | distill |
240
+ | Bland, safe, generic | bolder |
241
+ | Aggressive, overwhelming | quieter |
242
+ | Onboarding, empty state | onboard |
243
+ | Edge cases, i18n, error handling | harden |
244
+ | Personality, memorability | delight |
245
+
246
+ Never auto-select: teach, shape, craft, live, document, extract, overdrive, critique, audit.
@@ -104,7 +104,7 @@ Follow `~/.maestro/workflows/spec-generate.md` completely.
104
104
  |-----------|-----------|
105
105
  | Roadmap approved, need analysis | /maestro-analyze 1 |
106
106
  | Simple project, ready to plan | /maestro-plan 1 |
107
- | Need UI design first | /maestro-ui-craft --chain build |
107
+ | Need UI design first | /maestro-impeccable build |
108
108
  | View project dashboard | /manage-status |
109
109
  | Need project setup (full mode) | /maestro-init |
110
110
  </execution>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow-one",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "All Maestro workflow commands as a single Claude Code skill — intent routing, decision gates, minimal closed-loop chains",
5
5
  "bin": {
6
6
  "maestro-flow": "bin/maestro-flow.js"
@@ -1,416 +0,0 @@
1
- ---
2
- name: maestro-ui-craft
3
- description: Chain maestro-impeccable commands with intelligent routing and quality gate loops for automated UI production
4
- argument-hint: "<intent|target> [--chain build|improve|enhance|harden|live] [--enhance <cmd>] [--threshold <score>] [--max-loops <n>] [--skip-design-explore] [--skip-design] [--styles <N>] [--stack <stack>] [-y] [-c]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Edit
9
- - Bash
10
- - Glob
11
- - Grep
12
- - Agent
13
- - Skill
14
- - AskUserQuestion
15
- - TodoWrite
16
- ---
17
- <purpose>
18
- Orchestrate maestro-impeccable skill commands via intelligent intent routing + quality gate auto-iteration.
19
- Chain: Build → Evaluate → Auto-Refine → Re-evaluate → Verify.
20
-
21
- Core innovation: critique/audit scores drive automatic command selection and iteration loops.
22
- Impeccable has 23 commands across 6 categories — this command chains them into automated pipelines
23
- with quality gates that loop until design quality meets the threshold.
24
-
25
- Includes integrated design-explore: multi-variant design system generation (via ui-search BM25 engine + CSV knowledge base),
26
- HTML prototype rendering for visual comparison, interactive user review with mix support,
27
- and automatic bridge to impeccable's DESIGN.md format. Replaces the former maestro-ui-design command.
28
-
29
- Prerequisite: maestro-impeccable skill available (auto-discovered by harness).
30
-
31
- Session: `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`
32
- </purpose>
33
-
34
- <deferred_reading>
35
- - [impeccable harvest workflow](~/.maestro/workflows/impeccable.md) — read after command execution for harvest logic
36
- - [design stage workflow](~/.maestro/workflows/impeccable/design.md) — read when S_DESIGN_EXPLORE or S_BRIDGE state entered
37
- </deferred_reading>
38
-
39
- <invariants>
40
- 1. **Session before execution** — status.json created before any chain step runs
41
- 2. **All steps via Skill** — every impeccable command dispatched through `Skill({ skill: "maestro-impeccable" })`
42
- 3. **Gate scores drive loops** — refine loop auto-selects commands from P0/P1 findings, never from hardcoded lists
43
- 4. **Interactive gates respected** — teach, shape, craft retain their user gates; never suppress
44
- </invariants>
45
-
46
- <context>
47
- $ARGUMENTS — intent description or target path, with optional flags.
48
-
49
- **Keywords:** `continue`/`next` → resume previous session
50
-
51
- **Flags:**
52
- - `--chain <type>` — Force chain type: build, improve, enhance, harden, live
53
- - `--enhance <cmd>` — Specific enhance command for enhance chain (animate|colorize|typeset|layout|delight|overdrive|bolder)
54
- - `--threshold <score>` — Critique pass threshold (default: 26/40). Audit threshold auto-computed as threshold×0.5
55
- - `--max-loops <n>` — Maximum quality gate iterations (default: 3)
56
- - `-c` / `--continue` — Resume previous ui-craft session
57
- - `-y` — Auto mode: auto-select at ambiguous routing, skip confirmations where impeccable allows
58
- - `--skip-design-explore` / `--skip-design` — Skip design-explore (prototype comparison) and bridge (use existing DESIGN.md or full shape interview)
59
- - `--styles <N>` — Number of design system variants to generate and compare (2-5, default 3). Only used in build chain design-explore step
60
- - `--stack <stack>` — Tech stack for supplementary guidelines (default: html-tailwind). Passed to ui-search
61
- </context>
62
-
63
- <chains>
64
-
65
- ### Chain Definitions
66
-
67
- | Chain | Sequence | Gate Condition |
68
- |-------|----------|----------------|
69
- | **build** | teach? → **design_explore?** → shape → craft → **critique** → [refine loop] → audit → polish | critique ≥ threshold AND P0 == 0 |
70
- | **improve** | **critique** → [refine loop] → polish → audit | critique ≥ threshold AND P0 == 0 |
71
- | **enhance** | {cmd} → **critique** → polish (if needed) | critique ≥ threshold |
72
- | **harden** | harden → **audit** → polish | audit ≥ threshold×0.5 |
73
- | **live** | live | — (interactive, no gate) |
74
-
75
- - `teach?` — conditional: only if PRODUCT.md missing/placeholder
76
- - `design_explore?` — conditional: only if DESIGN.md missing AND `--skip-design-explore` not set. Delegates to `Skill("maestro-impeccable", "explore")` which handles variant generation, prototype rendering, visual comparison, user selection/mix, AND bridge to DESIGN.md internally
77
- - `[refine loop]` — quality gate loop: extract suggested commands from critique → execute → re-critique
78
-
79
- ### Intent → Chain Routing
80
-
81
- | Intent Pattern | Chain |
82
- |---------------|-------|
83
- | 新建, create, build, new, 从零, landing, feature, page | build |
84
- | 设计, design, 风格, style, 设计系统, design system, 视觉, theme | build |
85
- | 改进, improve, fix, 优化, iterate, better, 迭代 | improve |
86
- | 动画, 颜色, 排版, animate, color, type, bold, delight, enhance | enhance |
87
- | 生产, production, harden, 上线, ship, edge case, i18n | harden |
88
- | 实时, live, browser, 浏览器, variant | live |
89
-
90
- Explicit `--chain` overrides routing. Ambiguous + no `-y` → AskUserQuestion.
91
-
92
- </chains>
93
-
94
- <state_machine>
95
-
96
- <states>
97
- S_PARSE — 解析参数、意图分类、chain 选择 PERSIST: —
98
- S_RESUME — 扫描已有 ui-craft session、恢复执行 PERSIST: —
99
- S_SETUP — 加载 context、检查 PRODUCT.md PERSIST: —
100
- S_CREATE — 创建 session + status.json PERSIST: session (全量)
101
- S_DESIGN_EXPLORE — 委托 impeccable explore:多变体生成、原型对比、选型/混搭、自动 bridge 到 DESIGN.md PERSIST: explore_completed, design_md_path
102
- S_CHAIN — 按序执行 chain 步骤 PERSIST: step progress, executed commands
103
- S_GATE — 质量门控:解析评分、决策 PERSIST: scores, loop count
104
- S_REFINE — 执行自动选取的 refine 命令 PERSIST: refine commands, loop state
105
- S_REPORT — 最终报告 + 趋势 PERSIST: final scores, status
106
- </states>
107
-
108
- <transitions>
109
-
110
- S_PARSE:
111
- → S_RESUME WHEN: -c / --continue flag OR keyword "continue"/"next"
112
- → S_SETUP WHEN: chain selected (explicit or routed)
113
- → S_PARSE WHEN: ambiguous AND not -y DO: AskUserQuestion
114
- → END WHEN: no intent AND no target → E002
115
-
116
- S_RESUME:
117
- → S_CHAIN WHEN: session found DO: A_LOCATE_SESSION
118
- → S_FALLBACK WHEN: no session found → E005
119
-
120
- S_SETUP:
121
- → S_CREATE DO: A_LOAD_CONTEXT
122
-
123
- S_CREATE:
124
- → S_CHAIN DO: A_CREATE_SESSION
125
-
126
- S_CHAIN:
127
- → S_DESIGN_EXPLORE WHEN: current step is 'design_explore' AND DESIGN.md missing AND --skip-design-explore not set AND --skip-design not set
128
- → S_GATE WHEN: current step is gate command (critique/audit)
129
- → S_CHAIN WHEN: step is design_explore but skip conditions met → advance
130
- → S_CHAIN WHEN: step is normal command → execute → advance
131
- → S_REPORT WHEN: all steps complete
132
-
133
- S_DESIGN_EXPLORE:
134
- → S_CHAIN WHEN: explore completed (DESIGN.md produced) → advance to shape
135
- → S_CHAIN WHEN: explore failed → W004 → advance to shape (full interview fallback)
136
-
137
- S_GATE:
138
- → S_CHAIN WHEN: PASS (score ≥ threshold AND P0 == 0) → advance to next step
139
- → S_REFINE WHEN: FAIL (score < threshold OR P0 > 0)
140
- → S_CHAIN WHEN: max loops exceeded → W002 → force advance
141
-
142
- S_REFINE:
143
- → S_GATE DO: execute auto-selected commands → re-run gate command
144
- GUARD: loop_count < max_loops
145
-
146
- S_REPORT:
147
- → END DO: A_FINAL_REPORT
148
-
149
- </transitions>
150
-
151
- <actions>
152
-
153
- ### A_LOCATE_SESSION
154
-
155
- 1. Scan `.workflow/.maestro/ui-craft-*/status.json`, filter `status == "running"`, sort DESC
156
- 2. Take most recent; load into context as current session
157
- 3. Resume from `current_step` position
158
-
159
- ### A_LOAD_CONTEXT
160
-
161
- 1. Trigger impeccable context loading by invoking: `Skill({ skill: "maestro-impeccable", args: "teach" })`
162
- - Impeccable's own setup will auto-discover and load PRODUCT.md / DESIGN.md
163
- - If PRODUCT.md missing/placeholder, impeccable teach handles the interview
164
- 2. If teach was not in the chain but PRODUCT.md is missing:
165
- - Prepend `teach` to chain start
166
- - Announce: W001
167
- 3. Context is now in conversation for subsequent commands
168
-
169
- ### A_CREATE_SESSION
170
-
171
- 1. Read `.workflow/state.json` for project context (phase, milestone)
172
- 2. Create `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`:
173
- ```json
174
- { "session_id": "ui-craft-{ts}", "source": "ui-craft", "intent": "...",
175
- "chain_type": "build|improve|enhance|harden|live", "target": "...",
176
- "auto_mode": false, "threshold": 26, "max_loops": 3,
177
- "steps": [{ "index": 0, "command": "shape", "status": "pending" }],
178
- "gate_history": [], "loop_count": 0,
179
- "current_step": 0, "status": "running",
180
- "created_at": "ISO-8601", "updated_at": "ISO-8601" }
181
- ```
182
- 3. Write status.json before executing any step
183
-
184
- ### A_DESIGN_EXPLORE
185
-
186
- Delegate to impeccable explore as a black-box command. The explore command internally handles:
187
- variant generation, prototype rendering, visual comparison, user review, mix protocol, rejected variant harvest, bridge to DESIGN.md, and spec registration.
188
-
189
- 1. Execute: `Skill({ skill: "maestro-impeccable", args: "explore --styles {styles_count}" })`
190
- 2. On completion: verify `.workflow/impeccable/DESIGN.md` exists
191
- 3. Update status.json: `explore_completed: true`, `design_md_path`
192
-
193
- ### A_FINAL_REPORT
194
-
195
- 1. Read critique trend if available (impeccable's critique persists snapshots automatically)
196
- 2. Update status.json with `status: "completed"` and final scores
197
- 3. Present summary table with scores, iterations, commands executed
198
-
199
- </actions>
200
-
201
- </state_machine>
202
-
203
- <execution>
204
-
205
- ## 1. Parse & Route
206
-
207
- 1. If `-c` / `--continue` or keyword "continue"/"next" → S_RESUME
208
- 2. If `--chain` present → use directly
209
- 3. Otherwise → match $ARGUMENTS against intent patterns
210
- 4. If `--enhance` present → chain = enhance, cmd = --enhance value
211
- 5. For enhance chain without `--enhance` → infer from intent ("动画" → animate, "颜色" → colorize, etc.)
212
- 6. Ambiguous + no `-y` → ask user to pick chain
213
-
214
- Create TodoWrite with chain steps.
215
-
216
- ## 2. Setup Context
217
-
218
- 1. If chain starts with `teach` → execute it first, impeccable handles context loading internally
219
- 2. Otherwise → invoke `Skill({ skill: "maestro-impeccable" })` with no args to trigger setup (context + register)
220
- 3. If impeccable reports PRODUCT.md missing → prepend teach, execute, then resume
221
-
222
- ## 3. Create Session
223
-
224
- Write `.workflow/.maestro/ui-craft-{ts}/status.json` with chain steps before any execution.
225
-
226
- ## 4. Execute Chain
227
-
228
- For each step in chain, sequentially:
229
-
230
- ```
231
- ▸ Step {n}/{total}: /maestro-impeccable {command} {target}
232
- ```
233
-
234
- Execute via: `Skill({ skill: "maestro-impeccable", args: "{command} {target}" })`
235
-
236
- After each step: update status.json `current_step` and step `status`.
237
-
238
- **Step-specific logic:**
239
-
240
- ### 4a. Design-explore step (build chain only)
241
-
242
- When current step is `design_explore`:
243
-
244
- 1. Check if `.workflow/impeccable/DESIGN.md` already exists → skip, advance to shape
245
- 2. Check if `--skip-design-explore` or `--skip-design` is set → skip, advance to shape
246
- 3. Otherwise → execute A_DESIGN_EXPLORE:
247
- - `Skill({ skill: "maestro-impeccable", args: "explore --styles {styles_count}" })`
248
- - explore handles everything internally: variant generation, prototype rendering, visual comparison, user selection/mix, bridge to DESIGN.md, spec registration
249
- 4. On completion → verify DESIGN.md exists, advance to shape
250
- 5. On failure → W004, advance to shape (full interview fallback, no DESIGN.md)
251
-
252
- ### 4c. Normal steps
253
-
254
- - `teach`, `shape`, `craft` are interactive — do NOT suppress their user gates
255
- - After `teach` completes → re-run context loader for fresh PRODUCT.md
256
- - After `craft` completes → the build exists, ready for evaluation
257
- - Gate steps (critique/audit) → transition to quality gate logic (Section 5)
258
-
259
- ## 5. Quality Gate
260
-
261
- When chain reaches a gate step (critique or audit):
262
-
263
- ### 5a. Execute Gate Command
264
-
265
- ```
266
- Skill({ skill: "maestro-impeccable", args: "critique {target}" })
267
- ```
268
- or
269
- ```
270
- Skill({ skill: "maestro-impeccable", args: "audit {target}" })
271
- ```
272
-
273
- ### 5b. Parse Score
274
-
275
- From critique output, extract:
276
- - **score**: Nielsen's total (N/40) — from "**Total** | | **N/40**" row
277
- - **P0_count**: count of `[P0]` tagged findings
278
- - **P1_count**: count of `[P1]` tagged findings
279
- - **suggested_commands**: list of "/maestro-impeccable <cmd>" from "Suggested command" fields
280
-
281
- From audit output, extract:
282
- - **score**: dimension total (N/20) — from "**Total** | | **N/20**" row
283
- - **P0_count**: count of `[P0]` findings
284
-
285
- ### 5c. Evaluate
286
-
287
- ```
288
- critique_pass = (score >= threshold) AND (P0_count == 0)
289
- audit_pass = (score >= threshold * 0.5) AND (P0_count == 0)
290
- ```
291
-
292
- ### 5d. On PASS
293
-
294
- ```
295
- ✓ Gate passed: {score}/{max} (P0: 0)
296
- ```
297
- → advance to next chain step
298
-
299
- ### 5e. On FAIL
300
-
301
- ```
302
- ⟳ Loop {n}/{max_loops}: {score}/{max}, P0={count}
303
- Running: {command_list}
304
- ```
305
-
306
- 1. Collect suggested commands from P0/P1 findings
307
- 2. If no suggestions found → use fallback mapping (see quality_gate_routing)
308
- 3. De-duplicate, cap at 3 commands per iteration
309
- 4. Sort: P0-suggested first
310
- 5. Execute each: `Skill({ skill: "maestro-impeccable", args: "{cmd} {target}" })`
311
- - Pass issue context: the specific findings that triggered this command are already in conversation
312
- 6. Re-run gate command (critique/audit)
313
- 7. Increment loop_count
314
- 8. Append to status.json `gate_history`
315
-
316
- ### 5f. On Max Loops Exceeded
317
-
318
- ```
319
- ⚠ Max iterations ({max_loops}) reached. Score: {score}/{max}, P0: {count}
320
- Continuing chain with remaining issues.
321
- ```
322
- → force advance to next chain step
323
-
324
- ## 6. Final Report
325
-
326
- ```
327
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
328
- Chain complete: {chain_type}
329
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
330
-
331
- Critique : {score}/40 (trend: {trend_line})
332
- Audit : {score}/20
333
- Loops : {total_iterations}
334
- Commands : {executed_command_list}
335
-
336
- Status : {PASS | PARTIAL — N issues remain}
337
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
338
- ```
339
-
340
- Update status.json: `status: "completed"`, `final_scores`, `completed_at`.
341
-
342
- If issues remain → suggest: "Run `/maestro-ui-craft --chain improve {target}` to continue iteration."
343
-
344
- </execution>
345
-
346
- <quality_gate_routing>
347
-
348
- ### Finding → Command Fallback Mapping
349
-
350
- When critique/audit findings lack explicit "Suggested command", map by category:
351
-
352
- | Finding Category | Command |
353
- |-----------------|---------|
354
- | Visual hierarchy, layout, spacing, alignment | layout |
355
- | Color, contrast, palette, monochromatic | colorize |
356
- | Typography, font, readability, hierarchy | typeset |
357
- | Animation, motion, transitions, micro-interaction | animate |
358
- | Copy, labels, error messages, UX writing | clarify |
359
- | Responsive, mobile, breakpoints, touch targets | adapt |
360
- | Performance, loading, speed, bundle, jank | optimize |
361
- | Complexity, overload, clutter, cognitive load | distill |
362
- | Bland, safe, generic, lacks personality | bolder |
363
- | Aggressive, overwhelming, loud, overstimulating | quieter |
364
- | Onboarding, empty state, first-run, activation | onboard |
365
- | Edge cases, i18n, error handling, overflow | harden |
366
- | Personality, memorability, joy, delight | delight |
367
-
368
- ### Commands Never Auto-Selected
369
-
370
- These are structural/interactive — never picked by the refine loop:
371
-
372
- | Command | Reason |
373
- |---------|--------|
374
- | teach | Project setup (run in S_SETUP only) |
375
- | shape | Requires user interview |
376
- | craft | Full build with multiple gates |
377
- | live | Interactive browser mode |
378
- | document | Generates DESIGN.md (setup) |
379
- | extract | Design system extraction (setup) |
380
- | overdrive | Requires explicit user vision |
381
- | critique | Gate command, not a fix |
382
- | audit | Gate command, not a fix |
383
- | design | Design system generation (setup) |
384
- | bridge | Format bridging (setup) |
385
-
386
- </quality_gate_routing>
387
-
388
- <error_codes>
389
- | Code | Severity | Description |
390
- |------|----------|-------------|
391
- | E001 | error | Impeccable skill not found in project |
392
- | E002 | error | No intent or target specified |
393
- | E003 | error | Invalid --chain type |
394
- | E004 | error | Invalid --enhance command |
395
- | E005 | error | Resume session not found |
396
- | W001 | warning | PRODUCT.md missing, prepending teach to chain |
397
- | W002 | warning | Max quality gate loops exceeded, forcing continue |
398
- | W003 | warning | Could not parse score from critique/audit output |
399
- | E006 | error | Python 3 not available for design system generation |
400
- | E007 | error | ui-search scripts not found at expected path |
401
- | W004 | warning | Design system generation failed, skipping design+bridge, falling back to shape full interview |
402
- | W005 | warning | Bridge transformation failed, continuing without DESIGN.md |
403
- | W008 | warning | Node.js not available for prototype rendering, falling back to text-only variant comparison |
404
- </error_codes>
405
-
406
- <success_criteria>
407
- - [ ] Intent classified and chain type selected
408
- - [ ] Context loaded (PRODUCT.md present or taught)
409
- - [ ] Session dir created with status.json before execution
410
- - [ ] All chain steps executed via Skill("maestro-impeccable", ...)
411
- - [ ] Quality gate evaluated with parsed scores
412
- - [ ] Refine loop executed when gate failed (if applicable)
413
- - [ ] Gate history and scores persisted to status.json
414
- - [ ] Final report with scores and trend presented
415
- - [ ] Progress tracked via TodoWrite throughout
416
- </success_criteria>