From 6a6d1db408c9366db22ff185c2831c8c38f0139b Mon Sep 17 00:00:00 2001 From: Soof Golan Date: Wed, 25 Mar 2026 13:16:47 +0100 Subject: [PATCH] fix(npx): use npx instead of npm for generic passthrough MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Npx command's default match arm incorrectly called npm_cmd::run(), which executes `npm` instead of `npx`. This caused all non-routed npx commands to fail (e.g. `rtk npx cowsay hello` → "Missing script"). Fixes rtk-ai/rtk#815 --- src/main.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 654a2676..33b65fc3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2007,8 +2007,13 @@ fn main() -> Result<()> { playwright_cmd::run(&args[1..], cli.verbose)?; } _ => { - // Generic passthrough with npm boilerplate filter - npm_cmd::run(&args, cli.verbose, cli.skip_env)?; + let status = utils::resolved_command("npx") + .args(&args) + .status() + .context("Failed to run npx")?; + if !status.success() { + std::process::exit(status.code().unwrap_or(1)); + } } } } @@ -2633,4 +2638,17 @@ mod tests { } } } + + #[test] + fn test_npx_passthrough_preserves_all_args() { + let cli = + Cli::try_parse_from(["rtk", "npx", "cowsay", "-f", "tux", "hello"]) + .unwrap(); + match cli.command { + Commands::Npx { args } => { + assert_eq!(args, vec!["cowsay", "-f", "tux", "hello"]); + } + _ => panic!("Expected Npx command"), + } + } }