Skip to main content

ward/cli/
mod.rs

1pub mod audit;
2pub mod commit;
3pub mod init;
4pub mod protection;
5pub mod repos;
6pub mod rollback;
7pub mod security;
8pub mod settings;
9pub mod tui;
10
11use clap::Parser;
12
13#[derive(Parser)]
14#[command(
15    name = "ward",
16    about = "GitHub repository management for developers. Plan, apply, verify.",
17    version,
18    propagate_version = true
19)]
20pub struct Cli {
21    #[command(subcommand)]
22    pub command: Command,
23
24    /// GitHub organization (overrides ward.toml)
25    #[arg(long, global = true)]
26    pub org: Option<String>,
27
28    /// Filter to a specific system (e.g., backend)
29    #[arg(long, global = true)]
30    pub system: Option<String>,
31
32    /// Target a single repository
33    #[arg(long, global = true)]
34    pub repo: Option<String>,
35
36    /// Output as JSON
37    #[arg(long, global = true, default_value_t = false)]
38    pub json: bool,
39
40    /// Max concurrent operations
41    #[arg(long, global = true, default_value_t = 5)]
42    pub parallelism: usize,
43
44    /// Path to ward.toml
45    #[arg(long, global = true)]
46    pub config: Option<String>,
47
48    /// Increase log verbosity (-v, -vv, -vvv)
49    #[arg(short, long, global = true, action = clap::ArgAction::Count)]
50    pub verbose: u8,
51}
52
53#[derive(clap::Subcommand)]
54pub enum Command {
55    /// List and inspect repositories
56    Repos(repos::ReposCommand),
57
58    /// Manage security features (Dependabot, secret scanning, CodeQL)
59    Security(security::SecurityCommand),
60
61    /// Manage repository settings and rulesets
62    Settings(settings::SettingsCommand),
63
64    /// Commit files/templates to repositories
65    Commit(commit::CommitCommand),
66
67    /// Manage branch protection rules
68    Protection(protection::ProtectionCommand),
69
70    /// Rollback changes using the audit log
71    Rollback(rollback::RollbackCommand),
72
73    /// Full compliance audit across repos
74    Audit(audit::AuditCommand),
75
76    /// Launch interactive terminal UI
77    Tui,
78
79    /// Interactive setup wizard (creates ward.toml)
80    Init(init::InitCommand),
81
82    /// Generate shell completions
83    #[command(hide = true)]
84    Completions {
85        /// Shell to generate completions for
86        #[arg(value_enum)]
87        shell: clap_complete::Shell,
88    },
89}