Skip to main content

ward/cli/
mod.rs

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