maestro-flow 0.3.46 → 0.3.48

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 (241) hide show
  1. package/.claude/agents/ui-design-agent.md +1 -0
  2. package/.claude/agents/workflow-executor.md +3 -0
  3. package/.claude/commands/learn-decompose.md +91 -146
  4. package/.claude/commands/learn-follow.md +102 -137
  5. package/.claude/commands/learn-investigate.md +102 -167
  6. package/.claude/commands/learn-retro.md +100 -243
  7. package/.claude/commands/learn-second-opinion.md +95 -135
  8. package/.claude/commands/maestro-amend.md +95 -232
  9. package/.claude/commands/maestro-analyze.md +1 -6
  10. package/.claude/commands/maestro-collab.md +104 -265
  11. package/.claude/commands/maestro-composer.md +113 -293
  12. package/.claude/commands/maestro-execute.md +10 -17
  13. package/.claude/commands/maestro-impeccable.md +89 -0
  14. package/.claude/commands/maestro-plan.md +1 -6
  15. package/.claude/commands/maestro-player.md +111 -340
  16. package/.claude/commands/maestro-quick.md +9 -0
  17. package/.claude/commands/maestro-ralph-execute.md +167 -210
  18. package/.claude/commands/maestro-ralph.md +245 -426
  19. package/.claude/commands/maestro-ui-codify.md +13 -0
  20. package/.claude/commands/maestro-ui-craft.md +364 -0
  21. package/.claude/commands/maestro-ui-design.md +12 -1
  22. package/.claude/commands/maestro-verify.md +12 -13
  23. package/.claude/commands/maestro.md +142 -72
  24. package/.claude/commands/manage-knowhow-capture.md +45 -170
  25. package/.claude/commands/quality-auto-test.md +9 -0
  26. package/.claude/commands/quality-debug.md +11 -25
  27. package/.claude/commands/quality-refactor.md +9 -0
  28. package/.claude/commands/quality-review.md +5 -14
  29. package/.claude/commands/spec-add.md +1 -1
  30. package/.claude/commands/spec-load.md +3 -2
  31. package/.claude/skills/maestro-impeccable/SKILL.md +169 -0
  32. package/.codex/skills/learn-decompose/SKILL.md +1 -1
  33. package/.codex/skills/learn-investigate/SKILL.md +2 -1
  34. package/.codex/skills/maestro/SKILL.md +420 -313
  35. package/.codex/skills/maestro-analyze/SKILL.md +126 -417
  36. package/.codex/skills/maestro-brainstorm/SKILL.md +129 -451
  37. package/.codex/skills/maestro-collab/SKILL.md +134 -547
  38. package/.codex/skills/maestro-execute/SKILL.md +3 -1
  39. package/.codex/skills/maestro-impeccable/SKILL.md +112 -0
  40. package/.codex/skills/maestro-plan/SKILL.md +88 -437
  41. package/.codex/skills/maestro-player/SKILL.md +191 -333
  42. package/.codex/skills/maestro-quick/SKILL.md +2 -0
  43. package/.codex/skills/maestro-ralph/SKILL.md +327 -710
  44. package/.codex/skills/maestro-roadmap/SKILL.md +201 -518
  45. package/.codex/skills/maestro-ui-codify/SKILL.md +1 -0
  46. package/.codex/skills/maestro-ui-craft/SKILL.md +341 -0
  47. package/.codex/skills/maestro-ui-design/SKILL.md +10 -0
  48. package/.codex/skills/maestro-verify/SKILL.md +116 -409
  49. package/.codex/skills/quality-auto-test/SKILL.md +145 -443
  50. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  51. package/.codex/skills/quality-test/SKILL.md +229 -517
  52. package/.codex/skills/spec-add/SKILL.md +1 -1
  53. package/README.md +4 -1
  54. package/README.zh-CN.md +3 -1
  55. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +3 -0
  56. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  57. package/dashboard/dist-server/dashboard/src/server/routes/install.js +110 -1
  58. package/dashboard/dist-server/dashboard/src/server/routes/install.js.map +1 -1
  59. package/dashboard/dist-server/dashboard/src/server/routes/settings.js +56 -0
  60. package/dashboard/dist-server/dashboard/src/server/routes/settings.js.map +1 -1
  61. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +2 -0
  62. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  63. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +2 -2
  64. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -1
  65. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +2 -0
  66. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  67. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +3 -1
  68. package/dashboard/dist-server/dashboard/src/shared/constants.d.ts +2 -0
  69. package/dashboard/dist-server/dashboard/src/shared/constants.js +2 -0
  70. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  71. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  72. package/dist/src/agents/cli-agent-runner.js +1 -3
  73. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  74. package/dist/src/agents/cli-history-store.d.ts +5 -0
  75. package/dist/src/agents/cli-history-store.d.ts.map +1 -1
  76. package/dist/src/agents/cli-history-store.js +65 -13
  77. package/dist/src/agents/cli-history-store.js.map +1 -1
  78. package/dist/src/cli.js +13 -0
  79. package/dist/src/cli.js.map +1 -1
  80. package/dist/src/commands/command-help.d.ts +3 -0
  81. package/dist/src/commands/command-help.d.ts.map +1 -0
  82. package/dist/src/commands/command-help.js +60 -0
  83. package/dist/src/commands/command-help.js.map +1 -0
  84. package/dist/src/commands/config.d.ts.map +1 -1
  85. package/dist/src/commands/config.js +17 -0
  86. package/dist/src/commands/config.js.map +1 -1
  87. package/dist/src/commands/delegate.d.ts.map +1 -1
  88. package/dist/src/commands/delegate.js +12 -2
  89. package/dist/src/commands/delegate.js.map +1 -1
  90. package/dist/src/commands/impeccable.d.ts +10 -0
  91. package/dist/src/commands/impeccable.d.ts.map +1 -0
  92. package/dist/src/commands/impeccable.js +181 -0
  93. package/dist/src/commands/impeccable.js.map +1 -0
  94. package/dist/src/commands/spec.js +1 -1
  95. package/dist/src/commands/spec.js.map +1 -1
  96. package/dist/src/commands/wiki.d.ts.map +1 -1
  97. package/dist/src/commands/wiki.js +5 -1
  98. package/dist/src/commands/wiki.js.map +1 -1
  99. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  100. package/dist/src/config/cli-tools-config.js +10 -7
  101. package/dist/src/config/cli-tools-config.js.map +1 -1
  102. package/dist/src/core/addon-registry.d.ts +31 -0
  103. package/dist/src/core/addon-registry.d.ts.map +1 -0
  104. package/dist/src/core/addon-registry.js +28 -0
  105. package/dist/src/core/addon-registry.js.map +1 -0
  106. package/dist/src/hooks/plugins/spec-injection-plugin.js +2 -0
  107. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  108. package/dist/src/hooks/spec-injector.js +2 -2
  109. package/dist/src/hooks/spec-injector.js.map +1 -1
  110. package/dist/src/index.d.ts +2 -0
  111. package/dist/src/index.d.ts.map +1 -1
  112. package/dist/src/index.js +1 -0
  113. package/dist/src/index.js.map +1 -1
  114. package/dist/src/tools/impeccable/critique-storage.d.ts +28 -0
  115. package/dist/src/tools/impeccable/critique-storage.d.ts.map +1 -0
  116. package/dist/src/tools/impeccable/critique-storage.js +120 -0
  117. package/dist/src/tools/impeccable/critique-storage.js.map +1 -0
  118. package/dist/src/tools/impeccable/design-parser.d.ts +90 -0
  119. package/dist/src/tools/impeccable/design-parser.d.ts.map +1 -0
  120. package/dist/src/tools/impeccable/design-parser.js +696 -0
  121. package/dist/src/tools/impeccable/design-parser.js.map +1 -0
  122. package/dist/src/tools/impeccable/detect-csp.d.ts +6 -0
  123. package/dist/src/tools/impeccable/detect-csp.d.ts.map +1 -0
  124. package/dist/src/tools/impeccable/detect-csp.js +130 -0
  125. package/dist/src/tools/impeccable/detect-csp.js.map +1 -0
  126. package/dist/src/tools/impeccable/is-generated.d.ts +4 -0
  127. package/dist/src/tools/impeccable/is-generated.d.ts.map +1 -0
  128. package/dist/src/tools/impeccable/is-generated.js +56 -0
  129. package/dist/src/tools/impeccable/is-generated.js.map +1 -0
  130. package/dist/src/tools/impeccable/live/accept.d.ts +50 -0
  131. package/dist/src/tools/impeccable/live/accept.d.ts.map +1 -0
  132. package/dist/src/tools/impeccable/live/accept.js +556 -0
  133. package/dist/src/tools/impeccable/live/accept.js.map +1 -0
  134. package/dist/src/tools/impeccable/live/bootstrap.d.ts +2 -0
  135. package/dist/src/tools/impeccable/live/bootstrap.d.ts.map +1 -0
  136. package/dist/src/tools/impeccable/live/bootstrap.js +244 -0
  137. package/dist/src/tools/impeccable/live/bootstrap.js.map +1 -0
  138. package/dist/src/tools/impeccable/live/complete.d.ts +7 -0
  139. package/dist/src/tools/impeccable/live/complete.d.ts.map +1 -0
  140. package/dist/src/tools/impeccable/live/complete.js +67 -0
  141. package/dist/src/tools/impeccable/live/complete.js.map +1 -0
  142. package/dist/src/tools/impeccable/live/completion.d.ts +24 -0
  143. package/dist/src/tools/impeccable/live/completion.d.ts.map +1 -0
  144. package/dist/src/tools/impeccable/live/completion.js +26 -0
  145. package/dist/src/tools/impeccable/live/completion.js.map +1 -0
  146. package/dist/src/tools/impeccable/live/inject.d.ts +41 -0
  147. package/dist/src/tools/impeccable/live/inject.d.ts.map +1 -0
  148. package/dist/src/tools/impeccable/live/inject.js +394 -0
  149. package/dist/src/tools/impeccable/live/inject.js.map +1 -0
  150. package/dist/src/tools/impeccable/live/poll.d.ts +24 -0
  151. package/dist/src/tools/impeccable/live/poll.d.ts.map +1 -0
  152. package/dist/src/tools/impeccable/live/poll.js +180 -0
  153. package/dist/src/tools/impeccable/live/poll.js.map +1 -0
  154. package/dist/src/tools/impeccable/live/resume.d.ts +5 -0
  155. package/dist/src/tools/impeccable/live/resume.d.ts.map +1 -0
  156. package/dist/src/tools/impeccable/live/resume.js +30 -0
  157. package/dist/src/tools/impeccable/live/resume.js.map +1 -0
  158. package/dist/src/tools/impeccable/live/server.d.ts +6 -0
  159. package/dist/src/tools/impeccable/live/server.d.ts.map +1 -0
  160. package/dist/src/tools/impeccable/live/server.js +867 -0
  161. package/dist/src/tools/impeccable/live/server.js.map +1 -0
  162. package/dist/src/tools/impeccable/live/session-store.d.ts +72 -0
  163. package/dist/src/tools/impeccable/live/session-store.d.ts.map +1 -0
  164. package/dist/src/tools/impeccable/live/session-store.js +281 -0
  165. package/dist/src/tools/impeccable/live/session-store.js.map +1 -0
  166. package/dist/src/tools/impeccable/live/static/live-browser-session.js +123 -0
  167. package/dist/src/tools/impeccable/live/static/live-browser.js +4860 -0
  168. package/dist/src/tools/impeccable/live/static/modern-screenshot.umd.js +14 -0
  169. package/dist/src/tools/impeccable/live/status.d.ts +2 -0
  170. package/dist/src/tools/impeccable/live/status.d.ts.map +1 -0
  171. package/dist/src/tools/impeccable/live/status.js +52 -0
  172. package/dist/src/tools/impeccable/live/status.js.map +1 -0
  173. package/dist/src/tools/impeccable/live/wrap.d.ts +33 -0
  174. package/dist/src/tools/impeccable/live/wrap.d.ts.map +1 -0
  175. package/dist/src/tools/impeccable/live/wrap.js +572 -0
  176. package/dist/src/tools/impeccable/live/wrap.js.map +1 -0
  177. package/dist/src/tools/impeccable/load-context.d.ts +13 -0
  178. package/dist/src/tools/impeccable/load-context.d.ts.map +1 -0
  179. package/dist/src/tools/impeccable/load-context.js +79 -0
  180. package/dist/src/tools/impeccable/load-context.js.map +1 -0
  181. package/dist/src/tools/impeccable/paths.d.ts +34 -0
  182. package/dist/src/tools/impeccable/paths.d.ts.map +1 -0
  183. package/dist/src/tools/impeccable/paths.js +102 -0
  184. package/dist/src/tools/impeccable/paths.js.map +1 -0
  185. package/dist/src/tools/spec-entry-parser.d.ts +1 -1
  186. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
  187. package/dist/src/tools/spec-entry-parser.js +1 -1
  188. package/dist/src/tools/spec-entry-parser.js.map +1 -1
  189. package/dist/src/tools/spec-init.d.ts.map +1 -1
  190. package/dist/src/tools/spec-init.js +26 -1
  191. package/dist/src/tools/spec-init.js.map +1 -1
  192. package/dist/src/tools/spec-loader.d.ts +1 -1
  193. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  194. package/dist/src/tools/spec-loader.js +2 -0
  195. package/dist/src/tools/spec-loader.js.map +1 -1
  196. package/package.json +2 -2
  197. package/workflows/claude-instructions.md +17 -5
  198. package/workflows/cli-tools-usage.md +10 -3
  199. package/workflows/delegate-usage.md +3 -2
  200. package/workflows/impeccable/adapt.md +190 -0
  201. package/workflows/impeccable/animate.md +175 -0
  202. package/workflows/impeccable/audit.md +133 -0
  203. package/workflows/impeccable/bolder.md +113 -0
  204. package/workflows/impeccable/brand.md +118 -0
  205. package/workflows/impeccable/clarify.md +174 -0
  206. package/workflows/impeccable/codex.md +105 -0
  207. package/workflows/impeccable/cognitive-load.md +106 -0
  208. package/workflows/impeccable/color-and-contrast.md +105 -0
  209. package/workflows/impeccable/colorize.md +154 -0
  210. package/workflows/impeccable/craft.md +123 -0
  211. package/workflows/impeccable/critique.md +261 -0
  212. package/workflows/impeccable/delight.md +302 -0
  213. package/workflows/impeccable/distill.md +111 -0
  214. package/workflows/impeccable/document.md +439 -0
  215. package/workflows/impeccable/extract.md +69 -0
  216. package/workflows/impeccable/harden.md +347 -0
  217. package/workflows/impeccable/heuristics-scoring.md +234 -0
  218. package/workflows/impeccable/interaction-design.md +195 -0
  219. package/workflows/impeccable/layout.md +141 -0
  220. package/workflows/impeccable/live.md +622 -0
  221. package/workflows/impeccable/motion-design.md +109 -0
  222. package/workflows/impeccable/onboard.md +234 -0
  223. package/workflows/impeccable/optimize.md +258 -0
  224. package/workflows/impeccable/overdrive.md +130 -0
  225. package/workflows/impeccable/personas.md +179 -0
  226. package/workflows/impeccable/polish.md +242 -0
  227. package/workflows/impeccable/product.md +62 -0
  228. package/workflows/impeccable/quieter.md +99 -0
  229. package/workflows/impeccable/responsive-design.md +114 -0
  230. package/workflows/impeccable/shape.md +165 -0
  231. package/workflows/impeccable/spatial-design.md +100 -0
  232. package/workflows/impeccable/teach.md +168 -0
  233. package/workflows/impeccable/typeset.md +124 -0
  234. package/workflows/impeccable/typography.md +159 -0
  235. package/workflows/impeccable/ux-writing.md +107 -0
  236. package/workflows/impeccable.md +164 -0
  237. package/workflows/maestro.md +7 -3
  238. package/workflows/skill-authoring.md +265 -0
  239. package/workflows/specs-add.md +3 -2
  240. package/workflows/specs-load.md +2 -1
  241. package/workflows/specs-setup.md +21 -1
@@ -104,6 +104,7 @@ id,wave,title,description,agent_type,deps,status,findings,output_path,error
104
104
  </csv_schema>
105
105
 
106
106
  <invariants>
107
+ 0. **Load UI Specs**: Before extraction, load project UI conventions via `maestro spec load --category ui` (if available). Ensures extracted tokens align with existing conventions.
107
108
  1. **Start Immediately**: First action is argument parsing, then validation
108
109
  2. **Wave Order is Sacred**: Never execute wave N+1 before wave N completes and results are merged
109
110
  3. **CSV is Source of Truth**: Master tasks.csv holds all state
@@ -0,0 +1,341 @@
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>] [-y] [-c]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, request_user_input
6
+ ---
7
+ <purpose>
8
+ Orchestrate maestro-impeccable skill commands via intelligent intent routing + quality gate auto-iteration.
9
+ Chain: Build → Evaluate → Auto-Refine → Re-evaluate → Verify.
10
+
11
+ Core innovation: critique/audit scores drive automatic command selection and iteration loops.
12
+ maestro-impeccable has 23 commands across 6 categories -- this command chains them into automated pipelines
13
+ with quality gates that loop until design quality meets the threshold.
14
+
15
+ Prerequisite: maestro-impeccable skill available (auto-discovered by harness).
16
+
17
+ Session: `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`
18
+ </purpose>
19
+
20
+ <invariants>
21
+ 1. **Session before execution** -- status.json created before any chain step runs
22
+ 2. **All steps via Skill** -- every impeccable command dispatched through `$maestro-impeccable`
23
+ 3. **Gate scores drive loops** -- refine loop auto-selects commands from P0/P1 findings, never from hardcoded lists
24
+ 4. **Interactive gates respected** -- teach, shape, craft retain their user gates; never suppress
25
+ </invariants>
26
+
27
+ <context>
28
+ $ARGUMENTS -- intent description or target path, with optional flags.
29
+
30
+ **Keywords:** `continue`/`next` → resume previous session
31
+
32
+ **Usage:**
33
+
34
+ ```bash
35
+ $maestro-ui-craft "create a landing page"
36
+ $maestro-ui-craft "improve the dashboard" --chain improve
37
+ $maestro-ui-craft "add animations" --chain enhance --enhance animate
38
+ $maestro-ui-craft "production ready" --chain harden
39
+ $maestro-ui-craft -c # resume previous session
40
+ $maestro-ui-craft -y "create pricing page --chain build"
41
+ ```
42
+
43
+ **Flags:**
44
+ - `--chain <type>` -- Force chain type: build, improve, enhance, harden, live
45
+ - `--enhance <cmd>` -- Specific enhance command (animate|colorize|typeset|layout|delight|overdrive|bolder)
46
+ - `--threshold <score>` -- Critique pass threshold (default: 26/40). Audit threshold auto-computed as threshold*0.5
47
+ - `--max-loops <n>` -- Maximum quality gate iterations (default: 3)
48
+ - `-c` / `--continue` -- Resume previous ui-craft session
49
+ - `-y` -- Auto mode: auto-select at ambiguous routing, skip confirmations where maestro-impeccable allows
50
+ </context>
51
+
52
+ <chains>
53
+
54
+ ### Chain Definitions
55
+
56
+ | Chain | Sequence | Gate Condition |
57
+ |-------|----------|----------------|
58
+ | **build** | teach? → shape → craft → **critique** → [refine loop] → audit → polish | critique >= threshold AND P0 == 0 |
59
+ | **improve** | **critique** → [refine loop] → polish → audit | critique >= threshold AND P0 == 0 |
60
+ | **enhance** | {cmd} → **critique** → polish (if needed) | critique >= threshold |
61
+ | **harden** | harden → **audit** → polish | audit >= threshold*0.5 |
62
+ | **live** | live | -- (interactive, no gate) |
63
+
64
+ - `teach?` -- conditional: only if PRODUCT.md missing/placeholder
65
+ - `[refine loop]` -- quality gate loop: extract suggested commands from critique → execute → re-critique
66
+
67
+ ### Intent → Chain Routing
68
+
69
+ | Intent Pattern | Chain |
70
+ |---------------|-------|
71
+ | create, build, new, landing, feature, page | build |
72
+ | improve, fix, iterate, better, optimize | improve |
73
+ | animate, color, type, bold, delight, enhance | enhance |
74
+ | production, harden, ship, edge case, i18n | harden |
75
+ | live, browser, variant | live |
76
+
77
+ Explicit `--chain` overrides routing. Ambiguous + no `-y` → `request_user_input`.
78
+
79
+ </chains>
80
+
81
+ <state_machine>
82
+
83
+ <states>
84
+ S_PARSE -- parse args, intent classification, chain selection PERSIST: --
85
+ S_RESUME -- scan existing ui-craft sessions, resume execution PERSIST: --
86
+ S_SETUP -- load context, check PRODUCT.md PERSIST: --
87
+ S_CREATE -- create session + status.json PERSIST: session (full)
88
+ S_CHAIN -- execute chain steps in sequence PERSIST: step progress, executed commands
89
+ S_GATE -- quality gate: parse scores, decide PERSIST: scores, loop count
90
+ S_REFINE -- execute auto-selected refine commands PERSIST: refine commands, loop state
91
+ S_REPORT -- final report + trend PERSIST: final scores, status
92
+ </states>
93
+
94
+ <transitions>
95
+
96
+ S_PARSE:
97
+ → S_RESUME WHEN: -c / --continue flag OR keyword "continue"/"next"
98
+ → S_SETUP WHEN: chain selected (explicit or routed)
99
+ → S_PARSE WHEN: ambiguous AND not -y DO: request_user_input
100
+ → END WHEN: no intent AND no target → E002
101
+
102
+ S_RESUME:
103
+ → S_CHAIN WHEN: session found DO: A_LOCATE_SESSION
104
+ → END WHEN: no session found → E005
105
+
106
+ S_SETUP:
107
+ → S_CREATE DO: A_LOAD_CONTEXT
108
+
109
+ S_CREATE:
110
+ → S_CHAIN DO: A_CREATE_SESSION
111
+
112
+ S_CHAIN:
113
+ → S_GATE WHEN: current step is gate command (critique/audit)
114
+ → S_CHAIN WHEN: step is normal command → execute → advance
115
+ → S_REPORT WHEN: all steps complete
116
+
117
+ S_GATE:
118
+ → S_CHAIN WHEN: PASS (score >= threshold AND P0 == 0) → advance
119
+ → S_REFINE WHEN: FAIL (score < threshold OR P0 > 0)
120
+ → S_CHAIN WHEN: max loops exceeded → W002 → force advance
121
+
122
+ S_REFINE:
123
+ → S_GATE DO: execute auto-selected commands → re-run gate command
124
+ GUARD: loop_count < max_loops
125
+
126
+ S_REPORT:
127
+ → END DO: A_FINAL_REPORT
128
+
129
+ </transitions>
130
+
131
+ <actions>
132
+
133
+ ### A_LOCATE_SESSION
134
+
135
+ 1. Scan `.workflow/.maestro/ui-craft-*/status.json`, filter `status == "running"`, sort DESC
136
+ 2. Take most recent; load into context as current session
137
+ 3. Resume from `current_step` position
138
+
139
+ ### A_LOAD_CONTEXT
140
+
141
+ 1. Trigger impeccable context loading: `$maestro-impeccable teach`
142
+ - Impeccable's own setup auto-discovers and loads PRODUCT.md / DESIGN.md from `.workflow/impeccable/`
143
+ - If PRODUCT.md missing/placeholder, impeccable teach handles the interview
144
+ 2. If teach was not in the chain but PRODUCT.md is missing:
145
+ - Prepend `teach` to chain start
146
+ - Announce: W001
147
+ 3. Context is now loaded for subsequent commands
148
+
149
+ ### A_CREATE_SESSION
150
+
151
+ 1. Read `.workflow/state.json` for project context (phase, milestone)
152
+ 2. Create `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`:
153
+ ```json
154
+ { "session_id": "ui-craft-{ts}", "source": "ui-craft", "intent": "...",
155
+ "chain_type": "build|improve|enhance|harden|live", "target": "...",
156
+ "auto_mode": false, "threshold": 26, "max_loops": 3,
157
+ "steps": [{ "index": 0, "command": "shape", "status": "pending" }],
158
+ "gate_history": [], "loop_count": 0,
159
+ "current_step": 0, "status": "running",
160
+ "created_at": "ISO-8601", "updated_at": "ISO-8601" }
161
+ ```
162
+ 3. Write status.json before executing any step
163
+
164
+ ### A_FINAL_REPORT
165
+
166
+ 1. Read critique trend if available (impeccable's critique persists snapshots automatically)
167
+ 2. Update status.json with `status: "completed"` and final scores
168
+ 3. Present summary table with scores, iterations, commands executed
169
+
170
+ </actions>
171
+
172
+ </state_machine>
173
+
174
+ <execution>
175
+
176
+ ## 1. Parse & Route
177
+
178
+ 1. If `-c` / `--continue` or keyword "continue"/"next" → S_RESUME
179
+ 2. If `--chain` present → use directly
180
+ 3. Otherwise → match $ARGUMENTS against intent patterns
181
+ 4. If `--enhance` present → chain = enhance, cmd = --enhance value
182
+ 5. For enhance chain without `--enhance` → infer from intent
183
+ 6. Ambiguous + no `-y` → `request_user_input`:
184
+ ```json
185
+ { "questions": [{ "id": "chain_select", "header": "Chain", "question": "Which workflow?", "options": [
186
+ { "label": "Build (Recommended)", "description": "New UI from scratch: shape → craft → critique → refine → audit" },
187
+ { "label": "Improve", "description": "Iterate existing: critique → refine → polish → audit" },
188
+ { "label": "Enhance", "description": "Targeted improvement: specific command → critique → polish" },
189
+ { "label": "Harden", "description": "Production-ready: harden → audit → polish" }
190
+ ]}] }
191
+ ```
192
+
193
+ ## 2. Setup Context
194
+
195
+ 1. If chain starts with `teach` → execute it first, maestro-impeccable handles context loading internally
196
+ 2. Otherwise → invoke `$maestro-impeccable` with no args to trigger setup (context + register)
197
+ 3. If maestro-impeccable reports PRODUCT.md missing → prepend teach, execute, then resume
198
+
199
+ ## 3. Create Session
200
+
201
+ Write `.workflow/.maestro/ui-craft-{ts}/status.json` with chain steps before any execution.
202
+
203
+ ## 4. Execute Chain
204
+
205
+ For each step in chain, sequentially:
206
+
207
+ ```
208
+ Step {n}/{total}: $maestro-impeccable {command} {target}
209
+ ```
210
+
211
+ After each step: update status.json `current_step` and step `status`.
212
+
213
+ **Rules:**
214
+ - `teach`, `shape`, `craft` are interactive -- do NOT suppress their user gates
215
+ - After `teach` completes → re-run context loader for fresh PRODUCT.md
216
+ - After `craft` completes → the build exists, ready for evaluation
217
+ - Gate steps (critique/audit) → transition to quality gate logic
218
+
219
+ ## 5. Quality Gate
220
+
221
+ When chain reaches a gate step (critique or audit):
222
+
223
+ ### 5a. Execute Gate Command
224
+
225
+ ```
226
+ $maestro-impeccable critique {target}
227
+ ```
228
+ or
229
+ ```
230
+ $maestro-impeccable audit {target}
231
+ ```
232
+
233
+ ### 5b. Parse Score
234
+
235
+ From critique output, extract:
236
+ - **score**: Nielsen's total (N/40) -- from "**Total** | | **N/40**" row
237
+ - **P0_count**: count of `[P0]` tagged findings
238
+ - **P1_count**: count of `[P1]` tagged findings
239
+ - **suggested_commands**: list of "$maestro-impeccable <cmd>" from "Suggested command" fields
240
+
241
+ From audit output, extract:
242
+ - **score**: dimension total (N/20) -- from "**Total** | | **N/20**" row
243
+ - **P0_count**: count of `[P0]` findings
244
+
245
+ ### 5c. Evaluate
246
+
247
+ ```
248
+ critique_pass = (score >= threshold) AND (P0_count == 0)
249
+ audit_pass = (score >= threshold * 0.5) AND (P0_count == 0)
250
+ ```
251
+
252
+ ### 5d. On PASS
253
+
254
+ → advance to next chain step
255
+
256
+ ### 5e. On FAIL
257
+
258
+ 1. Collect suggested commands from P0/P1 findings
259
+ 2. If no suggestions found → use fallback mapping (see quality_gate_routing)
260
+ 3. De-duplicate, cap at 3 commands per iteration
261
+ 4. Sort: P0-suggested first
262
+ 5. Execute each: `$maestro-impeccable {cmd} {target}`
263
+ 6. Re-run gate command (critique/audit)
264
+ 7. Increment loop_count
265
+ 8. Append to status.json `gate_history`
266
+
267
+ ### 5f. On Max Loops Exceeded
268
+
269
+ → force advance to next chain step with warning
270
+
271
+ ## 6. Final Report
272
+
273
+ Present summary: chain type, critique score with trend, audit score, loop count, commands executed, pass/partial status.
274
+
275
+ Update status.json: `status: "completed"`, `final_scores`, `completed_at`.
276
+
277
+ If issues remain → suggest: "Run `$maestro-ui-craft --chain improve {target}` to continue iteration."
278
+
279
+ </execution>
280
+
281
+ <quality_gate_routing>
282
+
283
+ ### Finding → Command Fallback Mapping
284
+
285
+ When critique/audit findings lack explicit "Suggested command", map by category:
286
+
287
+ | Finding Category | Command |
288
+ |-----------------|---------|
289
+ | Visual hierarchy, layout, spacing, alignment | layout |
290
+ | Color, contrast, palette, monochromatic | colorize |
291
+ | Typography, font, readability, hierarchy | typeset |
292
+ | Animation, motion, transitions, micro-interaction | animate |
293
+ | Copy, labels, error messages, UX writing | clarify |
294
+ | Responsive, mobile, breakpoints, touch targets | adapt |
295
+ | Performance, loading, speed, bundle, jank | optimize |
296
+ | Complexity, overload, clutter, cognitive load | distill |
297
+ | Bland, safe, generic, lacks personality | bolder |
298
+ | Aggressive, overwhelming, loud, overstimulating | quieter |
299
+ | Onboarding, empty state, first-run, activation | onboard |
300
+ | Edge cases, i18n, error handling, overflow | harden |
301
+ | Personality, memorability, joy, delight | delight |
302
+
303
+ ### Commands Never Auto-Selected
304
+
305
+ | Command | Reason |
306
+ |---------|--------|
307
+ | teach | Project setup (run in S_SETUP only) |
308
+ | shape | Requires user interview |
309
+ | craft | Full build with multiple gates |
310
+ | live | Interactive browser mode |
311
+ | document | Generates DESIGN.md (setup) |
312
+ | extract | Design system extraction (setup) |
313
+ | overdrive | Requires explicit user vision |
314
+ | critique | Gate command, not a fix |
315
+ | audit | Gate command, not a fix |
316
+
317
+ </quality_gate_routing>
318
+
319
+ <error_codes>
320
+ | Code | Severity | Description |
321
+ |------|----------|-------------|
322
+ | E001 | error | maestro-impeccable skill not found |
323
+ | E002 | error | No intent or target specified |
324
+ | E003 | error | Invalid --chain type |
325
+ | E004 | error | Invalid --enhance command |
326
+ | E005 | error | Resume session not found |
327
+ | W001 | warning | PRODUCT.md missing, prepending teach to chain |
328
+ | W002 | warning | Max quality gate loops exceeded, forcing continue |
329
+ | W003 | warning | Could not parse score from critique/audit output |
330
+ </error_codes>
331
+
332
+ <success_criteria>
333
+ - [ ] Intent classified and chain type selected
334
+ - [ ] Context loaded (PRODUCT.md present or taught)
335
+ - [ ] Session dir created with status.json before execution
336
+ - [ ] All chain steps executed via $maestro-impeccable
337
+ - [ ] Quality gate evaluated with parsed scores
338
+ - [ ] Refine loop executed when gate failed (if applicable)
339
+ - [ ] Gate history and scores persisted to status.json
340
+ - [ ] Final report with scores and trend presented
341
+ </success_criteria>
@@ -60,6 +60,16 @@ When `--yes` or `-y`: Skip interactive selection, auto-pick top-scored variant,
60
60
 
61
61
  <execution>
62
62
 
63
+ ### Step 0: Load UI Specs
64
+
65
+ Load project UI conventions before generating designs:
66
+
67
+ ```bash
68
+ maestro spec load --category ui
69
+ ```
70
+
71
+ If specs not initialized, continue without — the workflow still produces valid output.
72
+
63
73
  ### Step 1: Parse Input and Resolve Target
64
74
 
65
75
  1. Parse flags from `$ARGUMENTS`: `--styles N`, `--stack`, `--targets`, `--persist`, `--full`, `-y`