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 { 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); }