Skip to content

Commit 01d61c6

Browse files
committed
Moved the wrapper creation logic to the installation function of kiro-cli
1 parent a51a51e commit 01d61c6

File tree

5 files changed

+13
-37
lines changed

5 files changed

+13
-37
lines changed

crates/fig_desktop/src/install.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,13 @@ pub async fn initialize_fig_dir(env: &fig_os_shim::Env) -> anyhow::Result<()> {
327327

328328
for old_cli_binary_name in OLD_CLI_BINARY_NAMES {
329329
let old_cli_binary_path = local_bin.join(old_cli_binary_name);
330-
if old_cli_binary_path.is_symlink() {
330+
if old_cli_binary_name == &"q" {
331+
// Create wrapper script for q instead of symlink
332+
if let Err(err) = fig_util::wrapper::create_q_wrapper(&local_bin).await {
333+
warn!(%err, "Failed to create q wrapper script");
334+
}
335+
} else if old_cli_binary_path.is_symlink() {
336+
// Handle other legacy binaries (cw) with symlinks
331337
if let Err(err) = symlink(&q_cli_path, &old_cli_binary_path).await {
332338
warn!(%err, "Failed to symlink legacy CLI: {old_cli_binary_path:?}");
333339
}
@@ -660,6 +666,11 @@ async fn install_appimage_binaries(ctx: &Context) -> anyhow::Result<()> {
660666
}
661667
}
662668

669+
// Create q wrapper for backward compatibility
670+
if let Err(err) = fig_util::wrapper::create_q_wrapper(&home_local_bin_ctx(ctx)?).await {
671+
error!(%err, "Failed to create q wrapper script");
672+
}
673+
663674
Ok(())
664675
}
665676

crates/fig_install/src/linux.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ async fn replace_bins(bin_dir: &Path) -> Result<(), Error> {
111111
}
112112
}
113113

114-
// Create legacy q wrapper script after updating binaries
115-
if let Err(err) = fig_util::wrapper::create_q_wrapper(&local_bin).await {
116-
tracing::warn!("Failed to create q wrapper: {}", err);
117-
}
118-
119114
res
120115
}
121116

crates/fig_util/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub const RUNTIME_DIR_NAME: &str = "cwrun";
2727

2828
// These are the old "CodeWhisperer" branding, used anywhere we will not update to Amazon Q
2929
pub const OLD_PRODUCT_NAME: &str = "CodeWhisperer";
30-
pub const OLD_CLI_BINARY_NAMES: &[&str] = &["cw"];
30+
pub const OLD_CLI_BINARY_NAMES: &[&str] = &["cw", "q"];
3131
pub const OLD_PTY_BINARY_NAMES: &[&str] = &["cwterm"];
3232

3333
pub const GITHUB_REPO_NAME: &str = "aws/amazon-q-developer-cli";

crates/q_cli/src/cli/internal/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -777,11 +777,6 @@ impl InternalSubcommand {
777777
tokio::time::sleep(Duration::from_millis(200)).await;
778778
}
779779

780-
// Create legacy q wrapper script for backward compatibility
781-
if let Err(err) = fig_util::wrapper::create_q_wrapper(&fig_util::directories::home_local_bin()?).await {
782-
tracing::warn!("Failed to create q wrapper: {}", err);
783-
}
784-
785780
launch_fig_desktop(LaunchArgs {
786781
wait_for_socket: false,
787782
open_dashboard: relaunch_dashboard,

scripts/install.sh

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -318,23 +318,6 @@ 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-
338321
# Install on macOS
339322
install_macos() {
340323
local dmg_path="$1"
@@ -478,14 +461,6 @@ main() {
478461
install_linux "$downloaded_file"
479462
fi
480463

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

491466
echo

0 commit comments

Comments
 (0)