MCPcopy
hub / github.com/garrytan/gstack / main

Function main

design/src/cli.ts:124–319  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122}
123
124async function main(): Promise<void> {
125 const { command, flags, positionals } = parseArgs(process.argv);
126
127 if (!COMMANDS.has(command)) {
128 console.error(`Unknown command: ${command}`);
129 printUsage();
130 process.exit(1);
131 }
132
133 switch (command) {
134 case "generate":
135 await generate({
136 brief: flags.brief as string,
137 briefFile: flags["brief-file"] as string,
138 output: (flags.output as string) || "/tmp/gstack-mockup.png",
139 check: !!flags.check,
140 retry: flags.retry ? parseInt(flags.retry as string) : 0,
141 size: flags.size as string,
142 quality: flags.quality as string,
143 });
144 break;
145
146 case "check":
147 await checkCommand(flags.image as string, flags.brief as string);
148 break;
149
150 case "compare": {
151 // Parse --images as glob or multiple files
152 const imagesArg = flags.images as string;
153 const images = await resolveImagePaths(imagesArg);
154 const outputPath = (flags.output as string) || "/tmp/gstack-design-board.html";
155 compare({ images, output: outputPath });
156 // If --serve flag is set, publish the board.
157 // Default: ensure the persistent daemon is up, POST the board, open
158 // the browser, exit. The daemon survives the CLI and hosts every
159 // board the user has published this day at stable URLs.
160 // --no-daemon: legacy single-process server in serve.ts (kept for
161 // tests / Windows / explicit debugging).
162 if (flags.serve) {
163 if (flags["no-daemon"]) {
164 await serve({
165 html: outputPath,
166 timeout: flags.timeout ? parseInt(flags.timeout as string) : 600,
167 });
168 } else {
169 await publishToDaemon({
170 html: outputPath,
171 title: flags.title as string | undefined,
172 });
173 }
174 }
175 break;
176 }
177
178 case "prompt": {
179 const promptImage = flags.image as string;
180 if (!promptImage) {
181 console.error("--image is required");

Callers 1

cli.tsFile · 0.70

Calls 15

generateFunction · 0.90
checkCommandFunction · 0.90
compareFunction · 0.90
serveFunction · 0.90
variantsFunction · 0.90
iterateFunction · 0.90
extractDesignLanguageFunction · 0.90
updateDesignMdFunction · 0.90
diffMockupsFunction · 0.90
verifyAgainstMockupFunction · 0.90
evolveFunction · 0.90

Tested by

no test coverage detected