Skip to main content

ward/cli/
mod.rs

1pub mod audit;
2pub mod commit;
3pub mod config_cmd;
4pub mod doctor;
5pub mod drift;
6pub mod import;
7pub mod init;
8pub mod plan;
9pub mod policy;
10pub mod protection;
11pub mod repos;
12pub mod rollback;
13pub mod rulesets;
14pub mod security;
15pub mod settings;
16pub mod teams;
17pub mod template_cmd;
18pub mod tui;
19
20use clap::Parser;
21
22#[derive(Parser)]
23#[command(
24    name = "ward",
25    about = "GitHub repository management for developers. Plan, apply, verify.",
26    version,
27    propagate_version = true
28)]
29pub struct Cli {
30    #[command(subcommand)]
31    pub command: Command,
32
33    /// GitHub organization (overrides ward.toml)
34    #[arg(long, global = true)]
35    pub org: Option<String>,
36
37    /// Filter to a specific system (e.g., backend)
38    #[arg(long, global = true)]
39    pub system: Option<String>,
40
41    /// Target a single repository
42    #[arg(long, global = true)]
43    pub repo: Option<String>,
44
45    /// Output as JSON
46    #[arg(long, global = true, default_value_t = false)]
47    pub json: bool,
48
49    /// Max concurrent operations
50    #[arg(long, global = true, default_value_t = 5)]
51    pub parallelism: usize,
52
53    /// Path to ward.toml
54    #[arg(long, global = true)]
55    pub config: Option<String>,
56
57    /// Increase log verbosity (-v, -vv, -vvv)
58    #[arg(short, long, global = true, action = clap::ArgAction::Count)]
59    pub verbose: u8,
60}
61
62#[derive(clap::Subcommand)]
63pub enum Command {
64    /// List and inspect repositories
65    Repos(repos::ReposCommand),
66
67    /// Manage security features (Dependabot, secret scanning, CodeQL)
68    Security(security::SecurityCommand),
69
70    /// Manage repository settings and rulesets
71    Settings(settings::SettingsCommand),
72
73    /// Commit files/templates to repositories
74    Commit(commit::CommitCommand),
75
76    /// Manage branch protection rules
77    Protection(protection::ProtectionCommand),
78
79    /// Detect configuration drift from desired state
80    Drift(drift::DriftCommand),
81
82    /// Manage repository rulesets
83    Rulesets(rulesets::RulesetsCommand),
84
85    /// Manage team access to repositories
86    Teams(teams::TeamsCommand),
87
88    /// Rollback changes using the audit log
89    Rollback(rollback::RollbackCommand),
90
91    /// Full compliance audit across repos
92    Audit(audit::AuditCommand),
93
94    /// Import existing org state into ward.toml
95    Import(import::ImportCommand),
96
97    /// Unified plan across all checks
98    Plan(plan::PlanCommand),
99
100    /// Check repos against policy rules
101    Policy(policy::PolicyCommand),
102
103    /// Diagnose your Ward setup
104    Doctor(doctor::DoctorCommand),
105
106    /// Launch interactive terminal UI
107    Tui,
108
109    /// Interactive setup wizard (creates ward.toml)
110    Init(init::InitCommand),
111
112    /// Manage ward.toml configuration
113    Config(config_cmd::ConfigCommand),
114
115    /// Manage workflow templates
116    Template(template_cmd::TemplateCommand),
117
118    /// Generate shell completions
119    #[command(hide = true)]
120    Completions {
121        /// Shell to generate completions for
122        #[arg(value_enum)]
123        shell: clap_complete::Shell,
124    },
125}