use clap::Parser;
fn is_gpu_available() -> bool {
#[cfg(gpu_available)]
{
true
}
#[cfg(not(gpu_available))]
{
false
}
}
#[derive(Parser, Clone, Debug, Resource)]
#[command(
name = "ai-code-buddy",
version,
about = "🤖 AI-powered code review tool with elegant TUI",
long_about = "AI Code Buddy is an intelligent code analysis tool that compares branches, \
detects security vulnerabilities, performance issues, and code quality problems. \
Features a modern Bevy-powered TUI with real-time analysis and reporting."
)]
pub struct Args {
#[arg(
value_name = "REPO_PATH",
default_value = ".",
help = "Path to the Git repository (default: current directory)"
)]
pub repo_path: String,
#[arg(
short = 's',
long = "source",
value_name = "BRANCH",
default_value = "main",
help = "Source branch to compare from"
)]
pub source_branch: String,
#[arg(
short = 't',
long = "target",
value_name = "BRANCH",
default_value = "HEAD",
help = "Target branch to compare to (default: HEAD)"
)]
pub target_branch: String,
#[arg(
long = "cli",
help = "Run in CLI mode with text output instead of interactive interface"
)]
pub cli_mode: bool,
#[arg(
short = 'v',
long = "verbose",
help = "Enable verbose output for debugging"
)]
pub verbose: bool,
#[arg(
long = "credits",
help = "Show credits and list all contributors to the project"
)]
pub show_credits: bool,
#[arg(
short = 'f',
long = "format",
value_enum,
default_value = "summary",
help = "Output format for results"
)]
pub output_format: OutputFormat,
#[arg(
long = "exclude",
value_name = "PATTERN",
help = "Exclude files matching glob pattern (can be used multiple times)",
action = clap::ArgAction::Append
)]
pub exclude_patterns: Vec<String>,
#[arg(
long = "include",
value_name = "PATTERN",
help = "Include only files matching glob pattern (can be used multiple times)",
action = clap::ArgAction::Append
)]
pub include_patterns: Vec<String>,
#[arg(
long = "gpu",
help = "Enable GPU acceleration (Metal on Apple, CUDA on NVIDIA, auto-detected)",
default_value_t = is_gpu_available()
)]
pub use_gpu: bool,
#[arg(
long = "cpu",
help = "Force CPU mode (disable GPU acceleration even if available)",
conflicts_with = "use_gpu"
)]
pub force_cpu: bool,
#[arg(
long = "parallel",
help = "Enable parallel file analysis using all available CPU cores",
default_value = "true"
)]
pub parallel: bool,
#[arg(
long = "disable-ai",
help = "Disable AI-powered analysis (experimental feature)",
default_value_t = false
)]
pub disable_ai: bool,
}
#[derive(clap::ValueEnum, Clone, Debug, PartialEq)]
pub enum OutputFormat {
Summary,
Detailed,
Json,
Markdown,
}
use bevy::prelude::Resource;