use clap::{Args, Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(
name = "agentdiff",
about = "Audit and trace AI contributions in git repositories",
version,
propagate_version = true
)]
pub struct Cli {
#[arg(short = 'C', long, global = true)]
pub repo: Option<std::path::PathBuf>,
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
pub enum Command {
Configure(ConfigureArgs),
Init(InitArgs),
List(ListArgs),
Blame(BlameArgs),
Stats(StatsArgs),
Report(ReportArgs),
Diff(DiffArgs),
Log(LogArgs),
Show(ShowArgs),
Ledger(LedgerArgs),
SyncNotes,
Config(ConfigArgs),
Keys(KeysArgs),
Verify(VerifyArgs),
Policy(PolicyArgs),
Export(ExportArgs),
Status,
Push(PushArgs),
Consolidate(ConsolidateArgs),
Migrate,
#[command(hide = true)]
SignEntry,
}
#[derive(Args, Debug)]
pub struct ConfigureArgs {
#[arg(long)]
pub no_claude: bool,
#[arg(long)]
pub no_cursor: bool,
#[arg(long)]
pub no_codex: bool,
#[arg(long)]
pub no_antigravity: bool,
#[arg(long)]
pub no_windsurf: bool,
#[arg(long)]
pub no_opencode: bool,
#[arg(long)]
pub no_copilot: bool,
#[arg(long)]
pub no_mcp: bool,
}
#[derive(Args, Debug)]
pub struct InitArgs {
#[arg(long)]
pub no_git_hook: bool,
#[arg(long)]
pub migrate: bool,
}
#[derive(Args, Debug)]
pub struct ListArgs {
#[arg(long)]
pub uncommitted: bool,
#[arg(long)]
pub agent: Option<String>,
#[arg(long)]
pub file: Option<String>,
#[arg(short = 'n', long)]
pub limit: Option<usize>,
}
#[derive(Args, Debug)]
pub struct BlameArgs {
pub file: std::path::PathBuf,
#[arg(long)]
pub agent: Option<String>,
}
#[derive(Args, Debug)]
pub struct StatsArgs {
#[arg(long)]
pub by_file: bool,
#[arg(long)]
pub by_model: bool,
#[arg(long)]
pub since: Option<String>,
}
#[derive(Args, Debug)]
pub struct ReportArgs {
#[arg(long, default_value = "markdown")]
pub format: ReportFormat,
#[arg(long)]
pub out_md: Option<std::path::PathBuf>,
#[arg(long)]
pub out_annotations: Option<std::path::PathBuf>,
#[arg(long)]
pub since: Option<String>,
#[arg(long)]
pub agent: Option<String>,
#[arg(long)]
pub model: Option<String>,
}
#[derive(Args, Debug)]
pub struct DiffArgs {
pub commit: Option<String>,
#[arg(long)]
pub ai_only: bool,
}
#[derive(Args, Debug)]
pub struct LogArgs {
#[arg(long)]
pub agent: Option<String>,
#[arg(short = 'n', long, default_value = "20")]
pub limit: usize,
#[arg(long)]
pub full_prompt: bool,
}
#[derive(Args, Debug)]
pub struct ShowArgs {
pub sha: String,
}
#[derive(Args, Debug)]
pub struct PushArgs {
#[arg(long)]
pub branch: Option<String>,
#[arg(long)]
pub quiet: bool,
}
#[derive(Args, Debug)]
pub struct ConsolidateArgs {
#[arg(long)]
pub branch: Option<String>,
#[arg(long)]
pub push: bool,
}
#[derive(Args, Debug)]
pub struct LedgerArgs {
#[command(subcommand)]
pub action: LedgerAction,
}
#[derive(Subcommand, Debug)]
pub enum LedgerAction {
Repair,
ImportNotes,
}
#[derive(Args, Debug)]
pub struct ConfigArgs {
#[command(subcommand)]
pub action: ConfigAction,
}
#[derive(Subcommand, Debug)]
pub enum ConfigAction {
Show,
Set { key: String, value: String },
Get { key: String },
AddRepo { path: std::path::PathBuf },
}
#[derive(Debug, Clone, clap::ValueEnum)]
pub enum ReportFormat {
Markdown,
Annotations,
Both,
}
#[derive(Args, Debug)]
pub struct KeysArgs {
#[command(subcommand)]
pub action: KeysAction,
}
#[derive(Subcommand, Debug)]
pub enum KeysAction {
Init,
Register,
Rotate,
}
#[derive(Args, Debug)]
pub struct VerifyArgs {
#[arg(long)]
pub since: Option<String>,
#[arg(long)]
pub strict: bool,
}
#[derive(Args, Debug)]
pub struct PolicyArgs {
#[command(subcommand)]
pub action: PolicyAction,
}
#[derive(Subcommand, Debug)]
pub enum PolicyAction {
Check(PolicyCheckArgs),
}
#[derive(Args, Debug)]
pub struct PolicyCheckArgs {
#[arg(long)]
pub since: Option<String>,
#[arg(long, default_value = "text")]
pub format: PolicyFormat,
}
#[derive(Debug, Clone, clap::ValueEnum)]
pub enum PolicyFormat {
Text,
GithubAnnotations,
}
#[derive(Args, Debug)]
pub struct ExportArgs {
#[arg(long, default_value = "agent-trace")]
pub format: ExportFormat,
}
#[derive(Debug, Clone, clap::ValueEnum)]
pub enum ExportFormat {
AgentTrace,
}