From 7af3399af2060e9365f8bcfe3257dd3e55560d83 Mon Sep 17 00:00:00 2001 From: Edwin Date: Wed, 2 Sep 2026 22:57:30 -0700 Subject: [PATCH] feat(cli): add 'construct update' as hidden alias for upgrade --- crates/cli/src/main.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 2a5216a0..da31d109 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -251,6 +251,7 @@ enum Command { }, /// Download and install the latest release (or `--version TAG`), /// atomically replacing the installed binaries in place. + #[command(alias = "update")] Upgrade { /// Install a specific release tag (e.g. v0.2.0). Default: latest. #[arg(long)] @@ -1276,4 +1277,34 @@ mod tests { ["claude", "--model", "opus", "--title", "raw"] ); } + + #[test] + fn update_is_hidden_alias_for_upgrade() { + use clap::CommandFactory; + + let cli = Cli::try_parse_from(["construct", "update", "--check", "--restart", "--version", "v0.18.0"]) + .expect("parse construct update"); + + let Some(Command::Upgrade { + version, + restart, + check, + bin_dir, + }) = cli.command + else { + panic!("expected upgrade command from update alias"); + }; + + assert_eq!(version.as_deref(), Some("v0.18.0")); + assert!(restart); + assert!(check); + assert_eq!(bin_dir, None); + + let mut cmd = Cli::command(); + let mut help_buf = Vec::new(); + cmd.write_help(&mut help_buf).expect("write help"); + let help_text = String::from_utf8(help_buf).expect("valid utf8"); + assert!(help_text.contains("upgrade")); + assert!(!help_text.contains("update")); + } }