google-labs-jules[bot] 752bfcf03e Refactor infra/setup/cli.ts into smaller command and prompt modules
Decomposes the monolith `infra/setup/cli.ts` into clean `infra/setup/prompts/` and `infra/setup/commands/` directories while adhering to Cliffy idiomatic modularity. Validated via `deno check`, tests, and format.

Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
2026-08-26 04:37:41 +00:00

44 lines
1.4 KiB
TypeScript

import { Command } from "jsr:@cliffy/command@1.0.0-rc.7";
import * as colors from "jsr:@std/fmt@0.225.2/colors";
import { runSetupWizard } from "./prompts/wizard.ts";
import { authCommand } from "./commands/auth.ts";
import { testCommand } from "./commands/test.ts";
import {
buildCommand,
compileProtoCommand,
releaseCommand,
} from "./commands/build.ts";
import { dumpComposeCommand, dumpEnvCommand } from "./commands/compose.ts";
import { secretsCommand } from "./commands/secrets.ts";
export async function runCli(args = Deno.args): Promise<void> {
if (import.meta.main || args.length === 0) {
if (!Deno.stdin.isTerminal() && args.length === 0) {
console.error(
colors.red(
"Error: Non-interactive environment detected, but no explicit CLI subcommands or --auto flag were provided. Aborting to prevent hangs.",
),
);
Deno.exit(1);
}
}
const cmd = new Command()
.name("auth-setup")
.description("Auth setup wizard and CLI")
.version("1.0.0")
.action(() => {
runSetupWizard();
})
.command("auth", authCommand)
.command("test", testCommand)
.command("compile_proto", compileProtoCommand)
.command("build", buildCommand)
.command("release", releaseCommand)
.command("dump_compose", dumpComposeCommand)
.command("dump_env", dumpEnvCommand)
.command("secrets", secretsCommand);
await cmd.parse(args);
}