From b46e0edebe29762675bf98e0ea0b50289990627f Mon Sep 17 00:00:00 2001 From: Hunter Bown Date: Sun, 24 May 2026 15:09:10 -0500 Subject: [PATCH] feat(v0.8.44): add codew convenience alias binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Permanent short-form shim — forwards silently to codewhale. Six fewer keystrokes, no deprecation warning. Ships alongside codewhale and the legacy deepseek alias. --- crates/cli/Cargo.toml | 5 +++ crates/cli/src/bin/codew_legacy_shim.rs | 54 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 crates/cli/src/bin/codew_legacy_shim.rs diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 21fcb9e5..8cfeabc9 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -10,6 +10,11 @@ description = "Agentic terminal facade for open-source and open-weight coding mo name = "codewhale" path = "src/main.rs" +# Short-form convenience alias — forwards to `codewhale` silently. +[[bin]] +name = "codew" +path = "src/bin/codew_legacy_shim.rs" + # Legacy alias — forwards to `codewhale` and prints a deprecation notice. # Will be removed in v0.9.0. [[bin]] diff --git a/crates/cli/src/bin/codew_legacy_shim.rs b/crates/cli/src/bin/codew_legacy_shim.rs new file mode 100644 index 00000000..165e05a9 --- /dev/null +++ b/crates/cli/src/bin/codew_legacy_shim.rs @@ -0,0 +1,54 @@ +//! Convenience `codew` alias. +//! +//! Forwards argv to the `codewhale` dispatcher silently. This is a +//! permanent short-form alias — six fewer keystrokes, same binary. + +use std::env; +use std::process::Command; + +fn main() { + let args: Vec = env::args_os() + .skip(1) + .map(|a| a.to_string_lossy().into_owned()) + .collect(); + + let status = match spawn_codewhale(&args) { + Ok(s) => s, + Err(e) => { + eprintln!( + "error: failed to spawn `codewhale`: {e}. Is it on PATH? \ + Install with `cargo install codewhale-cli` or via npm/Homebrew." + ); + std::process::exit(127); + } + }; + std::process::exit(status.code().unwrap_or(1)); +} + +fn spawn_codewhale(args: &[String]) -> std::io::Result { + // Try PATH first. + match Command::new("codewhale").args(args).status() { + Ok(s) => return Ok(s), + Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} + Err(e) => return Err(e), + } + + // On Windows, after an update the sibling `codewhale.exe` may be in the + // same directory as this shim but not on PATH (#2006). + #[cfg(windows)] + { + if let Ok(exe_path) = env::current_exe() { + if let Some(dir) = exe_path.parent() { + let sibling = dir.join("codewhale.exe"); + if sibling.is_file() { + return Command::new(sibling).args(args).status(); + } + } + } + } + + Err(std::io::Error::new( + std::io::ErrorKind::NotFound, + "codewhale not found on PATH or in sibling directory", + )) +}