refactor: unify UI design workflow target parameters for pages and components

Consolidate separate page/component modes into a unified target system to
reduce code duplication and simplify the workflow parameter model.

Changes:
- Merge --pages and --components into unified --targets parameter
- Add --target-type (auto|page|component) with intelligent detection
- Remove Phase 0d from explore-auto.md (131 lines of duplicate logic)
- Implement detect_target_type() helper for automatic classification
- Update generate.md to support adaptive wrapper generation
  - Full HTML structure for pages
  - Minimal wrapper for isolated components
- Update imitate-auto.md and update.md for parameter consistency
- Enhance ui-design-agent.md with adaptive design capabilities
- Maintain full backward compatibility with legacy syntax

Benefits:
- Code reduction: -35% in target inference logic (255 → 165 lines)
- Maintenance: Single unified logic path vs dual implementations
- Extensibility: Foundation for future mixed-mode support
- UX: Simpler parameter model with automatic type detection

Technical Details:
- explore-auto.md: 605 lines changed (unified Phase 0c)
- generate.md: 353 lines changed (targets + adaptive wrapper)
- Net change: +685 insertions, -504 deletions across 5 files

All existing workflows remain compatible via legacy parameter support.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-10-09 20:33:09 +08:00
parent 1d573979c7
commit 02448ccd21
5 changed files with 676 additions and 495 deletions

View File

@@ -32,11 +32,29 @@ VALIDATE: session_id matches active session
# Verify required design artifacts exist in latest design run
latest_design = find_latest_path_matching(".workflow/WFS-{session}/design-*")
# Detect design system structure (unified vs separate)
IF exists({latest_design}/style-consolidation/design-tokens.json):
# Unified mode (single design system)
design_system_mode = "unified"
design_tokens_path = "style-consolidation/design-tokens.json"
style_guide_path = "style-consolidation/style-guide.md"
ELSE IF exists({latest_design}/style-consolidation/style-1/design-tokens.json):
# Separate mode (per-style design systems)
design_system_mode = "separate"
design_tokens_path = "style-consolidation/style-1/design-tokens.json"
style_guide_path = "style-consolidation/style-1/style-guide.md"
ELSE:
ERROR: "No design tokens found. Run /workflow:ui-design:consolidate first"
VERIFY:
- {latest_design}/style-consolidation/design-tokens.json
- {latest_design}/style-consolidation/style-guide.md
- {latest_design}/{design_tokens_path}
- {latest_design}/{style_guide_path}
- {latest_design}/prototypes/*.html (at least one prototype)
REPORT: "📋 Design system mode: {design_system_mode}"
REPORT: " Tokens: {design_tokens_path}"
# Prototype selection
IF --selected-prototypes provided:
VALIDATE: Specified prototypes exist
@@ -76,8 +94,9 @@ Update `.brainstorming/synthesis-specification.md` with design system references
## UI/UX Guidelines
### Design System Reference
**Finalized Design Tokens**: @../design-{run_id}/style-consolidation/design-tokens.json
**Style Guide**: @../design-{run_id}/style-consolidation/style-guide.md
**Finalized Design Tokens**: @../design-{run_id}/{design_tokens_path}
**Style Guide**: @../design-{run_id}/{style_guide_path}
**Design System Mode**: {design_system_mode}
### Implementation Requirements
**Token Adherence**: All UI implementations MUST use design token CSS custom properties
@@ -94,8 +113,9 @@ Update `.brainstorming/synthesis-specification.md` with design system references
### Design System Assets
```json
{
"design_tokens": "design-{run_id}/style-consolidation/design-tokens.json",
"style_guide": "design-{run_id}/style-consolidation/style-guide.md",
"design_tokens": "design-{run_id}/{design_tokens_path}",
"style_guide": "design-{run_id}/{style_guide_path}",
"design_system_mode": "{design_system_mode}",
"prototypes": [
{FOR each: "design-{run_id}/prototypes/{prototype}.html"}
]
@@ -131,8 +151,9 @@ Create or update `.brainstorming/ui-designer/style-guide.md`:
## Design System Integration
This style guide references the finalized design system from the design refinement phase.
**Design Tokens**: @../../design-{run_id}/style-consolidation/design-tokens.json
**Style Guide**: @../../design-{run_id}/style-consolidation/style-guide.md
**Design Tokens**: @../../design-{run_id}/{design_tokens_path}
**Style Guide**: @../../design-{run_id}/{style_guide_path}
**Design System Mode**: {design_system_mode}
## Implementation Guidelines
1. **Use CSS Custom Properties**: All styles reference design tokens
@@ -147,8 +168,8 @@ This style guide references the finalized design system from the design refineme
## Token System
For complete token definitions and usage examples, see:
- Design Tokens: @../../design-{run_id}/style-consolidation/design-tokens.json
- Style Guide: @../../design-{run_id}/style-consolidation/style-guide.md
- Design Tokens: @../../design-{run_id}/{design_tokens_path}
- Style Guide: @../../design-{run_id}/{style_guide_path}
---
*Auto-generated by /workflow:ui-design:update*