Skip to content

fix(cua-driver-rs)(install): _install-local-rust.sh uses the .cua-driver/ home (matches v0.2.16+ runtime) - #1711

Merged
f-trycua merged 1 commit into
mainfrom
fix/install-local-rust-home-dir
May 26, 2026
Merged

fix(cua-driver-rs)(install): _install-local-rust.sh uses the .cua-driver/ home (matches v0.2.16+ runtime)#1711
f-trycua merged 1 commit into
mainfrom
fix/install-local-rust-home-dir

Conversation

@f-trycua

@f-trycua f-trycua commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Picks up the home-dir rename that landed in v0.2.16 (PR #1644) but missed this Bash dev-installer helper. Before this fix, every ./install-local.sh on macOS/Linux re-created a stale ~/.cua-driver-rs/ directory parallel to the canonical ~/.cua-driver/. The Windows .ps1 and the production install.sh already had the rename.

Bug repro (before this fix)

$ ./install-local.sh
cua-driver-rs local installer
source:  /Users/francesco/cua/libs/cua-driver/rust
config:  debug
target:  arm64-apple-darwin
bin:     /Users/francesco/.local/bin/cua-driver
current: /Users/francesco/.cua-driver-rs/packages/current   ← old path!

What this fixes

  • HOME_DIR now defaults to ${CUA_DRIVER_HOME:-${CUA_DRIVER_RS_HOME:-$HOME/.cua-driver}}. The legacy CUA_DRIVER_RS_HOME env var is still accepted so any dev scripts that set it keep working.
  • Same backcompat layering for CUA_DRIVER_INSTALL_DIR / CUA_DRIVER_BIN_DIR (the _RS_ variants remain accepted as fallbacks).
  • macOS LaunchAgent label: com.trycua.cua-driver-rscom.trycua.cua-driver. Same .plist filename change.
  • Linux systemd user unit: cua-driver-rs.servicecua-driver.service.

Sweep blocks (legacy cleanup)

Three blocks remove the pre-rename artefacts so existing developers get a clean migration on first re-run:

  1. ~/.cua-driver-rs/ directory — unconditional sweep (only if HOME_DIR differs, so users with the env var set keep their override).
  2. Legacy LaunchAgent plist — unloaded + removed before the new plist is written, so the new label doesn't race the old one.
  3. Legacy systemd unit — disabled + removed before the new unit is written, same race-avoidance.

The runtime already sweeps the legacy home on first invocation (see telemetry.rs::migrate_legacy_telemetry_home + the LEGACY_HOME_SUBDIRECTORY constant introduced in PR #1644 / #1683) — this fix is belt-and-braces on the installer side.

Verification (after this fix, same machine)

$ ./install-local.sh
…
current: /Users/francesco/.cua-driver/packages/current     ← canonical path
…
Installed.
  /Users/francesco/.local/bin/cua-driver

$ ls -d ~/.cua-driver-rs                # → does not exist (swept)
$ ls -la ~/.cua-driver/packages/current # → symlink to ../releases/0.0.0-local-debug-arm64-apple-darwin
$ ~/.local/bin/cua-driver --version     # → cua-driver 0.2.18

What's intentionally NOT renamed

Strings that contain the verbatim "cua-driver-rs" as a project identifier (not a user-visible install path) were left alone:

  • The banner ${BOLD}${BLUE}cua-driver-rs local installer${NORMAL} — still the project / cargo workspace name
  • Skill-pack staging path Skills/cua-driver-rs — that's a directory inside the staged install, not a user home path; renaming that needs a separate coordinated change with _install-rust.sh and the cua-driver skills install runtime resolver

If you want those renamed too, that's a separate follow-up — this PR only fixes the user-visible install dirs and autostart unit names.

Test plan

  • bash -n libs/cua-driver/scripts/_install-local-rust.sh clean
  • Verified install on this Mac (arm64-apple-darwin) — install succeeds end-to-end, binary works, no ~/.cua-driver-rs/ left behind
  • Verify on Linux (Ubuntu 22.04 + Debian 12 VMs in the lab) — pending VM reachability
  • CodeRabbit pass

Why dev-only

This is _install-local-rust.sh, called from install-local.sh, which is the developer / checked-out-tree installer. The production install.sh (curl-pipe-bash) was already migrated to .cua-driver/ in PR #1644 — only this helper was overlooked.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Installation directory updated to use new canonical layout with automatic cleanup of legacy directories.
    • Autostart registration updated for macOS and Linux with automatic migration from legacy configurations.
    • Full backwards compatibility maintained for existing environment variables.

Review Change Stack

…ver/ home (matches v0.2.16+ runtime)

Picks up the home-dir rename that landed in v0.2.16 (PR #1644) but
missed this Bash dev-installer helper. Before this fix, every
`./install-local.sh` on macOS/Linux re-created a stale
`~/.cua-driver-rs/` directory parallel to the canonical
`~/.cua-driver/` (the runtime sweeps the legacy path on first call but
the local installer kept planting fresh copies).

Changes:

- `HOME_DIR` defaults to `${CUA_DRIVER_HOME:-${CUA_DRIVER_RS_HOME:-$HOME/.cua-driver}}`.
  The legacy `CUA_DRIVER_RS_HOME` env var is still accepted so any
  dev scripts that set it keep working.
- Same backcompat for `CUA_DRIVER_INSTALL_DIR` / `CUA_DRIVER_BIN_DIR`
  (the `_RS_` variants remain accepted as fallbacks).
- LaunchAgent label: `com.trycua.cua-driver-rs` →
  `com.trycua.cua-driver`. Same .plist filename change.
- systemd user unit: `cua-driver-rs.service` → `cua-driver.service`.

Plus three sweep blocks that delete the pre-rename artefacts:
  1. `~/.cua-driver-rs/` directory (unconditional, only if HOME_DIR
     differs — so users with the env var set keep their override).
  2. The legacy LaunchAgent plist (unloaded + removed before the new
     plist is written, so the new label doesn't race the old one).
  3. The legacy systemd unit (disabled + removed before the new unit
     is written, same race-avoidance).

The runtime already sweeps the legacy home on first invocation (see
telemetry.rs::migrate_legacy_telemetry_home + the LEGACY_HOME_SUBDIRECTORY
constant introduced in PR #1644 / #1683) so this fix is belt-and-braces
on the installer side. After this PR ships:
  - Existing developers re-running `./install-local.sh` get the legacy
    home dir cleaned up automatically.
  - New installs only ever plant the canonical `~/.cua-driver/`.

Tested locally on this Mac (arm64-apple-darwin):
  $ ls -d ~/.cua-driver-rs                # → does not exist (swept)
  $ ls -la ~/.cua-driver/packages/current  # → symlink to ../releases/0.0.0-local-debug-arm64-apple-darwin
  $ ~/.local/bin/cua-driver --version      # → cua-driver 0.2.18

Header comments / banner / staged-skills paths that contain the
verbatim string "cua-driver-rs" as a project identifier (not a path)
intentionally retained — that's still the cargo crate name + the
historical home subdir name in skill-pack staging. Only the *user-
visible install paths* changed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored May 26, 2026 12:28pm

Request Review

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8eca4a3c-b509-4c2c-a534-39c6aa330127

📥 Commits

Reviewing files that changed from the base of the PR and between 05c1543 and 5a31f5f.

📒 Files selected for processing (1)
  • libs/cua-driver/scripts/_install-local-rust.sh

📝 Walkthrough

Walkthrough

The local Rust installer script is updated to migrate from legacy cua-driver-rs naming to the canonical cua-driver layout. Environment variables, path resolution, and platform-specific autostart registrations (macOS LaunchAgent and Linux systemd) are moved to new names, with backwards compatibility and pre-migration cleanup of legacy artifacts.

Changes

Local installer autostart naming and path migration

Layer / File(s) Summary
Environment variable documentation and path resolution
libs/cua-driver/scripts/_install-local-rust.sh
Documentation updated to canonical CUA_DRIVER_HOME/CUA_DRIVER_INSTALL_DIR with explicit legacy fallback support. Path resolution prefers canonical env vars, chains through legacy CUA_DRIVER_RS_*, and performs best-effort cleanup sweep to remove stale ~/.cua-driver-rs/ directory.
macOS LaunchAgent autostart migration
libs/cua-driver/scripts/_install-local-rust.sh
macOS autostart switches from legacy com.trycua.cua-driver-rs to new com.trycua.cua-driver label. Script unloads and removes legacy plist before writing new plist configuration.
Linux systemd autostart migration and activation
libs/cua-driver/scripts/_install-local-rust.sh
Linux autostart switches from cua-driver-rs.service to cua-driver.service. Script disables and removes legacy unit before writing new unit. New service is then enabled, started, and management hint is updated to reference the new service name.

Possibly related PRs

  • trycua/cua#1655: Updates local installer scripts to migrate from cua-driver-rs naming to canonical cua-driver layout with legacy cleanup and unit/plist registration handling.
  • trycua/cua#1683: Implements complementary migration away from legacy ~/.cua-driver-rs/ to ~/.cua-driver/ with best-effort cleanup of legacy state in Rust code.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A hop, a skip, through paths refined,
From -rs to fresh, no more we're behind!
Old agents retire, systemd takes flight,
Backwards we keep, forwards we're right!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/install-local-rust-home-dir

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@f-trycua
f-trycua marked this pull request as ready for review May 26, 2026 12:33
@f-trycua
f-trycua merged commit 9e1acf0 into main May 26, 2026
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant