refactor: standardize UI design workflow folder naming and add absolute path conversion

Unified folder naming format across all UI design commands:
- Session mode: .workflow/WFS-{session}/design-run-YYYYMMDD-RANDOM
- Standalone mode: .workflow/.design/design-run-YYYYMMDD-RANDOM

Key changes:
- Standardized run directory naming to design-run-* format
- Added absolute path conversion for all base_path variables
- Updated path discovery patterns from design-* to design-run-*
- Maintained backward compatibility for existing directory discovery

Modified commands (10 files):
- explore-auto.md, imitate-auto.md: Unified standalone path format
- explore-layers.md: Changed from design-layers-* to design-run-*
- capture.md: Added design- prefix to standalone mode
- animation-extract.md, style-extract.md, layout-extract.md,
  generate.md, batch-generate.md: Added absolute path conversion
- update.md: Updated path discovery pattern

Technical improvements:
- Eliminates path ambiguity between command and agent execution contexts
- Ensures all file operations use absolute paths for reliability
- Provides consistent directory structure across workflows

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-11-08 20:52:10 +08:00
parent a8ab192c72
commit 1fb5b3cbe9
10 changed files with 61 additions and 35 deletions

View File

@@ -50,8 +50,10 @@ IF --focus:
ELSE:
focus_types = ["all"] # Extract all animation types
# Determine base path
bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect
# Determine base path (auto-detect and convert to absolute)
relative_path=$(find .workflow -type d -name "design-run-*" | head -1)
base_path=$(cd "$relative_path" && pwd)
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
# OR use --base-path / --session parameters
```
@@ -777,7 +779,7 @@ Next: Animation tokens ready for integration
```bash
# Find design directory
bash(find .workflow -type d -name "design-*" | head -1)
bash(find .workflow -type d -name "design-run-*" | head -1)
# Create output directories
bash(mkdir -p {base_path}/animation-extraction)

View File

@@ -42,9 +42,14 @@ target_type = --target-type OR detect_target_type(target_list)
IF --base-path:
base_path = --base-path
ELSE IF --session:
bash(find .workflow/WFS-{session} -type d -name "design-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
relative_path=$(find .workflow/WFS-{session} -type d -name "design-run-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
base_path=$(cd "$relative_path" && pwd)
ELSE:
bash(find .workflow -type d -name "design-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
relative_path=$(find .workflow -type d -name "design-run-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
base_path=$(cd "$relative_path" && pwd)
# Verify absolute path
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
# Get variant counts
style_variants = --style-variants OR bash(ls {base_path}/style-extraction/style-* -d | wc -l)
@@ -274,7 +279,7 @@ Next: /workflow:ui-design:update
### Path Operations
```bash
# Find design directory
bash(find .workflow -type d -name "design-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
bash(find .workflow -type d -name "design-run-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
# Count style variants
bash(ls {base_path}/style-extraction/style-* -d | wc -l)

View File

@@ -18,16 +18,18 @@ Batch screenshot tool with MCP-first strategy and multi-tier fallback. Processes
### Step 1: Determine Base Path
```bash
# Priority: --base-path > session > standalone
bash(if [ -n "$BASE_PATH" ]; then
relative_path=$(if [ -n "$BASE_PATH" ]; then
echo "$BASE_PATH"
elif [ -n "$SESSION_ID" ]; then
find .workflow/WFS-$SESSION_ID/design-* -type d | head -1 || \
echo ".workflow/WFS-$SESSION_ID/design-run-$(date +%Y%m%d-%H%M%S)"
echo ".workflow/WFS-$SESSION_ID/design-run-$(date +%Y%m%d)-$RANDOM"
else
echo ".workflow/.design/run-$(date +%Y%m%d-%H%M%S)"
echo ".workflow/.design/design-run-$(date +%Y%m%d)-$RANDOM"
fi)
bash(mkdir -p $BASE_PATH/screenshots)
# Create directory and convert to absolute path
bash(mkdir -p "$relative_path"/screenshots)
base_path=$(cd "$relative_path" && pwd)
```
### Step 2: Parse URL Map
@@ -187,7 +189,7 @@ bash($chrome --headless --screenshot="$output_file" --window-size=1920,1080 "$ur
Failed URLs:
home: https://linear.app
Save to: .workflow/.design/run-20250110/screenshots/home.png
Save to: .workflow/.design/design-run-20250110/screenshots/home.png
Steps:
1. Visit URL in browser
@@ -270,7 +272,7 @@ Next: /workflow:ui-design:extract --images "screenshots/*.png"
### Path Operations
```bash
# Find design directory
bash(find .workflow -type d -name "design-*" | head -1)
bash(find .workflow -type d -name "design-run-*" | head -1)
# Create screenshot directory
bash(mkdir -p $BASE_PATH/screenshots)

View File

@@ -203,10 +203,12 @@ STORE: device_type, device_source
### Phase 0b: Run Initialization & Directory Setup
```bash
run_id = "run-$(date +%Y%m%d-%H%M%S)"
base_path = --session ? ".workflow/WFS-{session}/design-${run_id}" : ".workflow/.design/${run_id}"
run_id = "run-$(date +%Y%m%d)-$RANDOM"
relative_base_path = --session ? ".workflow/WFS-{session}/design-${run_id}" : ".workflow/.design/design-${run_id}"
Bash(mkdir -p "${base_path}/{style-extraction,style-consolidation,prototypes}")
# Create directory and convert to absolute path
Bash(mkdir -p "${relative_base_path}/{style-extraction,prototypes}")
base_path=$(cd "${relative_base_path}" && pwd)
Write({base_path}/.run-metadata.json): {
"run_id": "${run_id}", "session_id": "${session_id}", "timestamp": "...",

View File

@@ -38,17 +38,21 @@ IF depth NOT IN [1, 2, 3, 4, 5]:
### Step 2: Determine Base Path
```bash
bash(if [ -n "$BASE_PATH" ]; then
relative_path=$(if [ -n "$BASE_PATH" ]; then
echo "$BASE_PATH"
elif [ -n "$SESSION_ID" ]; then
find .workflow/WFS-$SESSION_ID/design-* -type d | head -1 || \
echo ".workflow/WFS-$SESSION_ID/design-layers-$(date +%Y%m%d-%H%M%S)"
echo ".workflow/WFS-$SESSION_ID/design-run-$(date +%Y%m%d)-$RANDOM"
else
echo ".workflow/.design/layers-$(date +%Y%m%d-%H%M%S)"
echo ".workflow/.design/design-run-$(date +%Y%m%d)-$RANDOM"
fi)
# Create directory structure and convert to absolute path
bash(mkdir -p "$relative_path")
base_path=$(cd "$relative_path" && pwd)
# Create depth directories
bash(for i in $(seq 1 $depth); do mkdir -p $BASE_PATH/screenshots/depth-$i; done)
bash(for i in $(seq 1 $depth); do mkdir -p "$base_path"/screenshots/depth-$i; done)
```
**Output**: `url`, `depth`, `base_path`

View File

@@ -25,11 +25,17 @@ Pure assembler that combines pre-extracted layout templates with design tokens t
### Step 1: Resolve Base Path & Parse Configuration
```bash
# Determine working directory
bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect
# Determine working directory (relative path)
relative_path=$(find .workflow -type d -name "design-run-*" | head -1)
# Convert to absolute path
base_path=$(cd "$relative_path" && pwd)
# Verify absolute path
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
# Get style count
bash(ls {base_path}/style-extraction/style-* -d | wc -l)
bash(ls "$base_path"/style-extraction/style-* -d | wc -l)
# Image reference auto-detected from layout template source_image_path
```
@@ -263,7 +269,7 @@ Next: /workflow:ui-design:update
### Path Operations
```bash
# Find design directory
bash(find .workflow -type d -name "design-*" | head -1)
bash(find .workflow -type d -name "design-run-*" | head -1)
# Count style variants
bash(ls {base_path}/style-extraction/style-* -d | wc -l)

View File

@@ -100,20 +100,21 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Write(*), Bash(*)
```bash
# Generate run ID
run_id = "run-$(date +%Y%m%d-%H%M%S)"
run_id = "run-$(date +%Y%m%d)-$RANDOM"
# Determine base path and session mode
IF --session:
session_id = {provided_session}
base_path = ".workflow/WFS-{session_id}/design-{run_id}"
relative_base_path = ".workflow/WFS-{session_id}/design-{run_id}"
session_mode = "integrated"
ELSE:
session_id = null
base_path = ".workflow/.design/{run_id}"
relative_base_path = ".workflow/.design/design-{run_id}"
session_mode = "standalone"
# Create base directory
Bash(mkdir -p "{base_path}")
# Create base directory and convert to absolute path
Bash(mkdir -p "{relative_base_path}")
base_path=$(cd "{relative_base_path}" && pwd)
# Step 0.1: Intelligent Path Detection
code_files_detected = false

View File

@@ -69,8 +69,10 @@ ELSE:
# Resolve device type
device_type = --device-type OR "responsive" # desktop|mobile|tablet|responsive
# Determine base path
bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect
# Determine base path (auto-detect and convert to absolute)
relative_path=$(find .workflow -type d -name "design-run-*" | head -1)
base_path=$(cd "$relative_path" && pwd)
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
# OR use --base-path / --session parameters
```
@@ -589,7 +591,7 @@ Next: /workflow:ui-design:generate will combine these structural templates with
### Path Operations
```bash
# Find design directory
bash(find .workflow -type d -name "design-*" | head -1)
bash(find .workflow -type d -name "design-run-*" | head -1)
# Create output directories
bash(mkdir -p {base_path}/layout-extraction)

View File

@@ -51,8 +51,10 @@ ELSE IF extraction_mode == "explore":
variants_count = --variants OR 3 # Default to 3 for explore mode
VALIDATE: 1 <= variants_count <= 5
# Determine base path
bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect
# Determine base path (auto-detect and convert to absolute)
relative_path=$(find .workflow -type d -name "design-run-*" | head -1)
base_path=$(cd "$relative_path" && pwd)
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
# OR use --base-path / --session parameters
```
@@ -533,7 +535,7 @@ Next: /workflow:ui-design:layout-extract --session {session_id} --targets "..."
### Path Operations
```bash
# Find design directory
bash(find .workflow -type d -name "design-*" | head -1)
bash(find .workflow -type d -name "design-run-*" | head -1)
# Expand image pattern
bash(ls {images_pattern})

View File

@@ -28,7 +28,7 @@ Synchronize finalized design system references to brainstorming artifacts, prepa
CHECK: .workflow/.active-* marker files; VALIDATE: session_id matches active session
# Verify design artifacts in latest design run
latest_design = find_latest_path_matching(".workflow/WFS-{session}/design-*")
latest_design = find_latest_path_matching(".workflow/WFS-{session}/design-run-*")
# Detect design system structure
IF exists({latest_design}/style-extraction/style-1/design-tokens.json):