(input: string, isFile: boolean)
| 44 | * Parse a brief from either a plain text string or a JSON file path. |
| 45 | */ |
| 46 | export function parseBrief(input: string, isFile: boolean): string { |
| 47 | if (!isFile) { |
| 48 | // Plain text prompt — use directly |
| 49 | return input; |
| 50 | } |
| 51 | |
| 52 | // JSON file — parse and convert to prompt |
| 53 | const raw = Bun.file(input); |
| 54 | // We'll read it synchronously via fs since Bun.file is async |
| 55 | const fs = require("fs"); |
| 56 | const content = fs.readFileSync(input, "utf-8"); |
| 57 | const brief: DesignBrief = JSON.parse(content); |
| 58 | return briefToPrompt(brief); |
| 59 | } |
no test coverage detected