| 16 | * Convert a structured brief to a prompt string for image generation. |
| 17 | */ |
| 18 | export function briefToPrompt(brief: DesignBrief): string { |
| 19 | const lines: string[] = [ |
| 20 | `Generate a pixel-perfect UI mockup of a ${brief.screenType} for: ${brief.goal}.`, |
| 21 | `Target audience: ${brief.audience}.`, |
| 22 | `Visual style: ${brief.style}.`, |
| 23 | `Required elements: ${brief.elements.join(", ")}.`, |
| 24 | ]; |
| 25 | |
| 26 | if (brief.constraints) { |
| 27 | lines.push(`Constraints: ${brief.constraints}.`); |
| 28 | } |
| 29 | |
| 30 | if (brief.reference) { |
| 31 | lines.push(`Design reference: ${brief.reference}`); |
| 32 | } |
| 33 | |
| 34 | lines.push( |
| 35 | "The mockup should look like a real production UI, not a wireframe or concept art.", |
| 36 | "All text must be readable. Layout must be clean and intentional.", |
| 37 | "1536x1024 pixels." |
| 38 | ); |
| 39 | |
| 40 | return lines.join(" "); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Parse a brief from either a plain text string or a JSON file path. |