From 19c2671a22d9bb01cb959ec8d3e5aa1c562854fa Mon Sep 17 00:00:00 2001 From: Francesco Bonacci Date: Tue, 26 May 2026 12:19:05 +0200 Subject: [PATCH] chore(cua-driver-rs)(install): install-local.sh defaults to the Rust backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The local/dev installer now picks the Rust backend by default on every host. The production curl-pipe-bash `install.sh` stays unchanged — it keeps the Swift default on macOS until cua-driver-rs flips from experimental to stable. Why now: the Rust port is the active dev target across all three platforms, has the full integration-test surface attached (crates/ cua-driver/tests/harness_*_test.rs), and devs working off `install- local.sh` are the audience that's been using `--experimental-rust` / `--backend=rust` reflexively for weeks. Flipping the default cuts a flag from every checked-out-tree install. Flag handling: - `--backend=swift` now sets USE_SWIFT_BACKEND=1 (was a no-op since Swift was the default). Errors on non-Darwin since there's no Swift install path there. - `--backend=rust` is now the no-op (matches the default). - `--experimental-rust` accepted as legacy alias, also no-op now. Kept so any script or doc passing it keeps working. No behavior change to `install.sh`, `install.ps1`, or either helper. Single-file edit; bash -n clean; verified dispatch: - bare invocation → _install-local-rust.sh - `--backend=swift` on macOS → _install-local-swift.sh - `--backend=swift` on Linux → hard-error before helper exec Co-Authored-By: Claude Opus 4.7 --- libs/cua-driver/scripts/install-local.sh | 51 ++++++++++++++---------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/libs/cua-driver/scripts/install-local.sh b/libs/cua-driver/scripts/install-local.sh index 0a940756e3..39cfc1b965 100755 --- a/libs/cua-driver/scripts/install-local.sh +++ b/libs/cua-driver/scripts/install-local.sh @@ -6,18 +6,28 @@ # private helper based on host + flags. # # Helpers (private — do not invoke directly): -# _install-local-swift.sh Builds CuaDriver.app from libs/cua-driver/swift -# and installs to /Applications + ~/.local/bin # _install-local-rust.sh Builds cua-driver from libs/cua-driver/rust # and installs the cross-platform binary +# _install-local-swift.sh Builds CuaDriver.app from libs/cua-driver/swift +# and installs to /Applications + ~/.local/bin +# +# Defaults (this script only — install.sh keeps the Swift default on macOS): +# all hosts → Rust backend # -# Defaults: -# macOS → Swift backend (today's default; pass --backend=rust to override) -# non-mac → Rust backend (Swift is macOS-only; auto-selected) +# Why the local installer defaults to Rust while the production install.sh +# still gates it behind --experimental-rust: this script is for developers +# working on the checked-out tree, where the Rust port is the active +# development target across all three platforms (Windows / Linux / macOS) +# and has the full integration-test surface attached (see +# crates/cua-driver/tests/harness_*_test.rs). The production curl-pipe-bash +# stays on Swift on macOS until the Rust port flips experimental → stable. # # Flags (forwarded verbatim to whichever helper runs): -# --experimental-rust opt into the Rust port (same as --backend=rust) -# --backend=swift|rust explicit backend selector +# --backend=swift|rust explicit backend selector (defaults to rust here) +# --experimental-rust legacy alias for --backend=rust; now a no-op +# since rust is the default. Accepted for +# backward compat with scripts/docs that still +# pass it. # --release build the release configuration (default: debug) # --daemon | --autostart pass through to the backend helper # --bin-dir override the symlink destination (default ~/.local/bin) @@ -31,9 +41,9 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" # --- Lightweight flag parsing (mirror install.sh) ----------------------- # Two-pass shape: collect every unrecognised arg into FORWARDED_ARGS so the # selected backend helper sees the same argv shape as before the wrapper -# existed. Recognised dispatch flags (--experimental-rust, --backend=*) are -# consumed here and never forwarded. -USE_RUST_BACKEND=0 +# existed. Recognised dispatch flags (--backend=*, --experimental-rust) +# are consumed here and never forwarded. +USE_SWIFT_BACKEND=0 FORWARDED_ARGS=() PASSTHROUGH=0 while [[ $# -gt 0 ]]; do @@ -41,9 +51,9 @@ while [[ $# -gt 0 ]]; do FORWARDED_ARGS+=("$1"); shift; continue fi case "$1" in - --experimental-rust) USE_RUST_BACKEND=1; shift ;; - --backend=rust) USE_RUST_BACKEND=1; shift ;; - --backend=swift) shift ;; # explicit default — no-op + --backend=swift) USE_SWIFT_BACKEND=1; shift ;; + --backend=rust) shift ;; # explicit default — no-op + --experimental-rust) shift ;; # legacy alias for --backend=rust --backend=*) printf 'error: unknown backend %q; supported: swift, rust\n' "${1#*=}" >&2 exit 2 @@ -53,17 +63,18 @@ while [[ $# -gt 0 ]]; do esac done -# Auto-select Rust on non-macOS — Swift has no install path off Darwin. -if [[ "$USE_RUST_BACKEND" == "0" && "$(uname -s 2>/dev/null)" != "Darwin" ]]; then - USE_RUST_BACKEND=1 - printf 'note: detected non-macOS host (%s); auto-selecting the cua-driver-rs Rust backend.\n' \ +# Hard-error on --backend=swift off-Darwin — there's no Swift install path +# anywhere else and the helper would just bail with a confusing error. +if [[ "$USE_SWIFT_BACKEND" == "1" && "$(uname -s 2>/dev/null)" != "Darwin" ]]; then + printf 'error: --backend=swift requested on non-macOS host (%s); Swift binary is macOS-only.\n' \ "$(uname -s 2>/dev/null || echo unknown)" >&2 + exit 2 fi -if [[ "$USE_RUST_BACKEND" == "1" ]]; then - HELPER="$SCRIPT_DIR/_install-local-rust.sh" -else +if [[ "$USE_SWIFT_BACKEND" == "1" ]]; then HELPER="$SCRIPT_DIR/_install-local-swift.sh" +else + HELPER="$SCRIPT_DIR/_install-local-rust.sh" fi if [[ ! -f "$HELPER" ]]; then