Refactor task attachment terminology across workflow commands to use "dispatch" instead of "invoke" for clarity and consistency. Update documentation to reflect changes in task execution and attachment models, emphasizing the orchestrator's role in executing attached tasks. Adjust phase descriptions and command examples to align with the new terminology.

This commit is contained in:
catlog22
2025-11-27 21:34:55 +08:00
parent a62d30acb9
commit 2aa39bd355
7 changed files with 285 additions and 158 deletions

View File

@@ -27,8 +27,8 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*), Glob(*), Write(*
6. **Phase 10 (ui-assembly)****Attach tasks → Execute → Collapse** → Workflow complete
**Phase Transition Mechanism**:
- **Phase 5 (User Interaction)**: User confirms targets → IMMEDIATELY triggers Phase 7
- **Phase 7-10 (Autonomous)**: `SlashCommand` invocation **ATTACHES** tasks to current workflow
- **Phase 5 (User Interaction)**: User confirms targets → IMMEDIATELY dispatches Phase 7
- **Phase 7-10 (Autonomous)**: SlashCommand dispatch **ATTACHES** tasks to current workflow
- **Task Execution**: Orchestrator **EXECUTES** these attached tasks itself
- **Task Collapse**: After tasks complete, collapse them into phase summary
- **Phase Transition**: Automatically execute next phase after collapsing
@@ -36,7 +36,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*), Glob(*), Write(*
**Auto-Continue Mechanism**: TodoWrite tracks phase status with dynamic task attachment/collapse. After executing all attached tasks, you MUST immediately collapse them, restore phase summary, and execute the next phase. No user intervention required. The workflow is NOT complete until Phase 10 (UI assembly) finishes.
**Task Attachment Model**: SlashCommand invocation is NOT delegation - it's task expansion. The orchestrator executes these attached tasks itself, not waiting for external completion.
**Task Attachment Model**: SlashCommand dispatch is NOT delegation - it's task expansion. The orchestrator executes these attached tasks itself, not waiting for external completion.
**Target Type Detection**: Automatically inferred from prompt/targets, or explicitly set via `--target-type`.
@@ -63,26 +63,26 @@ Phase 5: Unified Target Inference
Phase 6: Code Import (Conditional)
└─ Decision (design_source):
├─ code_only | hybrid → Execute /workflow:ui-design:import-from-code
├─ code_only | hybrid → Dispatch /workflow:ui-design:import-from-code
└─ visual_only → Skip to Phase 7
Phase 7: Style Extraction
└─ Decision (needs_visual_supplement):
├─ visual_only OR supplement needed → Execute /workflow:ui-design:style-extract
├─ visual_only OR supplement needed → Dispatch /workflow:ui-design:style-extract
└─ code_only AND style_complete → Use code import
Phase 8: Animation Extraction
└─ Decision (should_extract_animation):
├─ visual_only OR incomplete OR regenerate → Execute /workflow:ui-design:animation-extract
├─ visual_only OR incomplete OR regenerate → Dispatch /workflow:ui-design:animation-extract
└─ code_only AND animation_complete → Use code import
Phase 9: Layout Extraction
└─ Decision (needs_visual_supplement OR NOT layout_complete):
├─ True → Execute /workflow:ui-design:layout-extract
├─ True → Dispatch /workflow:ui-design:layout-extract
└─ False → Use code import
Phase 10: UI Assembly
└─ Execute /workflow:ui-design:generate → Workflow complete
└─ Dispatch /workflow:ui-design:generate → Workflow complete
```
## Core Rules
@@ -92,7 +92,7 @@ Phase 10: UI Assembly
3. **Parse & Pass**: Extract data from each output for next phase
4. **Default to All**: When selecting variants/prototypes, use ALL generated items
5. **Track Progress**: Update TodoWrite dynamically with task attachment/collapse pattern
6. **⚠️ CRITICAL: Task Attachment Model** - SlashCommand invocation **ATTACHES** tasks to current workflow. Orchestrator **EXECUTES** these attached tasks itself, not waiting for external completion. This is NOT delegation - it's task expansion.
6. **⚠️ CRITICAL: Task Attachment Model** - SlashCommand dispatch **ATTACHES** tasks to current workflow. Orchestrator **EXECUTES** these attached tasks itself, not waiting for external completion. This is NOT delegation - it's task expansion.
7. **⚠️ CRITICAL: DO NOT STOP** - This is a continuous multi-phase workflow. After executing all attached tasks, you MUST immediately collapse them and execute the next phase. Workflow is NOT complete until Phase 10 (UI assembly) finishes.
## Parameter Requirements
@@ -355,13 +355,16 @@ detect_target_type(target_list):
```
### Phase 6: Code Import & Completeness Assessment (Conditional)
```bash
**Step 6.1: Dispatch** - Import design system from code files
```javascript
IF design_source IN ["code_only", "hybrid"]:
REPORT: "🔍 Phase 6: Code Import ({design_source})"
command = "/workflow:ui-design:import-from-code --design-id \"{design_id}\" --source \"{code_base_path}\""
TRY:
# SlashCommand invocation ATTACHES import-from-code's tasks to current workflow
# SlashCommand dispatch ATTACHES import-from-code's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself:
# - Phase 0: Discover and categorize code files
# - Phase 1.1-1.3: Style/Animation/Layout Agent extraction
@@ -465,7 +468,10 @@ IF design_source IN ["code_only", "hybrid"]:
```
### Phase 7: Style Extraction
```bash
**Step 7.1: Dispatch** - Extract style design systems
```javascript
IF design_source == "visual_only" OR needs_visual_supplement:
REPORT: "🎨 Phase 7: Style Extraction (variants: {style_variants})"
command = "/workflow:ui-design:style-extract --design-id \"{design_id}\" " +
@@ -473,7 +479,7 @@ IF design_source == "visual_only" OR needs_visual_supplement:
(prompt_text ? "--prompt \"{prompt_text}\" " : "") +
"--variants {style_variants} --interactive"
# SlashCommand invocation ATTACHES style-extract's tasks to current workflow
# SlashCommand dispatch ATTACHES style-extract's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(command)
@@ -483,7 +489,10 @@ ELSE:
```
### Phase 8: Animation Extraction
```bash
**Step 8.1: Dispatch** - Extract animation patterns
```javascript
# Determine if animation extraction is needed
should_extract_animation = false
@@ -513,7 +522,7 @@ IF should_extract_animation:
command = " ".join(command_parts)
# SlashCommand invocation ATTACHES animation-extract's tasks to current workflow
# SlashCommand dispatch ATTACHES animation-extract's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(command)
@@ -526,7 +535,10 @@ ELSE:
```
### Phase 9: Layout Extraction
```bash
**Step 9.1: Dispatch** - Extract layout templates
```javascript
targets_string = ",".join(inferred_target_list)
IF (design_source == "visual_only" OR needs_visual_supplement) OR (NOT layout_complete):
@@ -536,7 +548,7 @@ IF (design_source == "visual_only" OR needs_visual_supplement) OR (NOT layout_co
(prompt_text ? "--prompt \"{prompt_text}\" " : "") +
"--targets \"{targets_string}\" --variants {layout_variants} --device-type \"{device_type}\" --interactive"
# SlashCommand invocation ATTACHES layout-extract's tasks to current workflow
# SlashCommand dispatch ATTACHES layout-extract's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(command)
@@ -546,7 +558,10 @@ ELSE:
```
### Phase 10: UI Assembly
```bash
**Step 10.1: Dispatch** - Assemble UI prototypes from design tokens and layout templates
```javascript
command = "/workflow:ui-design:generate --design-id \"{design_id}\"" + (--session ? " --session {session_id}" : "")
total = style_variants × layout_variants × len(inferred_target_list)
@@ -556,7 +571,7 @@ REPORT: " → Pure assembly: Combining layout templates + design tokens"
REPORT: " → Device: {device_type} (from layout templates)"
REPORT: " → Assembly tasks: {total} combinations"
# SlashCommand invocation ATTACHES generate's tasks to current workflow
# SlashCommand dispatch ATTACHES generate's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(command)
@@ -581,10 +596,10 @@ TodoWrite({todos: [
// ⚠️ CRITICAL: Dynamic TodoWrite task attachment strategy:
//
// **Key Concept**: SlashCommand invocation ATTACHES tasks to current workflow.
// **Key Concept**: SlashCommand dispatch ATTACHES tasks to current workflow.
// Orchestrator EXECUTES these attached tasks itself, not waiting for external completion.
//
// Phase 7-10 SlashCommand Invocation Pattern (when tasks are attached):
// Phase 7-10 SlashCommand Dispatch Pattern (when tasks are attached):
// Example - Phase 7 with sub-tasks:
// [
// {"content": "Phase 7: Style Extraction", "status": "in_progress", "activeForm": "Executing style extraction"},

View File

@@ -26,7 +26,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Write(*), Bash(*)
7. Phase 4: Design system integration → **Execute orchestrator task** → Reports completion
**Phase Transition Mechanism**:
- **Task Attachment**: `SlashCommand` invocation **ATTACHES** tasks to current workflow
- **Task Attachment**: SlashCommand dispatch **ATTACHES** tasks to current workflow
- **Task Execution**: Orchestrator **EXECUTES** these attached tasks itself
- **Task Collapse**: After tasks complete, collapse them into phase summary
- **Phase Transition**: Automatically execute next phase after collapsing
@@ -34,7 +34,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Write(*), Bash(*)
**Auto-Continue Mechanism**: TodoWrite tracks phase status with dynamic task attachment/collapse. After executing all attached tasks, you MUST immediately collapse them, restore phase summary, and execute the next phase. No user intervention required. The workflow is NOT complete until reaching Phase 4.
**Task Attachment Model**: SlashCommand invocation is NOT delegation - it's task expansion. The orchestrator executes these attached tasks itself, not waiting for external completion.
**Task Attachment Model**: SlashCommand dispatch is NOT delegation - it's task expansion. The orchestrator executes these attached tasks itself, not waiting for external completion.
## Execution Process
@@ -53,30 +53,30 @@ Phase 0: Parameter Parsing & Input Detection
Phase 0.5: Code Import (Conditional)
└─ Decision (design_source):
├─ hybrid → Execute /workflow:ui-design:import-from-code
├─ hybrid → Dispatch /workflow:ui-design:import-from-code
└─ Other → Skip to Phase 2
Phase 2: Style Extraction
└─ Decision (skip_style):
├─ code_only AND style_complete → Use code import
└─ Otherwise → Execute /workflow:ui-design:style-extract
└─ Otherwise → Dispatch /workflow:ui-design:style-extract
Phase 2.3: Animation Extraction
└─ Decision (skip_animation):
├─ code_only AND animation_complete → Use code import
└─ Otherwise → Execute /workflow:ui-design:animation-extract
└─ Otherwise → Dispatch /workflow:ui-design:animation-extract
Phase 2.5: Layout Extraction
└─ Decision (skip_layout):
├─ code_only AND layout_complete → Use code import
└─ Otherwise → Execute /workflow:ui-design:layout-extract
└─ Otherwise → Dispatch /workflow:ui-design:layout-extract
Phase 3: UI Assembly
└─ Execute /workflow:ui-design:generate
└─ Dispatch /workflow:ui-design:generate
Phase 4: Design System Integration
└─ Decision (session_id):
├─ Provided → Execute /workflow:ui-design:update
├─ Provided → Dispatch /workflow:ui-design:update
└─ Not provided → Standalone completion
```
@@ -86,7 +86,7 @@ Phase 4: Design System Integration
2. **No Preliminary Validation**: Sub-commands handle their own validation
3. **Parse & Pass**: Extract data from each output for next phase
4. **Track Progress**: Update TodoWrite dynamically with task attachment/collapse pattern
5. **⚠️ CRITICAL: Task Attachment Model** - SlashCommand invocation **ATTACHES** tasks to current workflow. Orchestrator **EXECUTES** these attached tasks itself, not waiting for external completion. This is NOT delegation - it's task expansion.
5. **⚠️ CRITICAL: Task Attachment Model** - SlashCommand dispatch **ATTACHES** tasks to current workflow. Orchestrator **EXECUTES** these attached tasks itself, not waiting for external completion. This is NOT delegation - it's task expansion.
6. **⚠️ CRITICAL: DO NOT STOP** - This is a continuous multi-phase workflow. After executing all attached tasks, you MUST immediately collapse them and execute the next phase. Workflow is NOT complete until Phase 4.
## Parameter Requirements
@@ -276,7 +276,9 @@ TodoWrite({todos: [
### Phase 0.5: Code Import & Completeness Assessment (Conditional)
```bash
**Step 0.5.1: Dispatch** - Import design system from code files
```javascript
# Only execute if code files detected
IF design_source == "hybrid":
REPORT: "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@@ -289,7 +291,7 @@ IF design_source == "hybrid":
"--source \"{code_base_path}\""
TRY:
# SlashCommand invocation ATTACHES import-from-code's tasks to current workflow
# SlashCommand dispatch ATTACHES import-from-code's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself:
# - Phase 0: Discover and categorize code files
# - Phase 1.1-1.3: Style/Animation/Layout Agent extraction
@@ -380,7 +382,9 @@ TodoWrite(mark_completed: "Initialize and detect design source",
### Phase 2: Style Extraction
```bash
**Step 2.1: Dispatch** - Extract style design system
```javascript
# Determine if style extraction needed
skip_style = (design_source == "code_only" AND style_complete)
@@ -405,7 +409,7 @@ ELSE:
extract_command = " ".join(command_parts)
# SlashCommand invocation ATTACHES style-extract's tasks to current workflow
# SlashCommand dispatch ATTACHES style-extract's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(extract_command)
@@ -415,7 +419,9 @@ ELSE:
### Phase 2.3: Animation Extraction
```bash
**Step 2.3.1: Dispatch** - Extract animation patterns
```javascript
skip_animation = (design_source == "code_only" AND animation_complete)
IF skip_animation:
@@ -436,7 +442,7 @@ ELSE:
animation_extract_command = " ".join(command_parts)
# SlashCommand invocation ATTACHES animation-extract's tasks to current workflow
# SlashCommand dispatch ATTACHES animation-extract's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(animation_extract_command)
@@ -446,7 +452,9 @@ ELSE:
### Phase 2.5: Layout Extraction
```bash
**Step 2.5.1: Dispatch** - Extract layout templates
```javascript
skip_layout = (design_source == "code_only" AND layout_complete)
IF skip_layout:
@@ -469,7 +477,7 @@ ELSE:
layout_extract_command = " ".join(command_parts)
# SlashCommand invocation ATTACHES layout-extract's tasks to current workflow
# SlashCommand dispatch ATTACHES layout-extract's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(layout_extract_command)
@@ -479,11 +487,13 @@ ELSE:
### Phase 3: UI Assembly
```bash
**Step 3.1: Dispatch** - Assemble UI prototypes from design tokens and layout templates
```javascript
REPORT: "🚀 Phase 3: UI Assembly"
generate_command = f"/workflow:ui-design:generate --design-id \"{design_id}\""
# SlashCommand invocation ATTACHES generate's tasks to current workflow
# SlashCommand dispatch ATTACHES generate's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(generate_command)
@@ -493,12 +503,14 @@ TodoWrite(mark_completed: "Assemble UI", mark_in_progress: session_id ? "Integra
### Phase 4: Design System Integration
```bash
**Step 4.1: Dispatch** - Integrate design system into workflow session
```javascript
IF session_id:
REPORT: "🚀 Phase 4: Design System Integration"
update_command = f"/workflow:ui-design:update --session {session_id}"
# SlashCommand invocation ATTACHES update's tasks to current workflow
# SlashCommand dispatch ATTACHES update's tasks to current workflow
# Orchestrator will EXECUTE these attached tasks itself
SlashCommand(update_command)
@@ -624,10 +636,10 @@ TodoWrite({todos: [
// ⚠️ CRITICAL: Dynamic TodoWrite task attachment strategy:
//
// **Key Concept**: SlashCommand invocation ATTACHES tasks to current workflow.
// **Key Concept**: SlashCommand dispatch ATTACHES tasks to current workflow.
// Orchestrator EXECUTES these attached tasks itself, not waiting for external completion.
//
// Phase 2-4 SlashCommand Invocation Pattern (when tasks are attached):
// Phase 2-4 SlashCommand Dispatch Pattern (when tasks are attached):
// Example - Phase 2 with sub-tasks:
// [
// {"content": "Phase 0: Initialize and Detect Design Source", "status": "completed", "activeForm": "Initializing"},
@@ -690,7 +702,7 @@ TodoWrite({todos: [
- **Input**: `--images` (glob pattern) and/or `--prompt` (text/file paths) + optional `--session`
- **Output**: Complete design system in `{base_path}/` (style-extraction, layout-extraction, prototypes)
- **Sub-commands Called**:
- **Sub-commands Dispatched**:
1. `/workflow:ui-design:import-from-code` (Phase 0.5, conditional - if code files detected)
2. `/workflow:ui-design:style-extract` (Phase 2 - complete design systems)
3. `/workflow:ui-design:animation-extract` (Phase 2.3 - animation tokens)