Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/discover/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ pub const PATTERNS: &[&str] = &[
r"^(?:bundle\s+exec\s+)?(?:bin/)?(?:rake|rails)\s+test",
r"^(?:bundle\s+exec\s+)?rspec(?:\s|$)",
r"^(?:bundle\s+exec\s+)?rubocop(?:\s|$)",
// Maven
r"^(\.\/mvnw|mvnw|mvnd|mvn)\s+",
// AWS CLI
r"^aws\s+",
// PostgreSQL
Expand Down Expand Up @@ -376,6 +378,23 @@ pub const RULES: &[RtkRule] = &[
subcmd_savings: &[],
subcmd_status: &[],
},
// Maven
RtkRule {
rtk_cmd: "rtk mvn",
rewrite_prefixes: &["./mvnw", "mvnw", "mvnd", "mvn"],
category: "Build",
savings_pct: 80.0,
subcmd_savings: &[
("test", 90.0),
("clean", 90.0),
("compile", 75.0),
("package", 80.0),
("install", 80.0),
("integration-test", 85.0),
("dependency:tree", 65.0),
],
subcmd_status: &[],
},
// AWS CLI
RtkRule {
rtk_cmd: "rtk aws",
Expand Down
86 changes: 86 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mod lint_cmd;
mod local_llm;
mod log_cmd;
mod ls;
mod mvn_cmd;
mod mypy_cmd;
mod next_cmd;
mod npm_cmd;
Expand Down Expand Up @@ -692,6 +693,12 @@ enum Commands {
command: GtCommands,
},

/// Maven commands with compact output
Mvn {
#[command(subcommand)]
command: MvnCommands,
},

/// golangci-lint with compact output
#[command(name = "golangci-lint")]
GolangciLint {
Expand Down Expand Up @@ -1077,6 +1084,57 @@ enum GoCommands {
Other(Vec<OsString>),
}

#[derive(Subcommand)]
enum MvnCommands {
/// Compile sources with compact output (errors + warnings only)
Compile {
/// Additional mvn compile arguments
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Run tests with compact output (failures only)
Test {
/// Additional mvn test arguments
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Package with compact output (artifact + test summary)
Package {
/// Additional mvn package arguments
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Clean with compact output (single confirmation line)
Clean {
/// Additional mvn clean arguments
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Integration tests with compact output (failures only)
#[command(name = "integration-test")]
IntegrationTest {
/// Additional mvn integration-test arguments
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Install with compact output (artifact + test summary + install path)
Install {
/// Additional mvn install arguments
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Dependency tree with compact output (strip [INFO] prefixes, compact coordinates)
#[command(name = "dependency:tree")]
DependencyTree {
/// Additional mvn dependency:tree arguments
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Passthrough: runs any unsupported mvn subcommand directly
#[command(external_subcommand)]
Other(Vec<OsString>),
}

/// RTK-only subcommands that should never fall back to raw execution.
/// If Clap fails to parse these, show the Clap error directly.
const RTK_META_COMMANDS: &[&str] = &[
Expand Down Expand Up @@ -2087,6 +2145,33 @@ fn main() -> Result<()> {
}
},

Commands::Mvn { command } => match command {
MvnCommands::Compile { args } => {
mvn_cmd::run_compile(&args, cli.verbose)?;
}
MvnCommands::Test { args } => {
mvn_cmd::run_test(&args, cli.verbose)?;
}
MvnCommands::Package { args } => {
mvn_cmd::run_package(&args, cli.verbose)?;
}
MvnCommands::Clean { args } => {
mvn_cmd::run_clean(&args, cli.verbose)?;
}
MvnCommands::IntegrationTest { args } => {
mvn_cmd::run_integration_test(&args, cli.verbose)?;
}
MvnCommands::Install { args } => {
mvn_cmd::run_install(&args, cli.verbose)?;
}
MvnCommands::DependencyTree { args } => {
mvn_cmd::run_dependency_tree(&args, cli.verbose)?;
}
MvnCommands::Other(args) => {
mvn_cmd::run_other(&args, cli.verbose)?;
}
},

Commands::GolangciLint { args } => {
golangci_cmd::run(&args, cli.verbose)?;
}
Expand Down Expand Up @@ -2308,6 +2393,7 @@ fn is_operational_command(cmd: &Commands) -> bool {
| Commands::Rspec { .. }
| Commands::Pip { .. }
| Commands::Go { .. }
| Commands::Mvn { .. }
| Commands::GolangciLint { .. }
| Commands::Gt { .. }
)
Expand Down
Loading