1use clap::Parser;
2
3fn is_gpu_available() -> bool {
5 #[cfg(gpu_available)]
6 {
7 true
8 }
9 #[cfg(not(gpu_available))]
10 {
11 false
12 }
13}
14
15#[derive(Parser, Clone, Debug, Resource)]
16#[command(
17 name = "ai-code-buddy",
18 version,
19 about = "🤖 AI-powered code review tool with elegant TUI",
20 long_about = "AI Code Buddy is an intelligent code analysis tool that compares branches, \
21 detects security vulnerabilities, performance issues, and code quality problems. \
22 Features a modern Bevy-powered TUI with real-time analysis and reporting."
23)]
24pub struct Args {
25 #[arg(
27 value_name = "REPO_PATH",
28 default_value = ".",
29 help = "Path to the Git repository (default: current directory)"
30 )]
31 pub repo_path: String,
32
33 #[arg(
35 short = 's',
36 long = "source",
37 value_name = "BRANCH",
38 default_value = "main",
39 help = "Source branch to compare from"
40 )]
41 pub source_branch: String,
42
43 #[arg(
45 short = 't',
46 long = "target",
47 value_name = "BRANCH",
48 default_value = "HEAD",
49 help = "Target branch to compare to (default: HEAD)"
50 )]
51 pub target_branch: String,
52
53 #[arg(
55 long = "cli",
56 help = "Run in CLI mode with text output instead of interactive interface"
57 )]
58 pub cli_mode: bool,
59
60 #[arg(
62 short = 'v',
63 long = "verbose",
64 help = "Enable verbose output for debugging"
65 )]
66 pub verbose: bool,
67
68 #[arg(
70 long = "credits",
71 help = "Show credits and list all contributors to the project"
72 )]
73 pub show_credits: bool,
74
75 #[arg(
77 short = 'f',
78 long = "format",
79 value_enum,
80 default_value = "summary",
81 help = "Output format for results"
82 )]
83 pub output_format: OutputFormat,
84
85 #[arg(
87 long = "exclude",
88 value_name = "PATTERN",
89 help = "Exclude files matching glob pattern (can be used multiple times)",
90 action = clap::ArgAction::Append
91 )]
92 pub exclude_patterns: Vec<String>,
93
94 #[arg(
96 long = "include",
97 value_name = "PATTERN",
98 help = "Include only files matching glob pattern (can be used multiple times)",
99 action = clap::ArgAction::Append
100 )]
101 pub include_patterns: Vec<String>,
102
103 #[arg(
105 long = "gpu",
106 help = "Enable GPU acceleration (Metal on Apple, CUDA on NVIDIA, auto-detected)",
107 default_value_t = is_gpu_available()
108 )]
109 pub use_gpu: bool,
110
111 #[arg(
113 long = "cpu",
114 help = "Force CPU mode (disable GPU acceleration even if available)",
115 conflicts_with = "use_gpu"
116 )]
117 pub force_cpu: bool,
118}
119
120#[derive(clap::ValueEnum, Clone, Debug, PartialEq)]
121pub enum OutputFormat {
122 Summary,
124 Detailed,
126 Json,
128 Markdown,
130}
131
132use bevy::prelude::Resource;