mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-06 21:46:40 +02:00
a4dd5b0c2e
Stateless CLI (design/dist/design) wrapping OpenAI Responses API for UI mockup generation. Three working commands: - generate: brief -> PNG mockup via gpt-4o + image_generation tool - check: vision-based quality gate via GPT-4o (text readability, layout completeness, visual coherence) - compare: generates self-contained HTML comparison board with star ratings, radio Pick, per-variant feedback, regenerate controls, and Submit button that writes structured JSON for agent polling Auth reads from ~/.gstack/openai.json (0600), falls back to OPENAI_API_KEY env var. Compiled separately from browse binary (openai added to devDependencies, not runtime deps). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
63 lines
2.2 KiB
TypeScript
63 lines
2.2 KiB
TypeScript
/**
|
|
* Command registry — single source of truth for all design commands.
|
|
*
|
|
* Dependency graph:
|
|
* commands.ts ──▶ cli.ts (runtime dispatch)
|
|
* ──▶ gen-skill-docs.ts (doc generation)
|
|
* ──▶ tests (validation)
|
|
*
|
|
* Zero side effects. Safe to import from build scripts and tests.
|
|
*/
|
|
|
|
export const COMMANDS = new Map<string, {
|
|
description: string;
|
|
usage: string;
|
|
flags?: string[];
|
|
}>([
|
|
["generate", {
|
|
description: "Generate a UI mockup from a design brief",
|
|
usage: "generate --brief \"...\" --output /path.png",
|
|
flags: ["--brief", "--brief-file", "--output", "--check", "--retry", "--size", "--quality"],
|
|
}],
|
|
["variants", {
|
|
description: "Generate N design variants from a brief",
|
|
usage: "variants --brief \"...\" --count 3 --output-dir /path/",
|
|
flags: ["--brief", "--brief-file", "--count", "--output-dir", "--size", "--quality", "--viewports"],
|
|
}],
|
|
["iterate", {
|
|
description: "Iterate on an existing mockup with feedback",
|
|
usage: "iterate --session /path/session.json --feedback \"...\" --output /path.png",
|
|
flags: ["--session", "--feedback", "--output"],
|
|
}],
|
|
["check", {
|
|
description: "Vision-based quality check on a mockup",
|
|
usage: "check --image /path.png --brief \"...\"",
|
|
flags: ["--image", "--brief"],
|
|
}],
|
|
["compare", {
|
|
description: "Generate HTML comparison board for user review",
|
|
usage: "compare --images /path/*.png --output /path/board.html",
|
|
flags: ["--images", "--output"],
|
|
}],
|
|
["diff", {
|
|
description: "Visual diff between two mockups",
|
|
usage: "diff --before old.png --after new.png",
|
|
flags: ["--before", "--after", "--output"],
|
|
}],
|
|
["evolve", {
|
|
description: "Generate improved mockup from existing screenshot",
|
|
usage: "evolve --screenshot current.png --brief \"make it calmer\" --output /path.png",
|
|
flags: ["--screenshot", "--brief", "--output"],
|
|
}],
|
|
["verify", {
|
|
description: "Compare live site screenshot against approved mockup",
|
|
usage: "verify --mockup approved.png --screenshot live.png",
|
|
flags: ["--mockup", "--screenshot", "--output"],
|
|
}],
|
|
["setup", {
|
|
description: "Guided API key setup + smoke test",
|
|
usage: "setup",
|
|
flags: [],
|
|
}],
|
|
]);
|