feat(install): add --experimental-rust flag to opt into cua-driver-rs backend (#1534) - #1538
Conversation
… backend (#1534) Wire `--experimental-rust` (and the explicit alias `--backend=rust`) into the canonical Swift installer so early adopters can swap to the cross- platform Rust port without us flipping the default for everyone. When set, the Swift install path is skipped entirely and execution is handed off to `libs/cua-driver-rs/scripts/install.sh` with `--bin-dir` / `--no-modify-path` (and anything after `--`) forwarded verbatim. The two bundles use distinct bundle ids so they coexist on the same machine with independent TCC grants and telemetry IDs — flipping back is just `rm -rf /Applications/CuaDriverRs.app` + re-running the installer without the flag. Closes #1534 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR adds an ChangesExperimental Rust Backend Opt-in
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In `@libs/cua-driver/scripts/install.sh`:
- Line 76: The command-line parsing for the --bin-dir case reads $2 unguarded
which can trigger an unbound-variable error; update the --bin-dir branch that
sets BIN_DIR and appends to FORWARDED_ARGS to first verify a following value
exists and is not another option (e.g., check that "$2" is non-empty and does
not start with '-') and if missing print a clear error/usage message and exit
non-zero, otherwise assign BIN_DIR="$2", append both args to FORWARDED_ARGS and
shift 2 as before.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9521cbb0-d109-4aef-8e3c-40fa16abbe07
📒 Files selected for processing (3)
README.mddocs/content/docs/cua-driver/guide/getting-started/installation.mdxlibs/cua-driver/scripts/install.sh
| printf 'error: unknown backend %q; supported: swift, rust\n' "${1#*=}" >&2 | ||
| exit 2 | ||
| ;; | ||
| --bin-dir) BIN_DIR="$2"; FORWARDED_ARGS+=("$1" "$2"); shift 2 ;; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify the current branch dereferences $2 without an arity guard.
rg -n -C2 -- '--bin-dir\)\s+BIN_DIR="\$2"' libs/cua-driver/scripts/install.sh
rg -n -- 'requires a path value|\$# -lt 2' libs/cua-driver/scripts/install.shRepository: trycua/cua
Length of output: 347
🏁 Script executed:
#!/bin/bash
# 1. Check for set -euo pipefail at the script start
head -20 libs/cua-driver/scripts/install.sh
# 2. View broader context around line 76 (lines 60-85)
sed -n '60,85p' libs/cua-driver/scripts/install.sh
# 3. Check if other flag arguments have similar guards
rg -n '\$\(# -' libs/cua-driver/scripts/install.sh | head -10Repository: trycua/cua
Length of output: 2310
🏁 Script executed:
#!/bin/bash
# Check for set -euo pipefail anywhere in the script
grep -n 'set -[eux]' libs/cua-driver/scripts/install.sh
# View the complete section after the case statement to see what happens next
sed -n '80,120p' libs/cua-driver/scripts/install.sh
# Check total line count
wc -l libs/cua-driver/scripts/install.shRepository: trycua/cua
Length of output: 2324
Add a missing-value guard for --bin-dir.
Line 76 reads $2 unconditionally; with set -u, --bin-dir without a value crashes with an unhelpful unbound-variable error instead of a user-friendly message.
Suggested fix
- --bin-dir) BIN_DIR="$2"; FORWARDED_ARGS+=("$1" "$2"); shift 2 ;;
+ --bin-dir)
+ if [[ $# -lt 2 ]]; then
+ printf 'error: --bin-dir requires a path value\n' >&2
+ exit 2
+ fi
+ BIN_DIR="$2"; FORWARDED_ARGS+=("$1" "$2"); shift 2
+ ;;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| --bin-dir) BIN_DIR="$2"; FORWARDED_ARGS+=("$1" "$2"); shift 2 ;; | |
| --bin-dir) | |
| if [[ $# -lt 2 ]]; then | |
| printf 'error: --bin-dir requires a path value\n' >&2 | |
| exit 2 | |
| fi | |
| BIN_DIR="$2"; FORWARDED_ARGS+=("$1" "$2"); shift 2 | |
| ;; |
🤖 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` at line 76, The command-line parsing for
the --bin-dir case reads $2 unguarded which can trigger an unbound-variable
error; update the --bin-dir branch that sets BIN_DIR and appends to
FORWARDED_ARGS to first verify a following value exists and is not another
option (e.g., check that "$2" is non-empty and does not start with '-') and if
missing print a clear error/usage message and exit non-zero, otherwise assign
BIN_DIR="$2", append both args to FORWARDED_ARGS and shift 2 as before.
|
Pushed fix for the |
Summary
--experimental-rust(and explicit alias--backend=rust) tolibs/cua-driver/scripts/install.sh. When set, the Swift install path is skipped entirely and the scriptexecs intolibs/cua-driver-rs/scripts/install.shwith--bin-dir/--no-modify-path(and anything after--) forwarded verbatim.--backend=swiftis accepted as an explicit no-op;--backend=<other>exits 2 with a clear error. Default behavior (no flag) is unchanged — the Swift binary is still whatcurl ... | bashinstalls.libs/cua-driver-rs/scripts/install.shwhen this script runs from a checked-out tree, otherwise curls the canonicalraw.githubusercontent.comURL — the latter is what end users hit when they run via the documented one-liner.installation.mdxcovering the install command, separate/Applications/CuaDriverRs.appbundle (com.trycua.cuadriverrs), TCC + telemetry isolation, and the "switch back" recipe. RootREADME.mdgets a one-line pointer next to the existing install line.Closes #1534.
Why not just edit the default
The cua-driver-rs port is approaching feature parity with the Swift binary but isn't there yet on macOS — we want a soak period where opt-in users surface remaining edge cases before we flip the switch. This PR adds the opt-in flag only; default install behavior is intentionally untouched and Hermes' upstream installer reference stays on Swift until GA.
Test plan
Syntax check (passes locally on macOS bash 3.2):
Flag-parsing smoke test (stub Rust installer that prints its argv):
End-to-end acceptance (run on a fresh macOS install before merge):
curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh | bashcurl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh | bash -s -- --experimental-rustls /Applications/CuaDriver*.app); each--versionreports independently.rm -rf /Applications/CuaDriverRs.app+ re-running the default installer restores the Swift symlink.Note: the
curl | bashpaths above only work after this PR lands onmain, since the experimental flag has to ship in the canonical installer URL before users can pass it.Summary by CodeRabbit
New Features
--experimental-rustflag during installation. Runs independently alongside the existing Swift version.Documentation