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

113 lines
2.7 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 {
generateDockerCompose,
generateSpireDockerCompose,
} from "../compose.ts";
import {
AuthSetupConfig,
DEFAULT_AUTH_CONFIG,
generateEnv,
generateSpireEnv,
readEnv,
} from "../env.ts";
export const dumpComposeCommand = new Command()
.description("Output all generated Compose YAML configurations")
.action(() => {
console.log(
colors.bold(
colors.blue(
"\n================================================================",
),
),
);
console.log(
colors.bold(
colors.green(" STACK 1: Auth-Yes Stack (infra/compose.yml)"),
),
);
console.log(
colors.bold(
colors.blue(
"================================================================\n",
),
),
);
console.log(generateDockerCompose());
console.log(
colors.bold(
colors.blue(
"================================================================",
),
),
);
console.log(
colors.bold(
colors.green(
" STACK 2: Standalone SPIRE Stack (infra/compose.spire.yml)",
),
),
);
console.log(
colors.bold(
colors.blue(
"================================================================\n",
),
),
);
console.log(generateSpireDockerCompose());
});
export const dumpEnvCommand = new Command()
.description("Output current environment configuration (.env and .env.spire)")
.action(async () => {
const loadedEnv = await readEnv();
const currentConfig: AuthSetupConfig = {
...DEFAULT_AUTH_CONFIG,
...loadedEnv,
};
console.log(
colors.bold(
colors.blue(
"\n================================================================",
),
),
);
console.log(
colors.bold(
colors.green(" STACK 1: Auth-Yes Environment (infra/stack.env)"),
),
);
console.log(
colors.bold(
colors.blue(
"================================================================\n",
),
),
);
console.log(generateEnv(currentConfig));
console.log(
colors.bold(
colors.blue(
"================================================================",
),
),
);
console.log(
colors.bold(
colors.green(
" STACK 2: SPIRE Stack Environment (infra/.env.spire)",
),
),
);
console.log(
colors.bold(
colors.blue(
"================================================================\n",
),
),
);
console.log(generateSpireEnv(currentConfig));
});