Skip to content

Commit 97f5b91

Browse files
committed
Add a flag and write a wrapper script to redirect all old q calls to kirocli with a warning
1 parent d6315e7 commit 97f5b91

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

crates/fig_install/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub async fn uninstall(components: InstallComponents, ctx: Arc<Context>) -> Resu
7272
// let folders = [directories::home_local_bin()?, Path::new("/usr/local/bin").into()];
7373
let folders = [directories::home_local_bin()?];
7474

75-
let mut all_binary_names = vec![CLI_BINARY_NAME, CHAT_BINARY_NAME, PTY_BINARY_NAME];
75+
let mut all_binary_names = vec![CLI_BINARY_NAME, CHAT_BINARY_NAME, PTY_BINARY_NAME, "q"];
7676
all_binary_names.extend(OLD_CLI_BINARY_NAMES);
7777
all_binary_names.extend(OLD_PTY_BINARY_NAMES);
7878

crates/q_cli/src/cli/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,18 @@ pub struct Cli {
292292
/// Print help for all subcommands
293293
#[arg(long)]
294294
help_all: bool,
295+
/// Show legacy warning for q command
296+
#[arg(long, hide = true)]
297+
show_legacy_warning: bool,
295298
}
296299

297300
impl Cli {
298301
pub async fn execute(self) -> Result<ExitCode> {
302+
// Show legacy warning if flag is set
303+
if self.show_legacy_warning {
304+
eprintln!("Warn: Q CLI is now Kiro CLI and should be invoked as kiro-cli rather than q");
305+
}
306+
299307
// Initialize our logger and keep around the guard so logging can perform as expected.
300308
let _log_guard = initialize_logging(LogArgs {
301309
log_level: match self.verbose > 0 {

scripts/install.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,23 @@ create_symlink() {
318318
ln -s "$src" "$dst"
319319
}
320320

321+
# Create legacy q wrapper script
322+
create_q_wrapper() {
323+
local install_dir="$1"
324+
local wrapper_path="$install_dir/q"
325+
326+
# Remove existing q command if it exists
327+
rm -f "$wrapper_path"
328+
329+
# Create wrapper script
330+
cat > "$wrapper_path" << EOF
331+
#!/bin/sh
332+
"$install_dir/kiro-cli" --show-legacy-warning "\$@"
333+
EOF
334+
335+
chmod +x "$wrapper_path"
336+
}
337+
321338
# Install on macOS
322339
install_macos() {
323340
local dmg_path="$1"
@@ -460,6 +477,14 @@ main() {
460477
install_linux "$downloaded_file"
461478
fi
462479

480+
# Create legacy q wrapper script
481+
log "Creating legacy q wrapper..."
482+
if [[ "$os" == "macos" ]]; then
483+
create_q_wrapper "$HOME/.local/bin"
484+
else
485+
create_q_wrapper "$LINUX_INSTALL_DIR"
486+
fi
487+
463488
SUCCESS=true
464489

465490
echo

0 commit comments

Comments
 (0)