Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(install): --select installs only what you picked (CUA-2277) (#5930)

cua-agents[bot]8a3c9b464b19
diff --git a/scripts/install/README.md b/scripts/install/README.md
index 6d026c28e9..96c59e7cfa 100644
--- a/scripts/install/README.md
+++ b/scripts/install/README.md
@@ -26,7 +26,7 @@ In a terminal, install.sh first says what Cua Spaces is, then lists what to add
The Cua Spaces app registers the cua-driver skill and MCP server with your agents in its first run, but it does not install or update the Cua Driver program yet (CUA-1440). Until it does, the `cua-driver` item is how the installer puts Cua Driver on this computer.
```sh
-curl -fsSL https://cua.ai/install.sh | sh -s -- --select cua-driver # checklist with cua-driver ticked
+curl -fsSL https://cua.ai/install.sh | sh -s -- --select cua-driver # Cua Driver and the CLI only: no app, no Cua MCP server or skills
curl -fsSL https://cua.ai/install.sh | sh -s -- --only cua-driver,host # no checklist
```
@@ -36,7 +36,7 @@ For cua-driver, `--prefix DIR` becomes `--bin-dir DIR/bin`, `--require-signature
| install.sh | install.ps1 | Effect |
|---|---|---|
-| `--select a,b` | `-Select a,b` | Preselect items (`spaces`, `cua-driver`, `host`); the list still shows |
+| `--select a,b` | `-Select a,b` | Install these items (`spaces`, `cua-driver`, `host`) plus the CLI; the app is not added unless listed. The list still shows |
| `--only a,b` | `-Only a,b` | Exactly these items plus the CLI, no checklist |
| `--cli-only` | `-CliOnly` | Only the `cua` CLI (same as `--only cli`) |
| `--app-only` | `-AppOnly` | Only the Cua Spaces app, no CLI (cannot be combined with `cua-driver` or `host`) |
diff --git a/scripts/install/install.ps1 b/scripts/install/install.ps1
index 375ddb5306..eec7422fc9 100644
--- a/scripts/install/install.ps1
+++ b/scripts/install/install.ps1
@@ -345,9 +345,9 @@ function Get-CuaSelection {
if ($App -and ($extra -contains 'cua-driver' -or $extra -contains 'host')) { Stop-Install '-AppOnly skips the CLI, which cua-driver and host need' }
$sel = [ordered]@{ cli = -not $App; spaces = $false; 'cua-driver' = $false; host = $false }
$list = if ($OnlyList -or $Cli) { $OnlyList } else { $SelectList }
- # The app is a default, as on macOS and Linux (not with -Only, -CliOnly
- # or a pairing code, which adds a host machine).
- if (-not ($OnlyList -or $Cli -or $Pair)) { $sel.spaces = $true }
+ # The app is a default, as on macOS and Linux (not with -Only, -CliOnly,
+ # -Select naming items, or a pairing code, which adds a host machine).
+ if (-not ($OnlyList -or $Cli -or $Pair -or "$SelectList".Trim(' ', ',', "`t"))) { $sel.spaces = $true }
foreach ($item in @(ConvertTo-CuaItems $list)) { $sel[$item] = $true }
# A pairing code adds this machine: the CLI and host setup.
if ($Pair) {
@@ -913,7 +913,9 @@ function Invoke-CuaInstallSteps($sel) {
$script:TelStage = 'driver'
if ($sel['cua-driver']) { Install-CuaDriver $cua $tmp $manifestUrl }
$script:TelStage = 'sign_in'
- if ($cua -and -not $Pair -and -not $CliOnly -and -not $NoOnboarding -and -not $DryRun -and (Test-Interactive)) {
+ # Cua Driver on its own: sign-in would run the Cua Spaces agent onboarding, which was not picked.
+ $driverOnly = $sel['cua-driver'] -and -not $sel.spaces -and -not $sel.host
+ if ($cua -and -not $Pair -and -not $CliOnly -and -not $NoOnboarding -and -not $DryRun -and -not $driverOnly -and (Test-Interactive)) {
Write-Host ''
Write-Step 'Signing in to Cua'
& $cua auth login
diff --git a/scripts/install/install.sh b/scripts/install/install.sh
index cea8e581d5..a2133058a6 100755
--- a/scripts/install/install.sh
+++ b/scripts/install/install.sh
@@ -19,7 +19,8 @@
# your other devices use this computer through the relay.
#
# Options:
-# --select LIST preselect items (comma list: spaces, cua-driver, host)
+# --select LIST install these items plus the CLI, not the app unless
+# listed (comma list: spaces, cua-driver, host)
# --only LIST install exactly LIST plus the CLI, no checklist
# --cli-only install only the `cua` CLI (same as --only cli)
# --app-only install only the Cua Spaces app (no CLI)
@@ -580,8 +581,10 @@ init_selection() {
list="$only_list"
else
list="$select_list"
- # The app is a default on macOS and Linux.
- if spaces_supported; then sel_spaces=1; fi
+ # The app is a default on macOS and Linux, until --select names what
+ # to install: then only those items (and the CLI) are installed.
+ # --pair adds host to the list itself; it keeps the default.
+ if spaces_supported && { [ -n "$pair_code" ] || [ -z "$(printf %s "$list" | tr -d ', ')" ]; }; then sel_spaces=1; fi
fi
for item in $(items_in "$list"); do item_set "$item" 1; done
# Legacy: --app-only and --mode mean the app, as they always did.
@@ -1465,12 +1468,28 @@ summary() {
fi
}
+# The items this run installs, for --dry-run.
+plan_items() {
+ out=""
+ [ "$want_cli" != 1 ] || out="the cua command-line tools"
+ [ "$sel_spaces" != 1 ] || out="${out:+$out, }the Cua Spaces app"
+ [ "$sel_driver" != 1 ] || out="${out:+$out, }Cua Driver (its MCP server and skill in your agents)"
+ [ "$sel_host" != 1 ] || out="${out:+$out, }host setup"
+ printf '%s\n' "${out:-nothing}"
+}
+
run_onboarding() {
# --pair: the code stands in for the account; nothing to sign in to.
[ -z "$pair_code" ] || return 0
if [ "$want_cli" = 0 ] || [ "$onboarding" = 0 ] || [ "$dry_run" = 1 ]; then
return
fi
+ # Cua Driver on its own: `cua auth login` would end in the Cua Spaces
+ # agent onboarding (the cua MCP server and skills), which was not picked.
+ if [ "$sel_driver" = 1 ] && [ "$sel_spaces" = 0 ] && [ "$sel_host" = 0 ]; then
+ info "skipping sign-in: only Cua Driver was selected"
+ return
+ fi
# No terminal to sign in on (piped install, -y, or nobody at the
# console over ssh): `cua auth login` needs one, so the summary says
# how to finish instead.
@@ -1499,6 +1518,7 @@ main() {
fi
if [ "$dry_run" = 1 ]; then
step "Dry run: nothing will be changed"
+ say "[dry-run] would install: $(plan_items)"
fi
# Nothing to download (--pair on a computer that has Cua): no manifest to read.
if [ "$want_cli" = 1 ] || [ "$sel_spaces" = 1 ] || [ "$sel_driver" = 1 ]; then
diff --git a/scripts/install/tests/run.sh b/scripts/install/tests/run.sh
index b5aa7fc548..dca2936771 100755
--- a/scripts/install/tests/run.sh
+++ b/scripts/install/tests/run.sh
@@ -267,6 +267,14 @@ if command -v bash >/dev/null 2>&1; then
check "--select cua-driver: registers the skill and MCP server" sh -c "grep -qx -- 'agents setup --cua-driver --agents all --yes --mcp-command $work/d1/bin/cua-driver' '$home/cua.log'"
check "--select cua-driver: no host setup" sh -c "! grep -q 'host setup' '$home/cua.log'"
check "--select cua-driver: adds the skill by default (no --no-skills)" sh -c "! grep -q -- '--no-skills' '$home/cua.log'"
+ check "--select cua-driver: does not install the Cua Spaces app" sh -c "[ ! -e '$work/d1/bin/cua-spaces' ] && ! grep -q 'Cua Spaces' '$work/out'"
+ check "--select cua-driver: registers nothing but cua-driver" sh -c "grep -c 'agents setup' '$home/cua.log' | grep -qx 1 && ! grep -q 'auth login' '$home/cua.log'"
+
+ inst -- --yes --no-onboarding --select cli --prefix "$work/d1c"
+ check "--select cli: CLI only, no app" sh -c "[ $status = 0 ] && [ -x '$work/d1c/bin/cua' ] && [ ! -e '$work/d1c/bin/cua-spaces' ]"
+
+ inst CUA_INSTALL_DRIVER_URL="$driver_url" -- --yes --no-onboarding --select cua-driver,spaces --prefix "$work/d1b"
+ check "--select cua-driver,spaces: installs both" sh -c "[ $status = 0 ] && [ -x '$work/d1b/bin/cua-spaces' ] && [ -x '$work/d1b/bin/cua-driver' ]"
inst CUA_INSTALL_DRIVER_URL="$driver_url" -- --no-onboarding --select cua-driver --no-skills --prefix "$work/d1s"
check "--no-skills: still registers the MCP server, without the skill" sh -c "[ $status = 0 ] && grep -qx -- 'agents setup --cua-driver --agents all --yes --no-skills --mcp-command $work/d1s/bin/cua-driver' '$home/cua.log'"
@@ -315,6 +323,11 @@ inst CUA_INSTALL_DRIVER_URL="$driver_url" -- --dry-run --select cua-driver,host
check "--dry-run prints the driver, agents and host steps" sh -c "grep -q 'dry-run. download $driver_url' '$work/out' && grep -q 'dry-run. bash cua-driver-install.sh --bin-dir' '$work/out' && grep -q 'dry-run. .* agents setup --cua-driver --agents all --yes' '$work/out' && grep -q 'dry-run. .* host setup' '$work/out'"
inst CUA_INSTALL_DRIVER_URL="$driver_url" -- --dry-run --select cua-driver --no-skills --prefix "$work/drs"
check "--dry-run --no-skills: the planned agent setup leaves the skill out" sh -c "grep -q 'dry-run. .* agents setup --cua-driver --agents all --yes --no-skills' '$work/out'"
+check "--dry-run --select cua-driver: lists only the CLI and Cua Driver" sh -c "grep -q 'dry-run. would install: the cua command-line tools, Cua Driver' '$work/out' && ! grep -q 'Cua Spaces app' '$work/out'"
+inst CUA_INSTALL_OS=Darwin CUA_INSTALL_DRIVER_URL="$driver_url" -- --dry-run --select cua-driver --prefix "$work/drm"
+check "--dry-run --select cua-driver (macOS): no app download" sh -c "[ $status = 0 ] && ! grep -q 'darwin-universal.dmg' '$work/out' && grep -q 'agents setup --cua-driver' '$work/out'"
+inst -- --dry-run --prefix "$work/drd"
+check "--dry-run with no --select: the app is still a default" sh -c "grep -q 'dry-run. would install: .*Cua Spaces app' '$work/out'"
check "--dry-run runs nothing" sh -c "[ ! -e '$home/cua.log' ] && [ ! -e '$home/driver.log' ] && [ ! -e '$work/dr' ]"
inst -- --yes --select bogus
@@ -602,6 +615,11 @@ if script --version 2>/dev/null | grep -q util-linux; then
script -qec "$sh_bin '$installer' --yes --cli-only --no-onboarding --prefix '$work/p14'" /dev/null >"$work/out" 2>&1 </dev/null
check "interactive + --no-onboarding: no login" sh -c "! grep -qx 'auth login' '$home/cua2.log' 2>/dev/null"
+ env -i PATH="$PATH" HOME="$home" SHELL=/bin/sh CUA_INSTALL_BASE_URL="$base" CUA_INSTALL_OS=linux \
+ CUA_INSTALL_ARCH=x86_64 CUA_FAKE_LOG="$home/cua3.log" CUA_INSTALL_DRIVER_URL="$driver_url" \
+ script -qec "$sh_bin '$installer' --yes --select cua-driver --prefix '$work/p15'" /dev/null >"$work/out" 2>&1 </dev/null
+ check "interactive + --select cua-driver: no sign-in, so no Cua MCP or skills" sh -c "! grep -qx 'auth login' '$home/cua3.log' 2>/dev/null && grep -q 'agents setup --cua-driver' '$home/cua3.log'"
+
# PATH prompt on a terminal: Enter adds it to the profile, n leaves it.
# `script` runs its command through $SHELL, so zsh (absent from the CI
# containers) is only set inside the command, never as the outer shell.