maestro-flow 0.3.32 → 0.3.34

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/commands/learn-retro.md +1 -1
  2. package/.claude/commands/maestro-composer.md +2 -2
  3. package/.claude/commands/maestro-ralph-execute.md +1 -1
  4. package/.claude/commands/maestro-ralph.md +11 -11
  5. package/.claude/commands/maestro-verify.md +1 -1
  6. package/.claude/commands/maestro.md +1 -2
  7. package/.claude/commands/quality-auto-test.md +124 -0
  8. package/.claude/commands/quality-refactor.md +1 -1
  9. package/.claude/commands/quality-test.md +3 -3
  10. package/.codex/skills/learn-retro/SKILL.md +1 -1
  11. package/.codex/skills/maestro/SKILL.md +1 -1
  12. package/.codex/skills/maestro-link-coordinate/SKILL.md +1 -1
  13. package/.codex/skills/maestro-milestone-audit/SKILL.md +9 -1
  14. package/.codex/skills/maestro-plan/SKILL.md +72 -6
  15. package/.codex/skills/maestro-ralph/SKILL.md +159 -159
  16. package/.codex/skills/maestro-roadmap/SKILL.md +31 -5
  17. package/.codex/skills/maestro-verify/SKILL.md +1 -1
  18. package/.codex/skills/quality-auto-test/SKILL.md +547 -0
  19. package/.codex/skills/quality-debug/SKILL.md +18 -6
  20. package/.codex/skills/quality-refactor/SKILL.md +8 -1
  21. package/.codex/skills/quality-sync/SKILL.md +23 -4
  22. package/.codex/skills/quality-test/SKILL.md +498 -166
  23. package/dashboard/dist-server/src/config/cli-tools-config.js +5 -20
  24. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  25. package/dashboard/dist-server/src/config/cli-tools-defaults.json +17 -0
  26. package/dist/src/commands/config.d.ts.map +1 -1
  27. package/dist/src/commands/config.js +168 -32
  28. package/dist/src/commands/config.js.map +1 -1
  29. package/dist/src/commands/hooks.d.ts +9 -0
  30. package/dist/src/commands/hooks.d.ts.map +1 -1
  31. package/dist/src/commands/hooks.js +1 -1
  32. package/dist/src/commands/hooks.js.map +1 -1
  33. package/dist/src/commands/install.js +1 -1
  34. package/dist/src/commands/install.js.map +1 -1
  35. package/dist/src/commands/overlay.js +1 -1
  36. package/dist/src/commands/overlay.js.map +1 -1
  37. package/dist/src/commands/tools.d.ts.map +1 -1
  38. package/dist/src/commands/tools.js +7 -17
  39. package/dist/src/commands/tools.js.map +1 -1
  40. package/dist/src/commands/uninstall.js +1 -1
  41. package/dist/src/commands/uninstall.js.map +1 -1
  42. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  43. package/dist/src/config/cli-tools-config.js +5 -20
  44. package/dist/src/config/cli-tools-config.js.map +1 -1
  45. package/dist/src/config/cli-tools-defaults.json +17 -0
  46. package/dist/src/tui/config-ui/ConfigHub.d.ts +14 -0
  47. package/dist/src/tui/config-ui/ConfigHub.d.ts.map +1 -0
  48. package/dist/src/tui/config-ui/ConfigHub.js +125 -0
  49. package/dist/src/tui/config-ui/ConfigHub.js.map +1 -0
  50. package/dist/src/tui/config-ui/ConfigSourcesView.d.ts +6 -0
  51. package/dist/src/tui/config-ui/ConfigSourcesView.d.ts.map +1 -0
  52. package/dist/src/tui/config-ui/ConfigSourcesView.js +25 -0
  53. package/dist/src/tui/config-ui/ConfigSourcesView.js.map +1 -0
  54. package/dist/src/tui/config-ui/HooksPanel.d.ts +6 -0
  55. package/dist/src/tui/config-ui/HooksPanel.d.ts.map +1 -0
  56. package/dist/src/tui/config-ui/HooksPanel.js +92 -0
  57. package/dist/src/tui/config-ui/HooksPanel.js.map +1 -0
  58. package/dist/src/tui/config-ui/SkillConfigDashboard.d.ts +9 -0
  59. package/dist/src/tui/config-ui/SkillConfigDashboard.d.ts.map +1 -0
  60. package/dist/src/tui/config-ui/SkillConfigDashboard.js +64 -0
  61. package/dist/src/tui/config-ui/SkillConfigDashboard.js.map +1 -0
  62. package/dist/src/tui/config-ui/SkillParamEditor.d.ts +12 -0
  63. package/dist/src/tui/config-ui/SkillParamEditor.d.ts.map +1 -0
  64. package/dist/src/tui/config-ui/SkillParamEditor.js +162 -0
  65. package/dist/src/tui/config-ui/SkillParamEditor.js.map +1 -0
  66. package/dist/src/tui/config-ui/SkillsList.d.ts +12 -0
  67. package/dist/src/tui/config-ui/SkillsList.d.ts.map +1 -0
  68. package/dist/src/tui/config-ui/SkillsList.js +91 -0
  69. package/dist/src/tui/config-ui/SkillsList.js.map +1 -0
  70. package/dist/src/tui/config-ui/SpecPanel.d.ts +6 -0
  71. package/dist/src/tui/config-ui/SpecPanel.d.ts.map +1 -0
  72. package/dist/src/tui/config-ui/SpecPanel.js +79 -0
  73. package/dist/src/tui/config-ui/SpecPanel.js.map +1 -0
  74. package/dist/src/tui/config-ui/index.d.ts +23 -0
  75. package/dist/src/tui/config-ui/index.d.ts.map +1 -0
  76. package/dist/src/tui/config-ui/index.js +34 -0
  77. package/dist/src/tui/config-ui/index.js.map +1 -0
  78. package/dist/src/tui/index.d.ts +7 -0
  79. package/dist/src/tui/index.d.ts.map +1 -0
  80. package/dist/src/tui/index.js +10 -0
  81. package/dist/src/tui/index.js.map +1 -0
  82. package/dist/src/tui/install-ui/BackupConfig.d.ts +10 -0
  83. package/dist/src/tui/install-ui/BackupConfig.d.ts.map +1 -0
  84. package/dist/src/tui/install-ui/BackupConfig.js +46 -0
  85. package/dist/src/tui/install-ui/BackupConfig.js.map +1 -0
  86. package/dist/src/tui/install-ui/BlueprintPreview.d.ts +9 -0
  87. package/dist/src/tui/install-ui/BlueprintPreview.d.ts.map +1 -0
  88. package/dist/src/tui/install-ui/BlueprintPreview.js +65 -0
  89. package/dist/src/tui/install-ui/BlueprintPreview.js.map +1 -0
  90. package/dist/src/tui/install-ui/BlueprintPreview.logic.d.ts +33 -0
  91. package/dist/src/tui/install-ui/BlueprintPreview.logic.d.ts.map +1 -0
  92. package/dist/src/tui/install-ui/BlueprintPreview.logic.js +51 -0
  93. package/dist/src/tui/install-ui/BlueprintPreview.logic.js.map +1 -0
  94. package/dist/src/tui/install-ui/ComponentGrid.d.ts +13 -0
  95. package/dist/src/tui/install-ui/ComponentGrid.d.ts.map +1 -0
  96. package/dist/src/tui/install-ui/ComponentGrid.js +75 -0
  97. package/dist/src/tui/install-ui/ComponentGrid.js.map +1 -0
  98. package/dist/src/tui/install-ui/ComponentGrid.logic.d.ts +31 -0
  99. package/dist/src/tui/install-ui/ComponentGrid.logic.d.ts.map +1 -0
  100. package/dist/src/tui/install-ui/ComponentGrid.logic.js +58 -0
  101. package/dist/src/tui/install-ui/ComponentGrid.logic.js.map +1 -0
  102. package/dist/src/tui/install-ui/ConfigPanel.d.ts +11 -0
  103. package/dist/src/tui/install-ui/ConfigPanel.d.ts.map +1 -0
  104. package/dist/src/tui/install-ui/ConfigPanel.js +35 -0
  105. package/dist/src/tui/install-ui/ConfigPanel.js.map +1 -0
  106. package/dist/src/tui/install-ui/CyberItem.d.ts +18 -0
  107. package/dist/src/tui/install-ui/CyberItem.d.ts.map +1 -0
  108. package/dist/src/tui/install-ui/CyberItem.js +33 -0
  109. package/dist/src/tui/install-ui/CyberItem.js.map +1 -0
  110. package/dist/src/tui/install-ui/CyberdeckBlueprint.d.ts +7 -0
  111. package/dist/src/tui/install-ui/CyberdeckBlueprint.d.ts.map +1 -0
  112. package/dist/src/tui/install-ui/CyberdeckBlueprint.js +91 -0
  113. package/dist/src/tui/install-ui/CyberdeckBlueprint.js.map +1 -0
  114. package/dist/src/tui/install-ui/ExecutionView.d.ts +12 -0
  115. package/dist/src/tui/install-ui/ExecutionView.d.ts.map +1 -0
  116. package/dist/src/tui/install-ui/ExecutionView.js +154 -0
  117. package/dist/src/tui/install-ui/ExecutionView.js.map +1 -0
  118. package/dist/src/tui/install-ui/GradientHeader.d.ts +8 -0
  119. package/dist/src/tui/install-ui/GradientHeader.d.ts.map +1 -0
  120. package/dist/src/tui/install-ui/GradientHeader.js +18 -0
  121. package/dist/src/tui/install-ui/GradientHeader.js.map +1 -0
  122. package/dist/src/tui/install-ui/HooksConfig.d.ts +8 -0
  123. package/dist/src/tui/install-ui/HooksConfig.d.ts.map +1 -0
  124. package/dist/src/tui/install-ui/HooksConfig.js +35 -0
  125. package/dist/src/tui/install-ui/HooksConfig.js.map +1 -0
  126. package/dist/src/tui/install-ui/InstallConfirm.d.ts +27 -0
  127. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -0
  128. package/dist/src/tui/install-ui/InstallConfirm.js +25 -0
  129. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -0
  130. package/dist/src/tui/install-ui/InstallExecution.d.ts +21 -0
  131. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -0
  132. package/dist/src/tui/install-ui/InstallExecution.js +154 -0
  133. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -0
  134. package/dist/src/tui/install-ui/InstallFlow.d.ts +14 -0
  135. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -0
  136. package/dist/src/tui/install-ui/InstallFlow.js +186 -0
  137. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -0
  138. package/dist/src/tui/install-ui/InstallHub.d.ts +33 -0
  139. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -0
  140. package/dist/src/tui/install-ui/InstallHub.js +97 -0
  141. package/dist/src/tui/install-ui/InstallHub.js.map +1 -0
  142. package/dist/src/tui/install-ui/InstallResult.d.ts +7 -0
  143. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -0
  144. package/dist/src/tui/install-ui/InstallResult.js +15 -0
  145. package/dist/src/tui/install-ui/InstallResult.js.map +1 -0
  146. package/dist/src/tui/install-ui/McpConfig.d.ts +12 -0
  147. package/dist/src/tui/install-ui/McpConfig.d.ts.map +1 -0
  148. package/dist/src/tui/install-ui/McpConfig.js +69 -0
  149. package/dist/src/tui/install-ui/McpConfig.js.map +1 -0
  150. package/dist/src/tui/install-ui/ResultDashboard.d.ts +8 -0
  151. package/dist/src/tui/install-ui/ResultDashboard.d.ts.map +1 -0
  152. package/dist/src/tui/install-ui/ResultDashboard.js +17 -0
  153. package/dist/src/tui/install-ui/ResultDashboard.js.map +1 -0
  154. package/dist/src/tui/install-ui/ReviewPanel.d.ts +19 -0
  155. package/dist/src/tui/install-ui/ReviewPanel.d.ts.map +1 -0
  156. package/dist/src/tui/install-ui/ReviewPanel.js +25 -0
  157. package/dist/src/tui/install-ui/ReviewPanel.js.map +1 -0
  158. package/dist/src/tui/install-ui/ShortcutFooter.d.ts +7 -0
  159. package/dist/src/tui/install-ui/ShortcutFooter.d.ts.map +1 -0
  160. package/dist/src/tui/install-ui/ShortcutFooter.js +15 -0
  161. package/dist/src/tui/install-ui/ShortcutFooter.js.map +1 -0
  162. package/dist/src/tui/install-ui/StatuslineConfig.d.ts +11 -0
  163. package/dist/src/tui/install-ui/StatuslineConfig.d.ts.map +1 -0
  164. package/dist/src/tui/install-ui/StatuslineConfig.js +39 -0
  165. package/dist/src/tui/install-ui/StatuslineConfig.js.map +1 -0
  166. package/dist/src/tui/install-ui/StepSelector.d.ts +14 -0
  167. package/dist/src/tui/install-ui/StepSelector.d.ts.map +1 -0
  168. package/dist/src/tui/install-ui/StepSelector.js +46 -0
  169. package/dist/src/tui/install-ui/StepSelector.js.map +1 -0
  170. package/dist/src/tui/install-ui/index.d.ts +8 -0
  171. package/dist/src/tui/install-ui/index.d.ts.map +1 -0
  172. package/dist/src/tui/install-ui/index.js +10 -0
  173. package/dist/src/tui/install-ui/index.js.map +1 -0
  174. package/dist/src/tui/install-ui/types.d.ts +35 -0
  175. package/dist/src/tui/install-ui/types.d.ts.map +1 -0
  176. package/dist/src/tui/install-ui/types.js +25 -0
  177. package/dist/src/tui/install-ui/types.js.map +1 -0
  178. package/dist/src/tui/overlay-ui/OverlayList.d.ts +37 -0
  179. package/dist/src/tui/overlay-ui/OverlayList.d.ts.map +1 -0
  180. package/dist/src/tui/overlay-ui/OverlayList.js +146 -0
  181. package/dist/src/tui/overlay-ui/OverlayList.js.map +1 -0
  182. package/dist/src/tui/overlay-ui/index.d.ts +18 -0
  183. package/dist/src/tui/overlay-ui/index.d.ts.map +1 -0
  184. package/dist/src/tui/overlay-ui/index.js +204 -0
  185. package/dist/src/tui/overlay-ui/index.js.map +1 -0
  186. package/dist/src/tui/render.d.ts +13 -0
  187. package/dist/src/tui/render.d.ts.map +1 -0
  188. package/dist/src/tui/render.js +31 -0
  189. package/dist/src/tui/render.js.map +1 -0
  190. package/dist/src/tui/tools-ui/CommandReference.d.ts +7 -0
  191. package/dist/src/tui/tools-ui/CommandReference.d.ts.map +1 -0
  192. package/dist/src/tui/tools-ui/CommandReference.js +33 -0
  193. package/dist/src/tui/tools-ui/CommandReference.js.map +1 -0
  194. package/dist/src/tui/tools-ui/ConfigSources.d.ts +6 -0
  195. package/dist/src/tui/tools-ui/ConfigSources.d.ts.map +1 -0
  196. package/dist/src/tui/tools-ui/ConfigSources.js +27 -0
  197. package/dist/src/tui/tools-ui/ConfigSources.js.map +1 -0
  198. package/dist/src/tui/tools-ui/RegisterSettings.d.ts +8 -0
  199. package/dist/src/tui/tools-ui/RegisterSettings.d.ts.map +1 -0
  200. package/dist/src/tui/tools-ui/RegisterSettings.js +125 -0
  201. package/dist/src/tui/tools-ui/RegisterSettings.js.map +1 -0
  202. package/dist/src/tui/tools-ui/RoleMappings.d.ts +9 -0
  203. package/dist/src/tui/tools-ui/RoleMappings.d.ts.map +1 -0
  204. package/dist/src/tui/tools-ui/RoleMappings.js +104 -0
  205. package/dist/src/tui/tools-ui/RoleMappings.js.map +1 -0
  206. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts +8 -0
  207. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -0
  208. package/dist/src/tui/tools-ui/ToolsDashboard.js +60 -0
  209. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -0
  210. package/dist/src/tui/tools-ui/ToolsOverview.d.ts +9 -0
  211. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -0
  212. package/dist/src/tui/tools-ui/ToolsOverview.js +84 -0
  213. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -0
  214. package/dist/src/tui/tools-ui/index.d.ts +3 -0
  215. package/dist/src/tui/tools-ui/index.d.ts.map +1 -0
  216. package/dist/src/tui/tools-ui/index.js +6 -0
  217. package/dist/src/tui/tools-ui/index.js.map +1 -0
  218. package/dist/src/tui/uninstall-ui/UninstallFlow.d.ts +7 -0
  219. package/dist/src/tui/uninstall-ui/UninstallFlow.d.ts.map +1 -0
  220. package/dist/src/tui/uninstall-ui/UninstallFlow.js +189 -0
  221. package/dist/src/tui/uninstall-ui/UninstallFlow.js.map +1 -0
  222. package/dist/src/tui/uninstall-ui/index.d.ts +3 -0
  223. package/dist/src/tui/uninstall-ui/index.d.ts.map +1 -0
  224. package/dist/src/tui/uninstall-ui/index.js +6 -0
  225. package/dist/src/tui/uninstall-ui/index.js.map +1 -0
  226. package/package.json +1 -1
  227. package/workflows/auto-test.md +682 -0
  228. package/workflows/business-test.md +570 -0
  229. package/workflows/integration-test.md +1 -1
  230. package/workflows/maestro.codex.md +4 -3
  231. package/workflows/maestro.md +5 -4
  232. package/workflows/status.md +2 -2
  233. package/workflows/test.md +1 -1
  234. package/workflows/verify.md +1 -1
  235. package/.claude/commands/quality-business-test.md +0 -110
  236. package/.claude/commands/quality-integration-test.md +0 -67
  237. package/.claude/commands/quality-test-gen.md +0 -68
  238. package/.codex/skills/maestro-ralph-execute/SKILL.md +0 -219
  239. package/.codex/skills/quality-business-test/SKILL.md +0 -218
  240. package/.codex/skills/quality-integration-test/SKILL.md +0 -427
  241. package/.codex/skills/quality-test-gen/SKILL.md +0 -352
@@ -70,10 +70,18 @@ $maestro-roadmap --from-brainstorm WFS-001 "Enhance auth system"
70
70
  **Flags**:
71
71
  - `--mode light|full`: Execution mode (default: light)
72
72
  - `-y, --yes`: Skip all confirmations (auto mode)
73
+ - `-m progressive|direct|auto`: Decomposition strategy (default: auto, light mode only)
73
74
  - `--phases N`: Target number of roadmap phases (default: auto-determined, light mode only)
75
+ - `--revise [instructions]`: Revise existing roadmap preserving completed phase progress (light mode only)
76
+ - `--review`: Roadmap health assessment, read-only (light mode only)
74
77
  - `--skip-research`: Skip Wave 1 research, jump to document generation (full mode only)
75
78
  - `--from-brainstorm SESSION-ID`: Import guidance-specification.md from brainstorm session as seed
76
79
 
80
+ **Operation modes** (light mode):
81
+ - **Create** (default): Build roadmap from requirements via full CSV pipeline
82
+ - **Revise** (`--revise`): Load existing roadmap.md, apply modifications while preserving completed phases
83
+ - **Review** (`--review`): Health assessment of current roadmap (read-only, no writes)
84
+
77
85
  When `--yes` or `-y`: Auto-confirm strategy/decisions, skip interactive refinement, use defaults.
78
86
 
79
87
  **Output Directory**: `.workflow/.csv-wave/{session-id}/`
@@ -185,12 +193,22 @@ Each wave generates `wave-{N}.csv` with extra `prev_context` column.
185
193
  Parse `$ARGUMENTS` to extract:
186
194
  - `mode` from `--mode light|full` (default: `light`)
187
195
  - `AUTO_YES` from `--yes` / `-y`
196
+ - `strategy` from `-m progressive|direct|auto` (default: `auto`, light only)
188
197
  - `targetPhases` from `--phases N` (light mode only)
198
+ - `reviseMode` from `--revise [instructions]` (light only, forces mode=light)
199
+ - `reviewMode` from `--review` (light only, forces mode=light)
189
200
  - `skipResearch` from `--skip-research` (full mode only)
190
201
  - `brainstormSession` from `--from-brainstorm <SESSION-ID>`
191
202
  - `requirementArg` = remaining text after stripping all flags
192
203
  - `slug` = requirementArg lowercased, non-alphanumeric → `-`, max 40 chars
193
204
 
205
+ **Mode routing:**
206
+ - If `--revise` or `--review`: force `mode = light`, bypass CSV pipeline
207
+ - **Revise**: Load `.workflow/roadmap.md`, apply instructions (preserve completed phases), write updated roadmap
208
+ - **Review**: Read `.workflow/roadmap.md` + `state.json`, assess health (phase completion, dependency validity, scope creep), report read-only
209
+ - Both skip Phase 1-3 CSV pipeline, go directly to operation-specific logic
210
+ - Otherwise: proceed with CSV pipeline
211
+
194
212
  Session ID: `{YYYYMMDD}-roadmap-{slug}` (light) or `{YYYYMMDD}-roadmap-full-{slug}` (full)
195
213
  Session folder: `.workflow/.csv-wave/{sessionId}/` — create via `mkdir -p`
196
214
 
@@ -352,13 +370,18 @@ Phases: {phase_count} across {milestone_count} milestones
352
370
  Roadmap: .workflow/roadmap.md
353
371
  [Full] Spec: .workflow/.spec/SPEC-{slug}-{date}/
354
372
  [Full] Quality: {score}% ({gate})
355
-
356
- Next steps:
357
- maestro-init -- Set up project (if not yet initialized)
358
- maestro-plan "1" -- Plan first phase
359
- manage-status -- View project dashboard
360
373
  ```
361
374
 
375
+ **Next-step routing:**
376
+
377
+ | Condition | Next Step |
378
+ |-----------|-----------|
379
+ | Roadmap approved, need analysis | `$maestro-analyze "1"` |
380
+ | Simple project, ready to plan | `$maestro-plan "1"` |
381
+ | Need UI design first | `$maestro-ui-design "1"` |
382
+ | View project dashboard | `$manage-status` |
383
+ | Need project setup (full mode) | `$maestro-init` |
384
+
362
385
  ### Shared Discovery Board Protocol
363
386
 
364
387
  #### Standard Discovery Types
@@ -407,6 +430,9 @@ echo '{"ts":"<ISO>","worker":"{id}","type":"domain_term","data":{"term":"workflo
407
430
  | No requirement/idea text provided | Abort with error: "Requirement text or @file required" |
408
431
  | Brainstorm session not found | Abort with error: "Session {id} not found" -- list available sessions |
409
432
  | @file not found | Abort with error: "File {path} not found" |
433
+ | roadmap.md not found (--revise/--review) | Run maestro-roadmap first to create |
434
+ | Revision invalidates completed phase | Warn user, ask to confirm or adjust |
435
+ | .workflow/ not initialized (full mode) | Run maestro-init first |
410
436
  | Wave 1 agent timeout | Mark as failed, Wave 2 uses available findings |
411
437
  | All Wave 1 agents failed | Wave 2 runs in degraded mode (seed input only) |
412
438
  | Wave 2 agent failed (light) | Abort with error: "Roadmap generation failed" |
@@ -398,7 +398,7 @@ On user confirm, append `<spec-entry>` to matching category file.
398
398
  | All passed, no gaps | `$quality-review "{phase}"` for code review |
399
399
  | Critical gaps found | `$quality-debug` for investigation |
400
400
  | Minor gaps only | `$maestro-plan "{phase} --gaps"` -> `$maestro-execute` -> re-run `$maestro-verify` |
401
- | Low test coverage | `$quality-test-gen "{phase}"` to generate missing tests |
401
+ | Low test coverage | `$quality-auto-test "{phase}"` to generate missing tests |
402
402
  | Human verification needed | `$quality-test "{phase}"` for interactive UAT |
403
403
 
404
404
  ### Shared Discovery Board Protocol
@@ -0,0 +1,547 @@
1
+ ---
2
+ name: quality-auto-test
3
+ description: Unified automated testing via CSV layer pipeline. Reads project state to auto-select scenario source, builds scenarios.csv, executes test writing + diagnosis in parallel per layer using spawn_agents_on_csv, with iterative convergence engine.
4
+ argument-hint: "<phase> [-y] [-c N] [--max-iter N] [--layer L0-L3] [--dry-run] [--re-run]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Unified automated testing using `spawn_agents_on_csv` for parallel test writing and failure diagnosis. Reads project state to auto-select scenario source (PRD specs, coverage gaps, or code exploration). All sources converge into a shared CSV pipeline: discover infrastructure → plan → write tests via CSV parallel → execute per layer → diagnose failures via CSV parallel → iterate → report.
10
+
11
+ **Core workflow**: Route → Source Scenarios → Build CSV → Layer-by-Layer Parallel Execution → Iterate (Diagnose CSV) → Report
12
+
13
+ **Topology**: Layers as waves (L0→L1→L2→L3 sequential, scenarios within layer parallel)
14
+
15
+ ```
16
+ +---------------------------------------------------------------------------+
17
+ | AUTO-TEST CSV LAYER PIPELINE |
18
+ +---------------------------------------------------------------------------+
19
+ | |
20
+ | Phase 1: Route & Plan -> CSV |
21
+ | +-- Read project state, auto-select route (spec/gap/code) |
22
+ | +-- Extract scenarios per route, normalize to unified format |
23
+ | +-- Discover test infrastructure (framework, patterns) |
24
+ | +-- Build scenarios.csv with one row per scenario |
25
+ | +-- Layers = waves (L1, L2, L3 sequential; L0 = static pre-check) |
26
+ | +-- User validates test plan (skip if -y) |
27
+ | |
28
+ | Phase 2: Layer Execution Engine (write + run) |
29
+ | +-- L0: Static analysis (tsc + eslint) — no CSV needed |
30
+ | +-- For each layer L1→L3 (sequential, fail-fast on critical): |
31
+ | | +-- Layer N: Write Tests (parallel via spawn_agents_on_csv) |
32
+ | | | +-- Each agent writes one test file (RED-GREEN) |
33
+ | | | +-- Agent reads target source + infrastructure patterns |
34
+ | | | +-- Agent verifies RED (run test, check it targets behavior) |
35
+ | | | +-- Results: test_file written, red_result, findings |
36
+ | | +-- Merge write-results into master scenarios.csv |
37
+ | | +-- Run all layer tests together (full layer execution) |
38
+ | | +-- Record per-scenario pass/fail results |
39
+ | |
40
+ | Phase 3: Iteration Engine (diagnose + fix) |
41
+ | +-- OUTER LOOP (max_iter iterations): |
42
+ | | +-- For each layer with failures: |
43
+ | | | +-- Build diagnosis.csv from failed scenarios |
44
+ | | | +-- Diagnose & Fix (parallel via spawn_agents_on_csv) |
45
+ | | | | +-- Each agent classifies one failure cluster |
46
+ | | | | +-- test_defect: agent provides fix diff |
47
+ | | | | +-- code_defect: agent documents evidence |
48
+ | | | +-- Apply test_defect fixes, re-run layer |
49
+ | | +-- Reflect: analyze trends, log strategy |
50
+ | | +-- Adjust: select next strategy (conservative/aggressive/...) |
51
+ | | +-- Convergence check: >=95% → done |
52
+ | +-- discoveries.ndjson shared across all iterations |
53
+ | |
54
+ | Phase 4: Results & Routing |
55
+ | +-- Export results.csv |
56
+ | +-- Write report.json, state.json, reflection-log.md |
57
+ | +-- Conditional: traceability.md, issue creation |
58
+ | +-- Route to next step based on convergence |
59
+ | |
60
+ +---------------------------------------------------------------------------+
61
+ ```
62
+ </purpose>
63
+
64
+ <context>
65
+ ```bash
66
+ $quality-auto-test "3" # auto-detect source, full iteration
67
+ $quality-auto-test -c 4 "3" # max 4 concurrent test writers per layer
68
+ $quality-auto-test -y "3 --max-iter 1" # single-pass generation only
69
+ $quality-auto-test "3 --dry-run" # plan only, no execution
70
+ $quality-auto-test "3 --re-run" # re-run only previously failed scenarios
71
+ $quality-auto-test "3 --layer L2" # restrict to L2 integration tests
72
+ ```
73
+
74
+ **Flags**:
75
+ - `-y, --yes`: Skip all confirmations
76
+ - `-c, --concurrency N`: Max concurrent agents within each layer (default: 5)
77
+ - `--max-iter N`: Max outer iterations (default 5). **1 = single-pass** generation only
78
+ - `--layer L`: Start from or restrict to specific layer (L0|L1|L2|L3)
79
+ - `--strategy conservative|aggressive|surgical|reflective`: Override starting iteration strategy (default: auto-selected)
80
+ - `--dry-run`: Generate test plan only, do not execute
81
+ - `--re-run`: Re-run only previously failed/blocked scenarios
82
+
83
+ **Intelligent routing** (auto-detected, priority order):
84
+
85
+ | Priority | Condition | Route |
86
+ |----------|-----------|-------|
87
+ | 1 | Active session (state.json status=running) | Resume |
88
+ | 2 | --re-run flag + previous failures | Re-run |
89
+ | 3 | Spec package exists (REQ-*.md) | spec (PRD-forward) |
90
+ | 4 | Nyquist gaps exist (verification.json) | gap (coverage-forward) |
91
+ | 5 | Default | code (exploration-forward) |
92
+
93
+ **Session Directory**: `.tests/auto-test/.csv-session/`
94
+ **Core Output**: `scenarios.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared) + `report.json` + `state.json`
95
+ </context>
96
+
97
+ <csv_schema>
98
+
99
+ ### scenarios.csv (Master State — Test Writing Phase)
100
+
101
+ ```csv
102
+ id,name,layer,priority,category,target_file,test_file,description,test_cases,fixtures,req_ref,infrastructure_hints,prev_context,status,red_result,findings,error
103
+ "AT-001","Auth token validation","L1","critical","api_contract","src/auth/token.ts","src/auth/__tests__/token.test.ts","Validate JWT token verification returns correct payload","verify valid token returns payload;verify expired token throws;verify malformed token throws","valid_token fixture;expired_token fixture","REQ-001:AC-1","vitest;describe/it pattern;see src/utils/__tests__/hash.test.ts","","","","",""
104
+ "AT-002","Login endpoint integration","L2","high","business_rule","src/routes/login.ts","src/routes/__tests__/login.integration.test.ts","POST /api/login returns JWT on valid credentials","valid login returns 200+token;invalid password returns 401;missing email returns 400","user_fixture;credentials_fixture","REQ-002:AC-1","supertest;see src/routes/__tests__/health.test.ts","AT-001 findings: token module exports verifyToken/generateToken","","","",""
105
+ ```
106
+
107
+ **Columns**:
108
+
109
+ | Column | Phase | Description |
110
+ |--------|-------|-------------|
111
+ | `id` | Input | Scenario ID (AT-NNN format) |
112
+ | `name` | Input | Short scenario name |
113
+ | `layer` | Input | L1/L2/L3 (determines wave order) |
114
+ | `priority` | Input | critical/high/medium |
115
+ | `category` | Input | api_contract/business_rule/state_transition/user_flow/... |
116
+ | `target_file` | Input | Source file being tested |
117
+ | `test_file` | Input | Target test file path to create |
118
+ | `description` | Input | What this scenario validates |
119
+ | `test_cases` | Input | Semicolon-separated test cases |
120
+ | `fixtures` | Input | Required fixtures/mocks (semicolon-separated) |
121
+ | `req_ref` | Input | Requirement reference (REQ-NNN:AC-N or gap-id or empty) |
122
+ | `infrastructure_hints` | Input | Framework + pattern references from Step 3 |
123
+ | `prev_context` | Computed | Findings from prior layer scenarios (cross-layer propagation) |
124
+ | `status` | Output | pending → written → passed → failed → blocked |
125
+ | `red_result` | Output | expected_fail / unexpected_fail / pass (RED phase result) |
126
+ | `findings` | Output | Implementation notes, patterns discovered (max 500 chars) |
127
+ | `error` | Output | Error message if failed |
128
+
129
+ ### diagnosis.csv (Iteration Phase — Failure Diagnosis)
130
+
131
+ ```csv
132
+ id,scenario_id,layer,test_file,error_detail,expected,actual,target_file,source_context,classification,fix_code,evidence,error
133
+ "DX-001","AT-003","L1","src/auth/__tests__/token.test.ts","TypeError: verifyToken is not a function","verifyToken returns decoded payload","Function not exported from module","src/auth/token.ts","token.ts exports: generateToken only","test_defect","import { verifyToken } from '../token' → import { verifyToken } from '../verify-token'","src/auth/verify-token.ts:15 exports verifyToken",""
134
+ "DX-002","AT-005","L2","src/routes/__tests__/login.test.ts","Expected 200, received 500","POST /login returns 200 with valid credentials","Internal server error: database connection refused","src/routes/login.ts","login.ts calls UserModel.findByEmail","env_issue","","Database not available in test environment",""
135
+ ```
136
+
137
+ **Columns**:
138
+
139
+ | Column | Phase | Description |
140
+ |--------|-------|-------------|
141
+ | `id` | Input | Diagnosis ID (DX-NNN) |
142
+ | `scenario_id` | Input | Reference to AT-NNN scenario |
143
+ | `layer` | Input | Layer where failure occurred |
144
+ | `test_file` | Input | Test file that failed |
145
+ | `error_detail` | Input | Full error message/stack trace excerpt |
146
+ | `expected` | Input | Expected behavior from scenario |
147
+ | `actual` | Input | Actual behavior observed |
148
+ | `target_file` | Input | Source file being tested |
149
+ | `source_context` | Input | Relevant source code context (exports, imports) |
150
+ | `classification` | Output | test_defect / code_defect / env_issue |
151
+ | `fix_code` | Output | Fix diff for test_defect (old → new) |
152
+ | `evidence` | Output | file:line references for diagnosis |
153
+ | `error` | Output | Agent error if diagnosis failed |
154
+
155
+ ### Session Structure
156
+
157
+ ```
158
+ .tests/auto-test/.csv-session/
159
+ +-- scenarios.csv (master state)
160
+ +-- results.csv (final export)
161
+ +-- discoveries.ndjson (shared across iterations)
162
+ +-- layer-L{N}-write.csv (temporary, per-layer write input)
163
+ +-- layer-L{N}-write-results.csv
164
+ +-- diagnosis-iter-{N}.csv (temporary, per-iteration diagnosis)
165
+ +-- diagnosis-iter-{N}-results.csv
166
+ ```
167
+ </csv_schema>
168
+
169
+ <invariants>
170
+ 1. **Start Immediately**: First action is session initialization
171
+ 2. **Layer Order is Sacred**: Never execute L(N+1) before L(N) completes (fail-fast on critical)
172
+ 3. **CSV is Source of Truth**: Master scenarios.csv holds all test execution state
173
+ 4. **Context Propagation**: prev_context built from prior-layer findings in CSV, not memory
174
+ 5. **Discovery Board Append-Only**: Never clear or modify discoveries.ndjson
175
+ 6. **Route Auto-Detected**: Read state, never ask user for mode
176
+ 7. **RED-GREEN Methodology**: Tests target real behavior; failing test = bug discovery (never fix source)
177
+ 8. **Max 3 Inner Fix Attempts**: Per layer, fix test_defects up to 3 times via diagnosis CSV
178
+ 9. **Convergence Threshold**: 95% pass rate = converged
179
+ 10. **DO NOT STOP**: Continuous execution until convergence, max_iter, or all remaining = code_defect
180
+ </invariants>
181
+
182
+ <execution>
183
+
184
+ ### Session Initialization
185
+
186
+ ```
187
+ Parse from $ARGUMENTS:
188
+ AUTO_YES ← --yes | -y
189
+ maxConcurrency ← --concurrency | -c N (default: 5)
190
+ MAX_ITER ← --max-iter N (default: 5)
191
+ layerFilter ← --layer L (default: null = all)
192
+ startStrategy ← --strategy conservative|aggressive|surgical|reflective (default: null = auto)
193
+ dryRun ← --dry-run
194
+ reRun ← --re-run
195
+ phaseArg ← remaining text
196
+
197
+ Derive:
198
+ dateStr ← UTC+8 YYYYMMDD
199
+ sessionFolder ← ".tests/auto-test/.csv-session"
200
+
201
+ mkdir -p {sessionFolder}
202
+ ```
203
+
204
+ ### Phase 1: Route & Plan → CSV
205
+
206
+ #### Step 0: Parse & Load
207
+
208
+ Resolve phase dir from `state.json` artifact registry (`type='execute'`, matching phase). Error E002 if not found.
209
+
210
+ ```
211
+ specs_test = maestro spec load --category test
212
+ specs_arch = maestro spec load --category arch
213
+ ```
214
+
215
+ #### Step 1: Read State & Route
216
+
217
+ ```
218
+ Priority: Resume > Re-run > Spec > Gap > Code
219
+
220
+ 1. RESUME: .csv-session/scenarios.csv exists AND state.json status == "running"
221
+ → offer resume or restart (resume = reload CSV, jump to current iteration)
222
+
223
+ 2. RE-RUN: --re-run flag AND report.json has failed/blocked scenarios
224
+ → load failed scenarios into CSV with status reset to pending
225
+
226
+ 3. SPEC: .workflow/.spec/SPEC-*/requirements/REQ-*.md exists
227
+ → ROUTE = "spec", SPEC_MODE = "full" | "degraded"
228
+
229
+ 4. GAP: verification.json has gaps[] (MISSING/PARTIAL)
230
+ → ROUTE = "gap"
231
+
232
+ 5. CODE: Default fallback → ROUTE = "code"
233
+ ```
234
+
235
+ #### Step 2: Source Scenarios
236
+
237
+ Execute route-specific extraction, normalize to unified format.
238
+
239
+ **Route A: spec** — Parse REQ acceptance criteria, classify layers, generate fixtures.
240
+ **Route B: gap** — Read verification/coverage gaps, classify files by type.
241
+ **Route C: code** — Explore module boundaries, API endpoints, integration points.
242
+
243
+ All routes produce unified scenario objects (see csv_schema).
244
+
245
+ #### Step 3: Discover Infrastructure
246
+
247
+ Detect framework, read 2-3 existing tests for patterns. Build `infrastructure_hints` string per scenario.
248
+
249
+ #### Step 4: Build scenarios.csv & Confirm
250
+
251
+ 1. Build master `scenarios.csv` — one row per scenario, grouped by layer
252
+ 2. Set `prev_context` for L2 scenarios from L1 scenario descriptions (cross-layer dependency)
253
+ 3. Set `prev_context` for L3 from L2 findings
254
+
255
+ Display plan summary:
256
+ ```
257
+ === AUTO-TEST PLAN ===
258
+ 来源: {ROUTE} | 阶段: {phase_name} | Spec: {spec_ref or "N/A"}
259
+
260
+ L0 Static: {N} checks
261
+ L1 Unit/API: {N} scenarios ({X} critical, {Y} high)
262
+ L2 Integration: {N} scenarios ({X} critical, {Y} high)
263
+ L3 E2E: {N} scenarios ({X} critical, {Y} high)
264
+
265
+ Total: {N} scenarios | Max iterations: {MAX_ITER} | Concurrency: {maxConcurrency}
266
+ Proceed? (yes/edit/cancel)
267
+ ```
268
+
269
+ - `--dry-run`: stop here. `-y`: skip confirmation.
270
+
271
+ ### Phase 2: Layer Execution Engine (Write + Run)
272
+
273
+ #### L0: Static Analysis (no CSV)
274
+
275
+ ```bash
276
+ tsc --noEmit && eslint src/
277
+ ```
278
+
279
+ If L0 fails → stop, do not proceed to L1.
280
+
281
+ #### Per-Layer Write Loop (L1 → L2 → L3)
282
+
283
+ For each layer (sequential, respecting --layer filter):
284
+
285
+ **1. Extract layer rows** from master `scenarios.csv` (filter by `layer == L{N}`, status == pending)
286
+
287
+ **2. Populate `prev_context`** from completed prior-layer findings in master CSV
288
+
289
+ **3. Write `layer-L{N}-write.csv`** then execute parallel test writing:
290
+
291
+ ```javascript
292
+ spawn_agents_on_csv({
293
+ csv_path: `${sessionFolder}/layer-L${N}-write.csv`,
294
+ id_column: "id",
295
+ instruction: buildTestWriterInstruction(infrastructure, specsContent, phaseDir),
296
+ max_concurrency: maxConcurrency,
297
+ max_runtime_seconds: 1800,
298
+ output_csv_path: `${sessionFolder}/layer-L${N}-write-results.csv`,
299
+ output_schema: { id, status: [written|failed], red_result: [expected_fail|unexpected_fail|pass], findings, error }
300
+ })
301
+ ```
302
+
303
+ **Test Writer Agent Instruction** (per scenario row):
304
+ ```
305
+ You are a test writer. Write ONE test file for the given scenario.
306
+
307
+ ## Task
308
+ - Read the target_file to understand the module under test
309
+ - Write test file at test_file path following infrastructure_hints patterns
310
+ - Each test case in test_cases becomes one it() block
311
+ - Use fixtures from fixtures column (infer from source if empty)
312
+ - Include scenario id in describe: describe("AT-NNN: {name}", ...)
313
+ - Run the test file once after writing
314
+
315
+ ## RED-GREEN Rules
316
+ - If test PASSES immediately: note "pass" — may need strengthening
317
+ - If test FAILS as expected (tests real behavior): note "expected_fail" — good
318
+ - If test FAILS unexpectedly (setup/import error): fix test setup, note "unexpected_fail"
319
+ - NEVER modify source code — only write/fix test files
320
+
321
+ ## Output
322
+ - status: "written" if test file created successfully, "failed" if unable
323
+ - red_result: the RED phase outcome
324
+ - findings: patterns discovered, notes for dependent scenarios (max 500 chars)
325
+ - error: only if status == "failed"
326
+
327
+ ## Context
328
+ - prev_context: {prev_context} (findings from prior layer)
329
+ - Read discoveries.ndjson for shared patterns before starting
330
+ - Append to discoveries.ndjson if you find reusable patterns
331
+ ```
332
+
333
+ **4. Merge write-results** into master `scenarios.csv`, delete temp CSV
334
+
335
+ **5. Run full layer test suite:**
336
+ ```bash
337
+ {run_command} --testPathPattern="{layer_pattern}"
338
+ ```
339
+
340
+ **6. Record per-scenario results** (pass/fail/blocked with error_detail)
341
+
342
+ **7. Fail-fast check:** If ANY critical-priority scenario failed → do NOT proceed to next layer
343
+
344
+ **If `--max-iter 1`:** After all layers written and run once, jump to Phase 4 (single-pass).
345
+
346
+ ### Phase 3: Iteration Engine (Diagnose + Fix)
347
+
348
+ ```
349
+ OUTER LOOP (max_iter iterations):
350
+
351
+ FOR each layer with failures (L1 through current):
352
+
353
+ INNER LOOP (max 3 per layer):
354
+
355
+ 1. Build diagnosis.csv from failed scenarios in master CSV
356
+ (only scenarios with status=failed AND classification != code_defect)
357
+
358
+ 2. IF diagnosis rows >= 1:
359
+ spawn_agents_on_csv({
360
+ csv_path: `${sessionFolder}/diagnosis-iter-${iter}.csv`,
361
+ id_column: "id",
362
+ instruction: buildDiagnosisInstruction(infrastructure),
363
+ max_concurrency: maxConcurrency,
364
+ max_runtime_seconds: 1200,
365
+ output_csv_path: `${sessionFolder}/diagnosis-iter-${iter}-results.csv`,
366
+ output_schema: { id, classification, fix_code, evidence, error }
367
+ })
368
+
369
+ 3. Merge diagnosis results:
370
+ - test_defect with fix_code → apply fix, update scenario status to "pending"
371
+ - code_defect → mark as confirmed failure (stop retrying)
372
+ - env_issue → mark as blocked
373
+
374
+ 4. Re-run ALL scenarios in this layer (catch regressions)
375
+ 5. IF no test_defects remain: break inner loop
376
+
377
+ END INNER
378
+
379
+ Record final layer results
380
+ IF critical code_defects: stop layer progression (fail-fast)
381
+
382
+ END FOR
383
+
384
+ REFLECT:
385
+ Analyze: pass rate delta, failure clusters, strategy effectiveness
386
+ Append to reflection-log.md
387
+
388
+ ADJUST (Adaptive Strategy):
389
+ IF startStrategy provided AND iteration == 1: use startStrategy as initial
390
+ OTHERWISE auto-select:
391
+
392
+ | Condition | Strategy |
393
+ |-----------|----------|
394
+ | Iteration 1-2 | Conservative: fix obvious test_defects only |
395
+ | Pass rate >80% | Aggressive: batch-fix related failures |
396
+ | New regressions | Surgical: revert, fix regression only |
397
+ | Stuck 3+ iters | Reflective: re-analyze root cause pattern |
398
+
399
+ CONVERGENCE:
400
+ pass_rate >= 95% → Phase 4 (converged)
401
+ iteration >= max_iter → Phase 4 (max_iter_reached)
402
+ all remaining = code_defect → Phase 4 (confirmed_defects)
403
+ ELSE → next iteration
404
+
405
+ END OUTER
406
+ ```
407
+
408
+ **Diagnosis Agent Instruction** (per failure row):
409
+ ```
410
+ You are a test failure diagnostician. Classify ONE test failure and provide fix if applicable.
411
+
412
+ ## Task
413
+ - Read test_file and target_file to understand the failure context
414
+ - Analyze error_detail against expected vs actual
415
+ - Classify the failure:
416
+ - test_defect: Test is wrong (bad import, wrong endpoint, bad fixture, incorrect assertion)
417
+ - code_defect: Source code violates business rule (actual behavior != expected requirement)
418
+ - env_issue: Environment problem (service down, config missing, timeout)
419
+
420
+ ## Output
421
+ - classification: one of test_defect / code_defect / env_issue
422
+ - fix_code: If test_defect, provide the fix (format: "old_line → new_line" or full replacement)
423
+ If code_defect or env_issue, leave empty
424
+ - evidence: file:line references supporting your classification
425
+ - error: only if you cannot determine classification
426
+
427
+ ## Rules
428
+ - NEVER suggest source code changes — only test code fixes for test_defect
429
+ - A test that correctly catches a real bug is a code_defect, not test_defect
430
+ - When uncertain between test_defect and code_defect, prefer code_defect (conservative)
431
+ ```
432
+
433
+ ### Shared Discovery Board Protocol
434
+
435
+ | Type | Dedup Key | Data Schema |
436
+ |------|-----------|-------------|
437
+ | `test_pattern` | `data.name` | `{name, file, description}` |
438
+ | `mock_setup` | `data.target` | `{target, setup_code, file}` |
439
+ | `fixture` | `data.name` | `{name, schema, file}` |
440
+ | `convention` | singleton | `{describe_style, assertion_lib, import_pattern}` |
441
+ | `blocker` | `data.issue` | `{issue, severity, layer}` |
442
+
443
+ Read before writing tests. Append-only. Dedup by type+key.
444
+
445
+ ### Phase 4: Results & Routing
446
+
447
+ 1. Export final `scenarios.csv` as `results.csv`
448
+
449
+ 2. Write `.tests/auto-test/state.json`:
450
+ ```json
451
+ {
452
+ "session_id": "auto-test-{YYYYMMDD-HHmmss}",
453
+ "phase": "{phase}", "phase_dir": "{PHASE_DIR}",
454
+ "source_route": "spec|gap|code|re-run",
455
+ "status": "converged|max_iter_reached|confirmed_defects|single_pass",
456
+ "iteration": N, "strategy": "conservative",
457
+ "strategy_history": [...],
458
+ "threshold": 95, "current_layer": "L2",
459
+ "layer_state": {
460
+ "L0": { "inner_iter": 1, "pass_rate": 100.0, "status": "passed" },
461
+ "L1": { "inner_iter": 2, "pass_rate": 95.0, "status": "passed" },
462
+ "L2": { ... }, "L3": { ... }
463
+ },
464
+ "pass_rate_history": [...],
465
+ "scenario_count": 30,
466
+ "csv_session": ".tests/auto-test/.csv-session/"
467
+ }
468
+ ```
469
+
470
+ 3. Write `.tests/auto-test/report.json` (same schema as workflow reference)
471
+
472
+ 4. **Conditional: Traceability** (spec source only) — build REQ→AC→scenario→result mapping
473
+
474
+ 5. **Conditional: Issue Creation** (code_defect failures):
475
+ ```
476
+ FOR each failure WHERE classification == "code_defect":
477
+ Append to .workflow/issues/issues.jsonl
478
+ ```
479
+
480
+ 6. **Register artifact** in state.json:
481
+ ```json
482
+ { "id": "TST-NNN", "type": "test", "status": "completed|failed" }
483
+ ```
484
+
485
+ 7. **Report Display:**
486
+ ```
487
+ === AUTO-TEST RESULTS ===
488
+ 阶段: {phase_name}
489
+ 来源: {ROUTE}
490
+ 迭代: {N} (策略: {strategy_history})
491
+ 收敛: {status} ({final_pass_rate}%)
492
+
493
+ 层级结果:
494
+ L0 Static: {pass_rate}% ({passed}/{total})
495
+ L1 Unit/API: {pass_rate}% ({passed}/{total})
496
+ L2 Integration: {pass_rate}% ({passed}/{total})
497
+ L3 E2E: {pass_rate}% ({passed}/{total})
498
+
499
+ 场景: {passed} passed, {failed} failed, {blocked} blocked
500
+ Bugs: {N} discovered
501
+ {IF spec: "需求覆盖: {pct}% | 已验证: {n}/{total}"}
502
+
503
+ CSV Session: .tests/auto-test/.csv-session/
504
+ ```
505
+
506
+ 8. **Route:**
507
+
508
+ | Result | Next Step |
509
+ |--------|-----------|
510
+ | Converged (>=95%) | `$maestro-verify "{phase}"` |
511
+ | All requirements verified (spec) | `$maestro-milestone-audit` |
512
+ | Bugs discovered | `$quality-debug "--from-auto-test {phase}"` |
513
+ | Max iter, >80% | `$quality-test "{phase}"` for manual UAT |
514
+ | Max iter, <80% | `$quality-debug "{phase}"` |
515
+ | Coverage still low | `$quality-auto-test "{phase} --layer {missing}"` |
516
+ | Re-run all pass | `$maestro-verify "{phase}"` |
517
+ | Single pass, all pass | `$quality-test "{phase}"` |
518
+
519
+ </execution>
520
+
521
+ <error_codes>
522
+ | Error | Resolution |
523
+ |-------|------------|
524
+ | Phase not found in artifact registry | Abort: "Phase {N} not found" |
525
+ | No test framework detected | Abort: E003. Install framework or configure runner |
526
+ | Agent spawn fails (write or diagnosis) | Retry once, then mark scenario as blocked |
527
+ | Convergence not met after max_iter | Report max_iter_reached, suggest debug |
528
+ | All scenarios in layer blocked | Stop layer, report env_issue |
529
+ | CSV parse error | Validate format, show line |
530
+ | discoveries.ndjson corrupt | Ignore malformed lines, continue |
531
+ | Resume: no session found | Start fresh |
532
+ </error_codes>
533
+
534
+ <success_criteria>
535
+ - [ ] Session folder created with valid scenarios.csv
536
+ - [ ] Route auto-selected from project state (spec/gap/code)
537
+ - [ ] All layers executed in order with fail-fast on critical
538
+ - [ ] Test writing parallelized via spawn_agents_on_csv per layer
539
+ - [ ] Failure diagnosis parallelized via spawn_agents_on_csv per iteration
540
+ - [ ] discoveries.ndjson append-only throughout
541
+ - [ ] Cross-layer context propagation via prev_context column
542
+ - [ ] Iteration engine ran (inner: test_defect fix, outer: strategy adjust)
543
+ - [ ] state.json, report.json, reflection-log.md written
544
+ - [ ] If spec: traceability.md produced
545
+ - [ ] If failures: issues auto-created in issues.jsonl
546
+ - [ ] Next step routed based on convergence status
547
+ </success_criteria>