Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions libs/cua-driver/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ RUST_INSTALLER_URL="https://raw.githubusercontent.com/trycua/cua/main/libs/cua-d
# parsing without breaking forwarding, and keeps both installers' argv shapes
# (--bin-dir, --no-modify-path) bit-compatible.
#
# Default backend is the Swift macOS implementation. The Rust implementation
# is opt-in via --backend=rust / --experimental-rust, and is used
# automatically on non-macOS hosts where the Swift build can't run.
USE_RUST_BACKEND=0
# Default backend is the cross-platform Rust implementation. The Swift macOS
# implementation is opt-in via --backend=swift, and only runs on macOS.
USE_RUST_BACKEND=1
Comment on lines +65 to +67

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the remaining script comments to match the new default.

With USE_RUST_BACKEND=1 here, Lines 15-21 and Lines 57-59 are now stale: they still describe Swift as the default and say Rust delegation only happens after --backend=rust or on non-macOS. That leaves the file with conflicting instructions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/cua-driver/scripts/install.sh` around lines 65 - 67, Update the outdated
comments in the install.sh script to reflect that USE_RUST_BACKEND=1 makes the
Rust backend the default; specifically, change the earlier block that currently
states Swift is the default (Lines 15-21) to say Rust is the default and
Swift/macOS is opt-in via --backend=swift, and also change the later block
(Lines 57-59) which implies Rust only runs after --backend=rust to instead
explain that Rust is used by default and that --backend=rust is redundant on
non-macOS while --backend=swift forces the Swift backend on macOS; reference the
USE_RUST_BACKEND variable and the CLI flags --backend=swift / --backend=rust
when updating the wording.

FORWARDED_ARGS=()
PASSTHROUGH=0
while [[ $# -gt 0 ]]; do
Expand All @@ -75,7 +74,7 @@ while [[ $# -gt 0 ]]; do
case "$1" in
--experimental-rust) USE_RUST_BACKEND=1; shift ;; # legacy alias for --backend=rust
--backend=rust) USE_RUST_BACKEND=1; shift ;; # opt into the Rust implementation
--backend=swift) USE_RUST_BACKEND=0; shift ;; # explicit default — no-op
--backend=swift) USE_RUST_BACKEND=0; shift ;; # opt into the macOS-only Swift implementation
--backend=*)
printf 'error: unknown backend %q; supported: swift, rust\n' "${1#*=}" >&2
exit 2
Expand All @@ -95,17 +94,17 @@ done

# --- Opt-in delegation to the Rust implementation -----------------------
#
# The default backend is the Swift macOS implementation, but Swift only
# runs on macOS — so on any non-macOS host we transparently promote to the
# The Swift backend only runs on macOS — so if it was explicitly requested
# via --backend=swift on any non-macOS host, transparently fall back to the
# Rust implementation, which is the only one that builds there.
OS="$(uname -s 2>/dev/null || echo unknown)"
if [[ "$USE_RUST_BACKEND" == "0" && "$OS" != "Darwin" ]]; then
printf 'note: Swift backend is macOS-only; falling back to the Rust implementation on %s.\n' "$OS" >&2
USE_RUST_BACKEND=1
fi

# Hand the rest of argv to _install-rust.sh and exit. The default Swift
# install path below is only reached when the Rust backend was not selected.
# Hand the rest of argv to _install-rust.sh and exit. The Swift install path
# below is only reached when --backend=swift was selected on macOS.
if [[ "$USE_RUST_BACKEND" == "1" ]]; then
if [[ "$OS" != "Darwin" ]]; then
printf 'note: detected non-macOS host (%s); installing cua-driver via the Rust implementation.\n' "$OS" >&2
Expand Down
Loading