Refactor UI design workflows to unify input parameters and enhance detection logic

- Updated `explore-auto.md`, `imitate-auto.md`, and `import-from-code.md` to replace legacy parameters with a unified `--input` parameter for better clarity and functionality.
- Enhanced input detection logic to support glob patterns, file paths, and text descriptions, allowing for more flexible input combinations.
- Deprecated old parameters (`--images`, `--prompt`, etc.) with warnings and provided clear migration paths.
- Improved error handling for missing inputs and validation of existing directories in `reference-page-generator.md`.
- Streamlined command execution phases to utilize new input structures across workflows.
This commit is contained in:
catlog22
2025-11-11 15:30:53 +08:00
parent feae69470e
commit 0767d6f2d3
5 changed files with 671 additions and 371 deletions

View File

@@ -85,38 +85,27 @@ for file in "${required_files[@]}"; do
fi
done
# 5. Setup output directory
# 5. Setup output directory and validate
output_dir="${output_dir:-.workflow/reference_style}"
package_dir="${output_dir}/${package_name}"
mkdir -p "$package_dir"
# 6. Validate existing package (if any)
# Check if package directory exists and is not empty
if [ -d "$package_dir" ] && [ "$(ls -A $package_dir 2>/dev/null)" ]; then
# Directory exists and is not empty
# Directory exists - check if it's a valid package or just a directory
if [ -f "$package_dir/metadata.json" ]; then
# Valid package - safe to overwrite
echo "INFO: Valid package '$package_name' found at $package_dir"
echo "This will overwrite existing package contents."
# Read existing package version for logging
existing_version=$(jq -r '.version // "unknown"' "$package_dir/metadata.json" 2>/dev/null || echo "unknown")
echo " Existing version: $existing_version"
echo "INFO: Overwriting existing package '$package_name' (version: $existing_version)"
else
# Directory exists but not a valid package - risk of data loss
echo "ERROR: Directory '$package_dir' exists but is not a valid style package"
echo "HINT: Directory exists but missing metadata.json"
echo "HINT: This may not be a style reference package"
echo "Directory contents:"
ls -1 "$package_dir" 2>/dev/null | head -10
echo ""
echo "To proceed, either:"
echo " 1. Remove the directory: rm -rf $package_dir"
echo " 2. Choose a different package name"
# Directory exists but not a valid package
echo "ERROR: Directory '$package_dir' exists but is not a valid package"
echo "Use a different package name or remove the directory manually"
exit 1
fi
fi
mkdir -p "$package_dir"
echo "[Phase 0] Setup Complete"
echo " Design Run: $design_run"
echo " Package: $package_name"