use clap::{ArgAction, Args as ClapArgs, Parser, Subcommand};
use std::path::PathBuf;
#[derive(Debug, Parser)]
#[command(
name = "covgate",
about = "Diff-focused coverage gate",
version,
disable_version_flag = true
)]
pub struct Cli {
#[arg(short = 'v', short_alias = 'V', long = "version", action = ArgAction::Version)]
_version: Option<bool>,
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
Check(Box<Args>),
#[command(
about = "Record a stable task-start base for constrained cloud-agent worktrees",
long_about = r#"Record a stable task-start base for constrained cloud-agent worktrees.
Use this when a cloud agent or sandboxed worktree cannot rely on normal base
branches such as main or origin/main. Run it once at the start of a task before
making Git changes, then run `covgate check <coverage-report>` without
`--base`."#
)]
RecordBase,
}
#[derive(Debug, ClapArgs)]
pub struct Args {
pub coverage_report: PathBuf,
#[arg(long, conflicts_with = "diff_file")]
pub base: Option<String>,
#[arg(long, conflicts_with = "base")]
pub diff_file: Option<PathBuf>,
#[arg(long = "fail-under-regions", value_name = "MIN")]
pub fail_under_regions: Option<f64>,
#[arg(long = "fail-under-lines", value_name = "MIN")]
pub fail_under_lines: Option<f64>,
#[arg(long = "fail-under-branches", value_name = "MIN")]
pub fail_under_branches: Option<f64>,
#[arg(long = "fail-under-functions", value_name = "MIN")]
pub fail_under_functions: Option<f64>,
#[arg(long = "fail-uncovered-regions", value_name = "MAX")]
pub fail_uncovered_regions: Option<usize>,
#[arg(long = "fail-uncovered-lines", value_name = "MAX")]
pub fail_uncovered_lines: Option<usize>,
#[arg(long = "fail-uncovered-branches", value_name = "MAX")]
pub fail_uncovered_branches: Option<usize>,
#[arg(long = "fail-uncovered-functions", value_name = "MAX")]
pub fail_uncovered_functions: Option<usize>,
#[arg(long)]
pub markdown_output: Option<PathBuf>,
}