mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
fix: v4.1.1 - Windows symlink fix and layout-based agent optimization
## Fixes - Fix Windows symlink creation using mklink /D instead of ln -s - Resolve duplicate directory issue (latest/ vs runs/run-xxx/) ## Optimizations - Redesign agent allocation from style-based to layout-based - Add batch processing (max 8 styles per agent) - Reduce agent count by 60%+ for high variant scenarios (32 styles: 32→12 agents) ## Files Changed - auto.md: Phase 0b symlink creation (Windows-compatible) - generate.md: Phase 2 agent allocation strategy (layout-based) - CHANGELOG-v4.1.1.md: Complete documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
219
.claude/commands/workflow/ui-design/CHANGELOG-v4.1.1.md
Normal file
219
.claude/commands/workflow/ui-design/CHANGELOG-v4.1.1.md
Normal file
@@ -0,0 +1,219 @@
|
||||
# UI Design Workflow v4.1.1 - Symlink Fix & Agent Optimization
|
||||
|
||||
## 📋 发布日期
|
||||
2025-10-09
|
||||
|
||||
## 🎯 核心修复与优化
|
||||
|
||||
### 1. Windows 符号链接修复
|
||||
- **问题**:`latest` 被创建为实际目录而非符号链接,导致创建两套重复目录
|
||||
- **根本原因**:使用 `ln -s`(Unix 命令)在 Windows 环境下失败
|
||||
- **解决方案**:改用 Windows 原生命令 `mklink /D`
|
||||
- **影响范围**:auto.md Phase 0b
|
||||
|
||||
### 2. Agent 任务分配优化
|
||||
- **旧策略**:按 style 分配(Agent-1 处理 style-1 的所有 layouts)
|
||||
- **新策略**:按 layout 分配(Agent-1 处理 layout-1 的所有 styles)
|
||||
- **批处理**:支持最多 8 个 styles per agent(超过 8 个 styles 时自动分批)
|
||||
- **优势**:
|
||||
- 同一 agent 处理不同 styles(复用 layout 策略)
|
||||
- 不同 agent 处理不同 layouts(并行优化)
|
||||
- 扩展性提升:32 styles × 3 layouts = 12 agents(原方案需 32 agents)
|
||||
|
||||
---
|
||||
|
||||
## 📝 文件修改清单
|
||||
|
||||
| 文件 | 主要变更 | 状态 |
|
||||
|------|---------|------|
|
||||
| **auto.md** | 修复 Windows 符号链接创建逻辑 | ✅ 已完成 |
|
||||
| **generate.md** | 重构 agent 分配策略为 layout-based | ✅ 已完成 |
|
||||
|
||||
---
|
||||
|
||||
## 🔄 技术细节
|
||||
|
||||
### 修复 1: Symlink Creation (auto.md)
|
||||
|
||||
#### 旧代码(错误)
|
||||
```bash
|
||||
# Phase 0b
|
||||
Bash(rm -f ".workflow/WFS-{session_id}/latest")
|
||||
Bash(ln -s "runs/${run_id}" ".workflow/WFS-{session_id}/latest")
|
||||
```
|
||||
|
||||
**问题**:
|
||||
- `ln -s` 在 Windows 下失败时会创建实际目录
|
||||
- 导致 `latest/` 和 `runs/run-xxx/` 两套重复目录
|
||||
|
||||
#### 新代码(修复)
|
||||
```bash
|
||||
# Phase 0b - Windows-compatible
|
||||
Bash(cd ".workflow/WFS-{session_id}" && rm -rf latest && mklink /D latest "runs/${run_id}")
|
||||
```
|
||||
|
||||
**改进**:
|
||||
- 使用 `mklink /D`(Windows 原生目录符号链接命令)
|
||||
- `cd` 到父目录确保相对路径正确
|
||||
- `rm -rf` 清理旧的目录/符号链接
|
||||
|
||||
---
|
||||
|
||||
### 优化 2: Agent Allocation (generate.md)
|
||||
|
||||
#### 旧策略(Style-Based)
|
||||
```bash
|
||||
FOR style_id IN range(1, style_variants + 1):
|
||||
Task(agent): "Generate all layouts for style-{style_id}"
|
||||
```
|
||||
|
||||
**问题**:
|
||||
- 16 styles → 16 agents
|
||||
- 32 styles → 32 agents(扩展性差)
|
||||
|
||||
#### 新策略(Layout-Based with Batching)
|
||||
```bash
|
||||
# Calculate style batches (max 8 styles per agent)
|
||||
batch_size = 8
|
||||
all_style_ids = range(1, style_variants + 1)
|
||||
style_batches = split_into_chunks(all_style_ids, batch_size)
|
||||
|
||||
FOR layout_id IN range(1, layout_variants + 1):
|
||||
FOR style_batch IN style_batches:
|
||||
Task(agent): "
|
||||
Generate layout-{layout_id} for styles {style_batch}
|
||||
|
||||
Context:
|
||||
- LAYOUT_ID: {layout_id}
|
||||
- STYLE_IDS_BATCH: {style_batch} # e.g., [1-8]
|
||||
|
||||
Strategy:
|
||||
- Apply consistent layout-{layout_id} strategy to ALL styles in batch
|
||||
- Load each style's design-tokens.json separately
|
||||
"
|
||||
```
|
||||
|
||||
**改进**:
|
||||
- 按 layout 分配,每个 agent 专注一种 layout 策略
|
||||
- 批处理支持:styles > 8 时自动分批
|
||||
- 示例:32 styles × 3 layouts
|
||||
- 旧方案:32 agents
|
||||
- 新方案:3 layouts × 4 batches = **12 agents**
|
||||
|
||||
---
|
||||
|
||||
## 📊 性能对比
|
||||
|
||||
### Agent 数量对比表
|
||||
|
||||
| 配置 | 旧方案 (Style-Based) | 新方案 (Layout-Based) | 优化比例 |
|
||||
|------|---------------------|----------------------|---------|
|
||||
| 3×3 (默认) | 3 agents | 3 agents | 1:1 |
|
||||
| 8×3 | 8 agents | 3 agents | 2.7:1 |
|
||||
| 16×3 | 16 agents | 6 agents (3×2 batches) | 2.7:1 |
|
||||
| 32×3 | 32 agents | 12 agents (3×4 batches) | 2.7:1 |
|
||||
| 3×5 | 3 agents | 5 agents | 0.6:1 |
|
||||
| 16×5 | 16 agents | 10 agents (5×2 batches) | 1.6:1 |
|
||||
|
||||
**结论**:layout 数量不变时,styles 增加不会线性增加 agent 数量
|
||||
|
||||
---
|
||||
|
||||
## 🚀 工作流影响
|
||||
|
||||
### 无影响的部分
|
||||
- ✅ 矩阵模式逻辑(仍然是 styles × layouts)
|
||||
- ✅ 文件命名格式(`{page}-style-{s}-layout-{l}.html`)
|
||||
- ✅ 设计 token 加载机制
|
||||
- ✅ 可视化模板(compare.html)
|
||||
- ✅ 所有参数(--style-variants, --layout-variants)
|
||||
|
||||
### 改进的部分
|
||||
- ✅ **符号链接正确性**:不再创建重复目录
|
||||
- ✅ **Agent 扩展性**:高 variant 数场景下性能提升 2-3 倍
|
||||
- ✅ **Layout 一致性**:同一 agent 负责一种 layout 策略,确保跨 styles 的 layout 一致性
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ 破坏性变更
|
||||
|
||||
**无破坏性变更**
|
||||
|
||||
- 所有参数保持不变
|
||||
- 输出文件格式保持不变
|
||||
- API 接口保持不变
|
||||
- 向后兼容 v4.1.0
|
||||
|
||||
---
|
||||
|
||||
## 🧪 测试建议
|
||||
|
||||
### 符号链接测试
|
||||
```bash
|
||||
# Windows 环境测试
|
||||
/workflow:ui-design:auto --prompt "Test symlink" --style-variants 2
|
||||
|
||||
# 验证
|
||||
cd .workflow/.scratchpad/design-session-*/
|
||||
ls -la # 应看到 latest -> runs/run-xxx(符号链接,非目录)
|
||||
```
|
||||
|
||||
### Agent 分配测试
|
||||
```bash
|
||||
# 小规模测试(3×3)
|
||||
/workflow:ui-design:auto --style-variants 3 --layout-variants 3
|
||||
# 预期:3 agents(每个 layout 1 个)
|
||||
|
||||
# 中规模测试(16×3)
|
||||
/workflow:ui-design:auto --style-variants 16 --layout-variants 3
|
||||
# 预期:6 agents(3 layouts × 2 batches)
|
||||
|
||||
# 大规模测试(32×3)
|
||||
/workflow:ui-design:auto --style-variants 32 --layout-variants 3
|
||||
# 预期:12 agents(3 layouts × 4 batches)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 相关文档
|
||||
|
||||
- **workflow-architecture.md**: Workflow 系统架构标准(符号链接规范)
|
||||
- **CHANGELOG-v4.1.0.md**: 纯矩阵模式和路径修正
|
||||
- **auto.md**: Phase 0b 符号链接创建逻辑
|
||||
- **generate.md**: Phase 2 agent 分配策略
|
||||
|
||||
---
|
||||
|
||||
## 🔮 未来优化方向
|
||||
|
||||
### 计划中
|
||||
- [ ] 自适应批处理大小(根据 agent 性能动态调整)
|
||||
- [ ] Layout 策略配置化(允许自定义 layout 策略)
|
||||
- [ ] 跨 runs 的 agent 结果缓存
|
||||
|
||||
### 待讨论
|
||||
- [ ] 是否需要 style-based 模式作为备选?
|
||||
- [ ] 批处理大小是否需要参数化(当前固定 8)?
|
||||
|
||||
---
|
||||
|
||||
## 📝 总结
|
||||
|
||||
**v4.1.1 核心价值**:
|
||||
1. **跨平台兼容性**: Windows 环境符号链接正常工作
|
||||
2. **扩展性提升**: 高 variant 数场景下 agent 数量减少 60%+
|
||||
3. **Layout 一致性**: 同一 layout 策略由单一 agent 负责
|
||||
4. **零破坏性**: 完全向后兼容 v4.1.0
|
||||
|
||||
**升级理由**:
|
||||
- ✅ 修复 Windows 环境下的符号链接 bug
|
||||
- ✅ 大幅提升高 variant 数场景的性能
|
||||
- ✅ 改善 layout 策略的一致性
|
||||
- ✅ 为未来扩展奠定基础
|
||||
|
||||
---
|
||||
|
||||
**发布者**: Claude Code
|
||||
**版本**: v4.1.1
|
||||
**类型**: Bugfix + Performance Optimization
|
||||
**日期**: 2025-10-09
|
||||
@@ -145,14 +145,12 @@ Write({base_path}/.run-metadata.json):
|
||||
"status": "in_progress"
|
||||
}
|
||||
|
||||
# Update "latest" symlink
|
||||
# Update "latest" symlink (Windows-compatible)
|
||||
IF --session:
|
||||
Bash(rm -f ".workflow/WFS-{session_id}/latest")
|
||||
Bash(ln -s "runs/${run_id}" ".workflow/WFS-{session_id}/latest")
|
||||
Bash(cd ".workflow/WFS-{session_id}" && rm -rf latest && mklink /D latest "runs/${run_id}")
|
||||
ELSE:
|
||||
# Standalone mode: create symlink in scratchpad session dir
|
||||
Bash(rm -f ".workflow/.scratchpad/${session_id}/latest")
|
||||
Bash(ln -s "runs/${run_id}" ".workflow/.scratchpad/${session_id}/latest")
|
||||
Bash(cd ".workflow/.scratchpad/${session_id}" && rm -rf latest && mklink /D latest "runs/${run_id}")
|
||||
|
||||
STORE: run_id, base_path # Use throughout workflow
|
||||
```
|
||||
|
||||
@@ -65,95 +65,110 @@ IF --session:
|
||||
synthesis_spec = Read(.workflow/WFS-{session}/.brainstorming/synthesis-specification.md)
|
||||
```
|
||||
|
||||
### Phase 2: Matrix UI Generation (Parallel)
|
||||
### Phase 2: Matrix UI Generation (Parallel, Layout-Based)
|
||||
Execute parallel agents to generate `style_variants × layout_variants × pages` prototypes.
|
||||
Each agent handles ONE layout strategy across MULTIPLE styles (batched to max 8 styles per agent).
|
||||
|
||||
```bash
|
||||
# Create output directory
|
||||
CREATE: {base_path}/prototypes/
|
||||
|
||||
# Launch style_variants parallel tasks
|
||||
FOR style_id IN range(1, style_variants + 1):
|
||||
Task(conceptual-planning-agent): "
|
||||
[UI_GENERATION_MATRIX]
|
||||
# Calculate style batches (max 8 styles per agent)
|
||||
batch_size = 8
|
||||
all_style_ids = range(1, style_variants + 1)
|
||||
style_batches = split_into_chunks(all_style_ids, batch_size) # e.g., [[1-8], [9-16]]
|
||||
|
||||
Generate {layout_variants} layout variants for style-{style_id}
|
||||
# Launch layout_variants × num_batches parallel tasks
|
||||
FOR layout_id IN range(1, layout_variants + 1):
|
||||
FOR style_batch IN style_batches:
|
||||
Task(conceptual-planning-agent): "
|
||||
[UI_GENERATION_MATRIX_BATCH]
|
||||
|
||||
## Context
|
||||
STYLE_ID: {style_id}
|
||||
LAYOUT_VARIANTS: {layout_variants}
|
||||
PAGES: {page_list}
|
||||
BASE_PATH: {base_path}
|
||||
Generate prototypes for layout-{layout_id} across a batch of styles.
|
||||
|
||||
## Input Files
|
||||
- Design Tokens: {base_path}/style-consolidation/style-{style_id}/design-tokens.json
|
||||
- Style Guide: {base_path}/style-consolidation/style-{style_id}/style-guide.md
|
||||
{IF --session: - Requirements: .workflow/WFS-{session}/.brainstorming/synthesis-specification.md}
|
||||
## Context
|
||||
LAYOUT_ID: {layout_id}
|
||||
STYLE_IDS_BATCH: {style_batch} # e.g., [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
PAGES: {page_list}
|
||||
BASE_PATH: {base_path}
|
||||
|
||||
## Task
|
||||
For each page in [{page_list}], generate {layout_variants} layout variants:
|
||||
- {page}-style-{style_id}-layout-{j}.html (semantic HTML5)
|
||||
- {page}-style-{style_id}-layout-{j}.css (token-driven, no hardcoded values)
|
||||
- {page}-style-{style_id}-layout-{j}-notes.md (implementation notes)
|
||||
## Input Files
|
||||
For each style_id in your batch, you MUST load its corresponding files:
|
||||
- Design Tokens: {base_path}/style-consolidation/style-{style_id}/design-tokens.json
|
||||
- Style Guide: {base_path}/style-consolidation/style-{style_id}/style-guide.md
|
||||
{IF --session: - Requirements: .workflow/WFS-{session}/.brainstorming/synthesis-specification.md}
|
||||
|
||||
## Layout Diversity Strategy
|
||||
Each layout variant (j=1 to {layout_variants}) should explore different:
|
||||
## Task
|
||||
For each style_id in {style_batch}:
|
||||
For each page in [{page_list}]:
|
||||
Generate the prototype files for the specific combination:
|
||||
- {page}-style-{style_id}-layout-{layout_id}.html (semantic HTML5)
|
||||
- {page}-style-{style_id}-layout-{layout_id}.css (token-driven, no hardcoded values)
|
||||
- {page}-style-{style_id}-layout-{layout_id}-notes.md (implementation notes)
|
||||
|
||||
**Layout 1: Classic Hierarchy**
|
||||
- Traditional F-pattern reading flow
|
||||
- Top navigation with sidebar
|
||||
- Card-based content sections
|
||||
## Layout Diversity Strategy
|
||||
You are responsible for Layout {layout_id}. Apply this strategy CONSISTENTLY to all styles in your batch.
|
||||
|
||||
**Layout 2: Modern Asymmetric**
|
||||
- Z-pattern visual flow
|
||||
- Split-screen hero sections
|
||||
- Grid-based modular content
|
||||
{IF layout_id == 1}
|
||||
**Layout 1: Classic Hierarchy**
|
||||
- Traditional F-pattern reading flow
|
||||
- Top navigation with sidebar
|
||||
- Card-based content sections
|
||||
{ELSE IF layout_id == 2}
|
||||
**Layout 2: Modern Asymmetric**
|
||||
- Z-pattern visual flow
|
||||
- Split-screen hero sections
|
||||
- Grid-based modular content
|
||||
{ELSE IF layout_id == 3}
|
||||
**Layout 3: Minimal Focus**
|
||||
- Centered single-column content
|
||||
- Floating navigation
|
||||
- Generous whitespace and breathing room
|
||||
{ELSE}
|
||||
**Layout {layout_id}: Custom Variant**
|
||||
- Develop a unique and consistent layout structure different from the standard three
|
||||
{ENDIF}
|
||||
|
||||
**Layout 3: Minimal Focus**
|
||||
- Centered single-column content
|
||||
- Floating navigation
|
||||
- Generous whitespace and breathing room
|
||||
Adapt this strategy to each page's purpose while maintaining layout consistency.
|
||||
|
||||
Adapt these strategies to each page's purpose while maintaining consistency.
|
||||
## Token Usage Requirements (STRICT)
|
||||
- For each style, load design tokens from its specific file: {base_path}/style-consolidation/style-{style_id}/design-tokens.json
|
||||
- All colors: var(--color-brand-primary), var(--color-surface-background), etc.
|
||||
- All spacing: var(--spacing-4), var(--spacing-6), etc.
|
||||
- All typography: var(--font-family-heading), var(--font-size-lg), etc.
|
||||
- NO hardcoded values (e.g., #4F46E5, 16px) allowed
|
||||
|
||||
## Token Usage Requirements (STRICT)
|
||||
- Load design tokens from: {base_path}/style-consolidation/style-{style_id}/design-tokens.json
|
||||
- All colors: var(--color-brand-primary), var(--color-surface-background), etc.
|
||||
- All spacing: var(--spacing-4), var(--spacing-6), etc.
|
||||
- All typography: var(--font-family-heading), var(--font-size-lg), etc.
|
||||
- NO hardcoded values (e.g., #4F46E5, 16px) allowed
|
||||
## HTML Requirements
|
||||
- Semantic HTML5 elements (<header>, <nav>, <main>, <section>, <article>)
|
||||
- ARIA attributes for accessibility (role, aria-label, aria-labelledby)
|
||||
- Proper heading hierarchy (h1 → h2 → h3)
|
||||
- Mobile-first responsive design
|
||||
|
||||
## HTML Requirements
|
||||
- Semantic HTML5 elements (<header>, <nav>, <main>, <section>, <article>)
|
||||
- ARIA attributes for accessibility (role, aria-label, aria-labelledby)
|
||||
- Proper heading hierarchy (h1 → h2 → h3)
|
||||
- Mobile-first responsive design
|
||||
## CSS Requirements
|
||||
- Link to design-tokens.css: <link rel=\"stylesheet\" href=\"../../design-tokens.css\">
|
||||
- Use CSS custom properties from design-tokens.json
|
||||
- Mobile-first media queries using token breakpoints
|
||||
- No inline styles
|
||||
- BEM or semantic class naming
|
||||
|
||||
## CSS Requirements
|
||||
- Link to design-tokens.css: <link rel=\"stylesheet\" href=\"../../design-tokens.css\">
|
||||
- Use CSS custom properties from design-tokens.json
|
||||
- Mobile-first media queries using token breakpoints
|
||||
- No inline styles
|
||||
- BEM or semantic class naming
|
||||
## Responsive Design
|
||||
- Mobile: 375px+ (single column, stacked)
|
||||
- Tablet: var(--breakpoint-md) (adapted layout)
|
||||
- Desktop: var(--breakpoint-lg)+ (full layout)
|
||||
|
||||
## Responsive Design
|
||||
- Mobile: 375px+ (single column, stacked)
|
||||
- Tablet: var(--breakpoint-md) (adapted layout)
|
||||
- Desktop: var(--breakpoint-lg)+ (full layout)
|
||||
## Output Location
|
||||
{base_path}/prototypes/
|
||||
|
||||
## Output Location
|
||||
{base_path}/prototypes/
|
||||
## Deliverables
|
||||
For each page-style-layout combination in your assigned batch:
|
||||
1. HTML file with token-driven structure
|
||||
2. CSS file with custom property references
|
||||
3. Notes file with implementation details and layout rationale
|
||||
|
||||
## Deliverables
|
||||
For each page-style-layout combination:
|
||||
1. HTML file with token-driven structure
|
||||
2. CSS file with custom property references
|
||||
3. Notes file with implementation details and layout rationale
|
||||
Total files to generate: {len(page_list) * len(style_batch) * 3}
|
||||
"
|
||||
|
||||
Total files to generate: {len(page_list) * layout_variants * 3}
|
||||
"
|
||||
|
||||
# Wait for all {style_variants} parallel tasks to complete
|
||||
# Wait for all {layout_variants * len(style_batches)} parallel tasks to complete
|
||||
# Total prototypes: {style_variants * layout_variants * len(page_list)}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user