Skip to main content

aiproof_cli/
cli.rs

1use clap::{Parser, ValueEnum};
2use std::path::PathBuf;
3
4#[derive(Parser, Debug)]
5#[command(name = "aiproof", version, about = "Static analyzer for AI prompts")]
6pub struct Cli {
7    /// Paths to scan. Defaults to current directory.
8    #[arg(default_value = ".")]
9    pub paths: Vec<PathBuf>,
10
11    /// Output format.
12    #[arg(long, value_enum, default_value_t = Format::Pretty)]
13    pub format: Format,
14
15    /// Enable specific rule codes (overrides config).
16    #[arg(long)]
17    pub select: Vec<String>,
18
19    /// Disable specific rule codes (overrides config).
20    #[arg(long)]
21    pub ignore: Vec<String>,
22
23    /// Target model hint for portability rules (repeatable).
24    #[arg(long = "target-model")]
25    pub target_models: Vec<String>,
26
27    /// Apply safe autofixes to files in place. Idempotent.
28    #[arg(long)]
29    pub fix: bool,
30
31    /// Also apply autofixes the rule author marked unsafe.
32    #[arg(long, requires = "fix")]
33    pub unsafe_fixes: bool,
34
35    /// Color control.
36    #[arg(long, value_enum, default_value_t = ColorMode::Auto)]
37    pub color: ColorMode,
38
39    /// Print the bundled explanation for a rule code and exit.
40    #[arg(long, value_name = "CODE")]
41    pub explain: Option<String>,
42
43    /// Print a starter config + pre-commit snippet and exit.
44    #[arg(long)]
45    pub init: bool,
46}
47
48#[derive(Debug, Clone, Copy, ValueEnum)]
49pub enum Format {
50    Pretty,
51    Json,
52    Sarif,
53}
54
55#[derive(Debug, Clone, Copy, ValueEnum)]
56pub enum ColorMode {
57    Auto,
58    Always,
59    Never,
60}