fix: ensure correct layout variant count generation in UI workflow

Fix layout strategy generation issues across UI design commands:
- consolidate.md: Enhance layout synthesis prompt with explicit examples and requirements
  * Add concrete 3-layout example to clarify expected output structure
  * Emphasize requirement to generate EXACTLY N strategies (not more, not less)
  * Add sequential ID validation (layout-1, layout-2, ..., layout-N)
- explore-auto.md: Add missing --layout-variants parameter to consolidate command call
  * Phase 2 now passes layout_variants count to ensure correct strategy generation
  * Prevents mismatch between requested layouts and generated strategies
- extract.md: Update next step suggestions to include --layout-variants parameter
  * Users now see optional [--layout-variants <count>] in command examples
  * Improves discoverability of layout customization option

Before: consolidate would only generate default 3 layouts even when user specified different count
After: consolidate receives and respects user-specified layout variant count

🤖 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 18:17:39 +08:00
parent 20c75c0060
commit 447837df39
3 changed files with 34 additions and 14 deletions

View File

@@ -108,7 +108,7 @@ layout_trends = mcp__exa__get_code_context_exa(
REPORT: "🎨 Generating {layout_variants} custom layout strategies..."
layout_synthesis_prompt = """
Generate {layout_variants} distinct, modern UI layout strategies for this project.
Generate EXACTLY {layout_variants} distinct, modern UI layout strategies for this project.
PROJECT CONTEXT:
{project_context}
@@ -117,27 +117,46 @@ CURRENT LAYOUT TRENDS (from web research):
{layout_trends}
REQUIREMENTS:
1. Each layout must be unique and serve different use cases
2. Consider modern design trends from 2024-2025
3. Align with project type: {project_hints}
4. Balance innovation with usability
5. Cover diverse layout paradigms (grid-based, asymmetric, minimal, etc.)
1. Generate EXACTLY {layout_variants} unique layout strategies (not more, not less)
2. Each layout must be unique and serve different use cases
3. Consider modern design trends from 2024-2025
4. Align with project type: {project_hints}
5. Balance innovation with usability
6. Cover diverse layout paradigms (grid-based, asymmetric, minimal, single-column, sidebar-based, etc.)
OUTPUT FORMAT (JSON):
You MUST generate {layout_variants} strategy objects in the "strategies" array.
Example for layout_variants=3:
{
"layout_variants_count": {layout_variants},
"layout_variants_count": 3,
"strategies": [
{
"id": "layout-1",
"name": "{Concise name, max 3 words}",
"description": "{Detailed description: layout structure, visual hierarchy, reading patterns, use cases. 2-3 sentences.}"
"name": "Grid Dashboard",
"description": "Traditional grid-based layout with sidebar navigation. Clear visual hierarchy with card-based content areas. Ideal for data-heavy dashboards."
},
...
{
"id": "layout-2",
"name": "Asymmetric Flow",
"description": "Dynamic asymmetric layout with floating content blocks. Natural reading flow with varied content widths. Perfect for content-focused applications."
},
{
"id": "layout-3",
"name": "Minimal Centered",
"description": "Clean centered layout with generous whitespace. Single-column focus with subtle hierarchy. Best for documentation or blog-style interfaces."
}
]
}
IMPORTANT:
- The "strategies" array MUST contain EXACTLY {layout_variants} objects
- Each strategy must have sequential IDs: "layout-1", "layout-2", ..., "layout-{layout_variants}"
- Each strategy name must be concise (max 3 words)
- Each description must be detailed (2-3 sentences covering structure, hierarchy, use cases)
RESPONSE FORMAT:
Provide ONLY the JSON object, no additional text.
Provide ONLY the JSON object, no additional text before or after.
===== layout-strategies.json =====
{JSON content}