ferrous_forge/commands/mod.rs
1//! Command implementations for Ferrous Forge
2
3use clap::Subcommand;
4
5/// Available commands for Ferrous Forge
6#[derive(Subcommand)]
7pub enum Commands {
8 /// Initialize Ferrous Forge system-wide
9 Init {
10 /// Force initialization even if already configured
11 #[arg(short, long)]
12 force: bool,
13 },
14 /// Show status of Ferrous Forge installation and configuration
15 Status,
16 /// Update Ferrous Forge to the latest version
17 Update {
18 /// Update channel to use (stable, beta, nightly)
19 #[arg(short, long, default_value = "stable")]
20 channel: String,
21 /// Only update rules, not the binary
22 #[arg(short, long)]
23 rules_only: bool,
24 /// Show what would be updated without actually updating
25 #[arg(short, long)]
26 dry_run: bool,
27 },
28 /// Manage configuration settings
29 Config {
30 /// Set a configuration value (key=value)
31 #[arg(short, long)]
32 set: Option<String>,
33 /// Get a configuration value
34 #[arg(short, long)]
35 get: Option<String>,
36 /// List all configuration values
37 #[arg(short, long)]
38 list: bool,
39 /// Reset configuration to defaults
40 #[arg(short, long)]
41 reset: bool,
42 },
43 /// Validate a Rust project against standards
44 Validate {
45 /// Path to the project to validate (defaults to current directory)
46 path: Option<std::path::PathBuf>,
47 /// Generate AI-friendly compliance report
48 #[arg(long)]
49 ai_report: bool,
50 /// Compare with previous report
51 #[arg(long)]
52 compare_previous: bool,
53 },
54 /// Rollback to a previous version
55 Rollback {
56 /// Version to rollback to
57 version: String,
58 },
59 /// Uninstall Ferrous Forge from the system
60 Uninstall {
61 /// Confirm uninstallation without prompting
62 #[arg(short, long)]
63 confirm: bool,
64 },
65 /// Rust version management
66 Rust {
67 /// Rust version management subcommand
68 #[command(subcommand)]
69 command: RustCommand,
70 },
71 /// Edition management
72 Edition {
73 /// Edition management subcommand
74 #[command(subcommand)]
75 command: EditionCommand,
76 },
77 /// Safety pipeline management
78 Safety {
79 /// Safety pipeline subcommand
80 #[command(subcommand)]
81 command: SafetyCommand,
82 },
83}
84
85/// Rust version management subcommands
86#[derive(Subcommand)]
87pub enum RustCommand {
88 /// Check current Rust version and available updates
89 Check {
90 /// Show verbose output
91 #[arg(short, long)]
92 verbose: bool,
93 },
94 /// Get update recommendations
95 Recommend {
96 /// Only consider stable releases
97 #[arg(short, long)]
98 stable_only: bool,
99 },
100 /// List recent Rust releases
101 List {
102 /// Number of releases to show
103 #[arg(short, long, default_value = "10")]
104 count: usize,
105 },
106}
107
108/// Edition management subcommands
109#[derive(Subcommand)]
110pub enum EditionCommand {
111 /// Check edition compliance
112 Check {
113 /// Project path
114 #[arg(default_value = ".")]
115 path: std::path::PathBuf,
116 },
117 /// Migrate to a new edition
118 Migrate {
119 /// Target edition (2018, 2021, 2024)
120 #[arg(default_value = "2024")]
121 edition: String,
122 /// Skip backup creation
123 #[arg(long)]
124 no_backup: bool,
125 /// Run tests after migration
126 #[arg(long)]
127 test: bool,
128 /// Apply edition idioms
129 #[arg(long)]
130 idioms: bool,
131 },
132 /// Analyze edition compatibility
133 Analyze {
134 /// Project path
135 #[arg(default_value = ".")]
136 path: std::path::PathBuf,
137 /// Target edition
138 #[arg(default_value = "2024")]
139 edition: String,
140 },
141}
142
143/// Safety pipeline management subcommands
144#[derive(Subcommand)]
145pub enum SafetyCommand {
146 /// Check safety pipeline status
147 Status,
148 /// Run safety checks manually
149 Check {
150 /// Pipeline stage to check
151 #[arg(long, default_value = "pre-commit")]
152 stage: String,
153 /// Project path
154 #[arg(default_value = ".")]
155 path: std::path::PathBuf,
156 /// Show verbose output
157 #[arg(short, long)]
158 verbose: bool,
159 },
160 /// Test individual safety checks
161 Test {
162 /// Project path
163 #[arg(default_value = ".")]
164 path: std::path::PathBuf,
165 },
166}
167
168pub mod config;
169pub mod edition;
170pub mod init;
171pub mod rollback;
172pub mod rust;
173pub mod safety;
174pub mod status;
175pub mod uninstall;
176pub mod update;
177pub mod validate;