use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(
name = "apiforge",
about = "Production API release automation CLI",
version,
long_about = "From merged code to healthy pods in production — one command, zero tribal knowledge required."
)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
#[arg(long, global = true, env = "APIFORGE_DEBUG")]
pub debug: bool,
#[arg(long, global = true, default_value = "apiforge.toml")]
pub config: String,
}
#[derive(Subcommand)]
pub enum Commands {
Init(InitArgs),
Doctor,
Release(ReleaseArgs),
Rollback(RollbackArgs),
History(HistoryArgs),
Status,
Config(ConfigArgs),
}
#[derive(Parser)]
pub struct InitArgs {
#[arg(long)]
pub name: Option<String>,
#[arg(long)]
pub force: bool,
}
#[derive(Parser)]
pub struct ReleaseArgs {
#[arg(value_parser = ["major", "minor", "patch"])]
pub bump: String,
#[arg(long)]
pub dry_run: bool,
#[arg(long)]
pub skip_docker: bool,
#[arg(long)]
pub skip_k8s: bool,
#[arg(long)]
pub skip_cloudfront: bool,
#[arg(long)]
pub skip_github: bool,
#[arg(long)]
pub skip_notify: bool,
#[arg(long)]
pub no_changelog: bool,
#[arg(long, value_parser = ["text", "json"], default_value = "text")]
pub output: String,
#[arg(long, short)]
pub yes: bool,
}
#[derive(Parser)]
pub struct RollbackArgs {
#[arg(long)]
pub to: Option<String>,
#[arg(long)]
pub dry_run: bool,
#[arg(long)]
pub skip_notify: bool,
#[arg(long, short)]
pub yes: bool,
}
#[derive(Parser)]
pub struct HistoryArgs {
#[arg(long, default_value = "20")]
pub limit: usize,
#[arg(long, value_parser = ["text", "json"], default_value = "text")]
pub output: String,
#[arg(long, value_parser = ["success", "failed"])]
pub filter: Option<String>,
}
#[derive(Parser)]
pub struct ConfigArgs {
#[command(subcommand)]
pub command: ConfigCommands,
}
#[derive(Subcommand)]
pub enum ConfigCommands {
Validate(ConfigValidateArgs),
}
#[derive(Parser)]
pub struct ConfigValidateArgs {
#[arg(long, value_parser = ["text", "json"], default_value = "text")]
pub output: String,
#[arg(long)]
pub verbose: bool,
}