[codex] docs(cua-driver): pivot to rust-first driver - #1738
Conversation
|
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:
📝 WalkthroughWalkthroughInstaller scripts, Rust code, CI/CD workflow, and documentation generation pipeline are updated to make the Rust implementation of cua-driver the canonical default on macOS, Linux, and Windows. Legacy Swift paths are retired, explicit backend flags are removed, BETA warnings are eliminated, and all user-facing guides and reference docs are regenerated from the Rust binary. ChangesRust Implementation as Default across All Platforms
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 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: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
libs/cua-driver/scripts/uninstall.sh (1)
273-297:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGuard skill symlink deletion behind Rust-install detection.
This loop can delete Swift-owned
.../skills/cua-driverlinks even whenRUST_INSTALL_PRESENT=0(Swift-only host running default uninstall path). Apply the same Rust-marker guard used for shared app/symlink paths.Suggested fix
- for SKILL_LINK in \ + for SKILL_LINK in \ "$HOME/.claude/skills/$SKILL_PACK_NAME" \ "$HOME/.agents/skills/$SKILL_PACK_NAME" \ "$HOME/.openclaw/skills/$SKILL_PACK_NAME" \ "$HOME/.config/opencode/skills/$SKILL_PACK_NAME" \ "$HOME/.claude/skills/$LEGACY_SKILL_PACK_NAME" \ "$HOME/.agents/skills/$LEGACY_SKILL_PACK_NAME" \ "$HOME/.openclaw/skills/$LEGACY_SKILL_PACK_NAME" \ "$HOME/.config/opencode/skills/$LEGACY_SKILL_PACK_NAME"; do + # `cua-driver` skill link name is shared with the legacy Swift path. + # Only remove shared-name links when a Rust install marker exists. + if [[ "$SKILL_LINK" == *"/$SKILL_PACK_NAME" ]] && [[ "$RUST_INSTALL_PRESENT" != "1" ]]; then + log "$SKILL_LINK uses shared skill name and no Rust marker is present (skipping)" + continue + fi if [[ -L "$SKILL_LINK" ]]; then rm -f "$SKILL_LINK" log "removed skill symlink $SKILL_LINK"🤖 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/uninstall.sh` around lines 273 - 297, The skill-symlink removal loop (iterating SKILL_LINKs built from SKILL_PACK_NAME and LEGACY_SKILL_PACK_NAME) must be executed only when the Rust install marker is present; wrap that entire for-loop in the same Rust-install guard used elsewhere by checking RUST_INSTALL_PRESENT (e.g., if [[ "$RUST_INSTALL_PRESENT" -ne 0 ]] or if [[ "$RUST_INSTALL_PRESENT" == "1" ]]; then ... fi) so the loop runs only when Rust was installed and does not remove Swift-owned skill symlinks on Swift-only hosts.docs/content/docs/cua-driver/guide/getting-started/linux.mdx (1)
83-86:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFix the broken
install-local.shGitHub link (CI is failing on this 404).The URL points to
libs/cua-driver/rust/scripts/install-local.sh, which currently resolves to 404 in link-check CI. Update it to the non-rust/scripts path.Suggested doc fix
-See [`libs/cua-driver/rust/scripts/install-local.sh`](https://github.com/trycua/cua/blob/main/libs/cua-driver/rust/scripts/install-local.sh) — built for local development off a git checkout, but the systemd unit it writes is the same shape you'd use in production. +See [`libs/cua-driver/scripts/install-local.sh`](https://github.com/trycua/cua/blob/main/libs/cua-driver/scripts/install-local.sh) — built for local development off a git checkout, but the systemd unit it writes is the same shape you'd use in production.🤖 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 `@docs/content/docs/cua-driver/guide/getting-started/linux.mdx` around lines 83 - 86, The markdown link in docs/content/docs/cua-driver/guide/getting-started/linux.mdx points to a 404 path `libs/cua-driver/rust/scripts/install-local.sh`; update that href to the correct non-`rust` scripts path (e.g. `libs/cua-driver/scripts/install-local.sh`) so the anchor in the "Option A — Use `install-local.sh --autostart`" paragraph points to the existing script; edit the link text in that paragraph to match the new URL.docs/content/docs/cua-driver/guide/getting-started/process-model.mdx (1)
129-133:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRemove or replace the dead
trycua/hermesPR link (404 in docs CI).This external PR URL currently fails link checks. Please switch to a non-link reference (or a reachable public URL) to keep CI green.
Suggested doc fix
-The MCP client surfaces this as a tool error. The mcp-client process **does not** auto-restart the daemon mid-session. The recommended client behavior is: catch the error, optionally restart the daemon yourself (`open -n -g -a CuaDriver --args serve`), reconnect the MCP transport, and retry. Hermes' wrapper in [trycua/hermes#22821](https://github.com/trycua/hermes/pull/22821) implements exactly this pattern. +The MCP client surfaces this as a tool error. The mcp-client process **does not** auto-restart the daemon mid-session. The recommended client behavior is: catch the error, optionally restart the daemon yourself (`open -n -g -a CuaDriver --args serve`), reconnect the MCP transport, and retry. Hermes' wrapper (trycua/hermes PR `#22821`) implements exactly this pattern.🤖 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 `@docs/content/docs/cua-driver/guide/getting-started/process-model.mdx` around lines 129 - 133, Replace the dead external PR link used in the sentence "Hermes' wrapper in [trycua/hermes#22821](https://github.com/trycua/hermes/pull/22821) implements exactly this pattern." with a non-link reference or a reachable URL: update the text to either "Hermes' wrapper in trycua/hermes#22821 implements exactly this pattern." (plain text reference) or point to an accessible public resource demonstrating the same behavior, ensuring the token "trycua/hermes#22821" in the sentence is preserved so readers can locate the PR if needed.
🤖 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 `@docs/content/docs/cua-driver/guide/getting-started/installation.mdx`:
- Around line 202-205: Update the Windows lockfile path to use the same
canonical home variable as the Linux row: replace the legacy `.cua-driver-rs`
usage with the `$CUA_DRIVER_RS_HOME` variable and change the Windows example
string `$env:CUA_DRIVER_RS_HOME\install.lock` (or any occurrence of
`.cua-driver-rs`) so it consistently reads `$CUA_DRIVER_RS_HOME\install.lock`
(preserve the PowerShell `$env:` prefix if needed) in the table row text.
In `@libs/cua-driver/rust/crates/cua-driver/src/cli.rs`:
- Around line 1568-1574: cli_docs_json() currently advertises a "record-video"
flag for the "recording start" command, but the CLI parser/handler does not
accept or use this flag; either remove the "record-video" entry from the JSON
generation in cli_docs_json() or implement support for the flag in the parser
and handler for the recording start command (e.g., add a boolean option parsed
into the start handling path and propagate it to the recording logic). Locate
the JSON generation in cli_docs_json() and the "recording start" command handler
to make the change so documentation and runtime behavior stay in sync.
In `@libs/cua-driver/rust/crates/cua-driver/src/version_check.rs`:
- Line 157: version_check.rs currently builds the install one-liner string
without forcing the Rust backend; update the code that constructs the
install_command string (the variable/assignment that currently is "curl -fsSL
https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh
| bash".to_owned()) to detect macOS (e.g. cfg!(target_os = "macos") or
std::env::consts::OS == "macos") and, when true, append " --backend=rust" (or
add the flag into the piped command) so the installer will install the Rust
backend on macOS while leaving non-macOS behavior unchanged. Ensure the result
remains an owned String and update any tests or usages that rely on
install_command if needed.
In `@scripts/docs-generators/cua-driver.ts`:
- Around line 109-131: resolveCargoCommand currently reads HOME from process.env
which can be undefined on Windows; import and use Node's os.homedir() to
reliably get the user's home across platforms. Add an import for the os module
(or homedir) at the top of the file and change the candidate that builds the
~/.cargo path to use os.homedir() (falling back to '' if necessary) instead of
process.env.HOME; keep the rest of the candidate list and the execFileSync check
intact so cargo discovery still tries the same locations.
---
Outside diff comments:
In `@docs/content/docs/cua-driver/guide/getting-started/linux.mdx`:
- Around line 83-86: The markdown link in
docs/content/docs/cua-driver/guide/getting-started/linux.mdx points to a 404
path `libs/cua-driver/rust/scripts/install-local.sh`; update that href to the
correct non-`rust` scripts path (e.g.
`libs/cua-driver/scripts/install-local.sh`) so the anchor in the "Option A — Use
`install-local.sh --autostart`" paragraph points to the existing script; edit
the link text in that paragraph to match the new URL.
In `@docs/content/docs/cua-driver/guide/getting-started/process-model.mdx`:
- Around line 129-133: Replace the dead external PR link used in the sentence
"Hermes' wrapper in
[trycua/hermes#22821](https://github.com/trycua/hermes/pull/22821) implements
exactly this pattern." with a non-link reference or a reachable URL: update the
text to either "Hermes' wrapper in trycua/hermes#22821 implements exactly this
pattern." (plain text reference) or point to an accessible public resource
demonstrating the same behavior, ensuring the token "trycua/hermes#22821" in the
sentence is preserved so readers can locate the PR if needed.
In `@libs/cua-driver/scripts/uninstall.sh`:
- Around line 273-297: The skill-symlink removal loop (iterating SKILL_LINKs
built from SKILL_PACK_NAME and LEGACY_SKILL_PACK_NAME) must be executed only
when the Rust install marker is present; wrap that entire for-loop in the same
Rust-install guard used elsewhere by checking RUST_INSTALL_PRESENT (e.g., if [[
"$RUST_INSTALL_PRESENT" -ne 0 ]] or if [[ "$RUST_INSTALL_PRESENT" == "1" ]];
then ... fi) so the loop runs only when Rust was installed and does not remove
Swift-owned skill symlinks on Swift-only hosts.
🪄 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: 5a0c0981-9f9a-4498-8c02-255b0bdcb04e
📒 Files selected for processing (28)
.github/workflows/cd-rust-cua-driver.yml.github/workflows/ci-check-docs.ymlREADME.mddocs/content/docs/cua-driver/guide/getting-started/installation.mdxdocs/content/docs/cua-driver/guide/getting-started/introduction.mdxdocs/content/docs/cua-driver/guide/getting-started/linux.mdxdocs/content/docs/cua-driver/guide/getting-started/meta.jsondocs/content/docs/cua-driver/guide/getting-started/process-model.mdxdocs/content/docs/cua-driver/guide/getting-started/quickstart.mdxdocs/content/docs/cua-driver/guide/getting-started/swift-integration.mdxdocs/content/docs/cua-driver/guide/getting-started/updating.mdxdocs/content/docs/cua-driver/guide/getting-started/windows-ssh.mdxdocs/content/docs/cua-driver/reference/cli-reference.mdxdocs/content/docs/cua-driver/reference/mcp-tools.mdxdocs/content/docs/meta.jsondocs/src/components/custom-header.tsxlibs/cua-driver/rust/crates/cua-driver/src/cli.rslibs/cua-driver/rust/crates/cua-driver/src/updater.rslibs/cua-driver/rust/crates/cua-driver/src/version_check.rslibs/cua-driver/scripts/_install-rust.shlibs/cua-driver/scripts/install-local.shlibs/cua-driver/scripts/install.ps1libs/cua-driver/scripts/install.shlibs/cua-driver/scripts/post-install-hints.txtlibs/cua-driver/scripts/uninstall.shscripts/docs-generators/README.mdscripts/docs-generators/config.jsonscripts/docs-generators/cua-driver.ts
💤 Files with no reviewable changes (1)
- docs/content/docs/cua-driver/guide/getting-started/swift-integration.mdx
| | Platform | Lock | | ||
| | -------- | ------------------------------------------------------------------- | | ||
| | Linux | `$CUA_DRIVER_RS_HOME/packages/.install.lock.d/` (mkdir-based mutex) | | ||
| | Windows | `$env:CUA_DRIVER_RS_HOME\install.lock` (`FileShare::None` mutex) | |
There was a problem hiding this comment.
Align Windows lockfile path with the documented home variable.
This section says the lock is at $env:CUA_DRIVER_RS_HOME\install.lock, but the example above still uses the legacy .cua-driver-rs path. Keeping one canonical path here avoids failed copy/paste checks.
Suggested doc fix
-Get-Content $env:USERPROFILE\.cua-driver-rs\install.lock
+Get-Content $env:CUA_DRIVER_RS_HOME\install.lock🤖 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 `@docs/content/docs/cua-driver/guide/getting-started/installation.mdx` around
lines 202 - 205, Update the Windows lockfile path to use the same canonical home
variable as the Linux row: replace the legacy `.cua-driver-rs` usage with the
`$CUA_DRIVER_RS_HOME` variable and change the Windows example string
`$env:CUA_DRIVER_RS_HOME\install.lock` (or any occurrence of `.cua-driver-rs`)
so it consistently reads `$CUA_DRIVER_RS_HOME\install.lock` (preserve the
PowerShell `$env:` prefix if needed) in the table row text.
| "name":"start", | ||
| "abstract":"Start trajectory recording to a directory.", | ||
| "discussion":"", | ||
| "arguments":[{"name":"output-dir","help":"Directory to write turn folders into.","type":"String","is_optional":false}], | ||
| "options":[], | ||
| "flags":[{"name":"record-video","short_name":null,"help":"Also record a video when supported by the platform.","default_value":false}], | ||
| "subcommands":[] |
There was a problem hiding this comment.
Remove or implement record-video in CLI docs JSON.
cli_docs_json() advertises recording start --record-video, but the parser/handler path doesn’t consume this flag, so generated reference docs are inaccurate.
Suggested fix (docs-first)
- "flags":[{"name":"record-video","short_name":null,"help":"Also record a video when supported by the platform.","default_value":false}],
+ "flags":[],🤖 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/rust/crates/cua-driver/src/cli.rs` around lines 1568 - 1574,
cli_docs_json() currently advertises a "record-video" flag for the "recording
start" command, but the CLI parser/handler does not accept or use this flag;
either remove the "record-video" entry from the JSON generation in
cli_docs_json() or implement support for the flag in the parser and handler for
the recording start command (e.g., add a boolean option parsed into the start
handling path and propagate it to the recording logic). Locate the JSON
generation in cli_docs_json() and the "recording start" command handler to make
the change so documentation and runtime behavior stay in sync.
| #[cfg(not(windows))] | ||
| { | ||
| "curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh | bash -s -- install --backend=rust".to_owned() | ||
| "curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh | bash".to_owned() |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify install.sh defaults to Rust backend and accepts no arguments.
# Fetch and inspect the install.sh script
curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh > /tmp/install.sh
# Check what happens when no arguments are provided
echo "=== Checking install.sh argument parsing ==="
rg -n "backend.*=.*rust|DEFAULT.*BACKEND|BACKEND.*=" /tmp/install.sh | head -20
# Check if script still accepts --backend flag for legacy Swift path
echo ""
echo "=== Checking --backend flag support ==="
rg -n "\-\-backend" /tmp/install.sh | head -10
# Check the main install logic
echo ""
echo "=== Checking main install dispatch ==="
rg -nA5 "case.*backend|if.*backend" /tmp/install.sh | head -30Repository: trycua/cua
Length of output: 1316
🏁 Script executed:
#!/bin/bash
set -euo pipefail
curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh > /tmp/install.sh
echo "=== Showing USE_RUST_BACKEND initialization & auto-set logic ==="
nl -ba /tmp/install.sh | sed -n '50,140p'
echo ""
echo "=== Showing the install dispatch when USE_RUST_BACKEND==1 ==="
nl -ba /tmp/install.sh | sed -n '140,240p'
echo ""
echo "=== Showing any mention of Swift install path when USE_RUST_BACKEND==0 ==="
rg -n "swift|SWIFT|rust|RUST|USE_RUST_BACKEND" /tmp/install.sh | head -80Repository: trycua/cua
Length of output: 180
🏁 Script executed:
#!/bin/bash
set -euo pipefail
curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh > /tmp/install.sh
echo "=== USE_RUST_BACKEND initialization & auto-set logic (lines ~50-140) ==="
awk '{print FNR ":" $0}' /tmp/install.sh | sed -n '50,140p'
echo ""
echo "=== Install dispatch when USE_RUST_BACKEND==1 (lines ~140-260) ==="
awk '{print FNR ":" $0}' /tmp/install.sh | sed -n '140,260p'
echo ""
echo "=== Swift/rust install path mentions ==="
rg -n "swift|SWIFT|rust|RUST|USE_RUST_BACKEND" /tmp/install.sh | head -80Repository: trycua/cua
Length of output: 12556
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="libs/cua-driver/rust/crates/cua-driver/src/version_check.rs"
echo "=== Context around $FILE:157 ==="
awk 'NR>=130 && NR<=190 {printf "%5d: %s\n", NR, $0}' "$FILE"
echo ""
echo "=== Find where the install command string is constructed/used ==="
rg -n "install\\.sh \\| bash|curl -fsSL https://raw\\.githubusercontent\\.com/trycua/cua/main/libs/cua-driver/scripts/install\\.sh \\| bash" "$FILE"
echo ""
echo "=== Find other references to check-update / MCP tool usage in this crate ==="
rg -n "check-update|MCP|mcp" libs/cua-driver/rust/crates/cua-driver/src | head -50Repository: trycua/cua
Length of output: 9539
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n "install_command|install_one_liner|check_update_state|check_for_update" libs/cua-driver/rust/crates/cua-driver/src/version_check.rs libs/cua-driver/rust/crates/cua-driver/src | head -100
echo "=== Find dispatch/serialization in version_check.rs ==="
rg -n "install_command" libs/cua-driver/rust/crates/cua-driver/src/version_check.rsRepository: trycua/cua
Length of output: 4434
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="libs/cua-driver/rust/crates/cua-driver/src/version_check.rs"
echo "=== version_check.rs around install_one_liner + UpdateState population ==="
awk 'NR>=140 && NR<=270 {printf "%5d: %s\n", NR, $0}' "$FILE"
echo ""
FILE2="libs/cua-driver/rust/crates/cua-driver/src/updater.rs"
echo "=== updater.rs manual_install_one_liner ==="
awk 'NR>=1 && NR<=140 {printf "%5d: %s\n", NR, $0}' "$FILE2"
echo ""
echo "=== Any docs mentioning what install_command is supposed to do ==="
rg -n "install_command|manual_install_one_liner|install\\.sh \\| bash" libs/cua-driver/rust/crates/cua-driver/src | head -100Repository: trycua/cua
Length of output: 12007
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n "cua-driver-rs|backend=rust|experimental-rust|_install-rust|cua-driver is macOS-only" libs/cua-driver/rust/crates/cua-driver/src | head -200
echo ""
rg -n "check_for_update|check-update|install_command|manual_install_one_liner" libs/cua-driver/rust/crates/cua-driver/src | head -200Repository: trycua/cua
Length of output: 16246
Fix update install one-liner to force Rust backend on macOS
version_check.rs emits curl …/install.sh | bash without --backend=rust. But install.sh defaults to the Swift install path on macOS; it only installs the Rust port when --backend=rust/--experimental-rust is passed (or auto-selects Rust on non-macOS). Since this Rust crate is tracking cua-driver-rs-v* releases, the install_command should append --backend=rust on macOS to match the backend/version being offered.
🤖 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/rust/crates/cua-driver/src/version_check.rs` at line 157,
version_check.rs currently builds the install one-liner string without forcing
the Rust backend; update the code that constructs the install_command string
(the variable/assignment that currently is "curl -fsSL
https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh
| bash".to_owned()) to detect macOS (e.g. cfg!(target_os = "macos") or
std::env::consts::OS == "macos") and, when true, append " --backend=rust" (or
add the flag into the piped command) so the installer will install the Rust
backend on macOS while leaving non-macOS behavior unchanged. Ensure the result
remains an owned String and update any tests or usages that rely on
install_command if needed.
| function resolveCargoCommand(): string { | ||
| if (process.env.CARGO) { | ||
| return process.env.CARGO; | ||
| } | ||
|
|
||
| const candidates = [ | ||
| 'cargo', | ||
| path.join(process.env.HOME || '', '.cargo', 'bin', 'cargo'), | ||
| '/opt/homebrew/bin/cargo', | ||
| '/usr/local/bin/cargo', | ||
| ]; | ||
|
|
||
| for (const candidate of candidates) { | ||
| try { | ||
| execFileSync(candidate, ['--version'], { stdio: 'ignore' }); | ||
| return candidate; | ||
| } catch { | ||
| // Try the next candidate. | ||
| } | ||
| } | ||
|
|
||
| throw new Error('cargo not found on PATH; install Rust or set CARGO=/path/to/cargo'); | ||
| } |
There was a problem hiding this comment.
Cross-platform HOME directory resolution issue.
process.env.HOME may be undefined on Windows, which would silently skip the ~/.cargo/bin/cargo candidate and potentially cause cargo discovery to fail on Windows systems where cargo is only in the user profile.
🔧 Proposed fix using Node.js os.homedir()
Add the import at the top of the file:
import { execFileSync, execSync } from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
+import * as os from 'os';Then update the function:
function resolveCargoCommand(): string {
if (process.env.CARGO) {
return process.env.CARGO;
}
const candidates = [
'cargo',
- path.join(process.env.HOME || '', '.cargo', 'bin', 'cargo'),
+ path.join(os.homedir(), '.cargo', 'bin', 'cargo'),
'/opt/homebrew/bin/cargo',
'/usr/local/bin/cargo',
];📝 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.
| function resolveCargoCommand(): string { | |
| if (process.env.CARGO) { | |
| return process.env.CARGO; | |
| } | |
| const candidates = [ | |
| 'cargo', | |
| path.join(process.env.HOME || '', '.cargo', 'bin', 'cargo'), | |
| '/opt/homebrew/bin/cargo', | |
| '/usr/local/bin/cargo', | |
| ]; | |
| for (const candidate of candidates) { | |
| try { | |
| execFileSync(candidate, ['--version'], { stdio: 'ignore' }); | |
| return candidate; | |
| } catch { | |
| // Try the next candidate. | |
| } | |
| } | |
| throw new Error('cargo not found on PATH; install Rust or set CARGO=/path/to/cargo'); | |
| } | |
| function resolveCargoCommand(): string { | |
| if (process.env.CARGO) { | |
| return process.env.CARGO; | |
| } | |
| const candidates = [ | |
| 'cargo', | |
| path.join(os.homedir(), '.cargo', 'bin', 'cargo'), | |
| '/opt/homebrew/bin/cargo', | |
| '/usr/local/bin/cargo', | |
| ]; | |
| for (const candidate of candidates) { | |
| try { | |
| execFileSync(candidate, ['--version'], { stdio: 'ignore' }); | |
| return candidate; | |
| } catch { | |
| // Try the next candidate. | |
| } | |
| } | |
| throw new Error('cargo not found on PATH; install Rust or set CARGO=/path/to/cargo'); | |
| } |
🤖 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 `@scripts/docs-generators/cua-driver.ts` around lines 109 - 131,
resolveCargoCommand currently reads HOME from process.env which can be undefined
on Windows; import and use Node's os.homedir() to reliably get the user's home
across platforms. Add an import for the os module (or homedir) at the top of the
file and change the candidate that builds the ~/.cargo path to use os.homedir()
(falling back to '' if necessary) instead of process.env.HOME; keep the rest of
the candidate list and the execFileSync check intact so cargo discovery still
tries the same locations.
ebcdc9d to
4588aa9
Compare
…apps (#1754) Closes #1537. Cherry-picked from #1609 (@hippoley) — same fix concept, ported to the post-#1674 path layout (`libs/cua-driver/rust/crates/`) and dropped the Swift backend change (path being deprecated per #1738). - `ax/tree.rs`: `MAX_ELEMENTS = 2000` cap with `TreeWalkResult.truncated` surfaced as a warning line at the end of `tree_markdown`. - `tools/get_window_state.rs`: `tokio::time::timeout(30s)` wrap on the `spawn_blocking` AX walk. On expiry returns a clear error suggesting `capture_mode=vision` or a `query` filter rather than hanging forever. Reported by @obaid against Arc / Safari w/ many tabs on macOS 26 where `AXUIElementCopyAttributeValue` blocks indefinitely via XPC on pathologically large trees. Co-authored-by: hippoley <noreply@github.com>
Summary
--backend=swiftas the explicit legacy macOS path.cua-driver dump-docsoutput and update docs CI to watch/build the Rust source.Safety / Scope
.claude/,.gumbranch/,docs/pnpm-workspace.yaml,drafts/, and the pre-existingdocs/pnpm-lock.yamlmodification.Validation
/Users/francesco/.cargo/bin/cargo build -p cua-driver --releaseCARGO=/Users/francesco/.cargo/bin/cargo pnpm exec tsx ../scripts/docs-generators/cua-driver.ts --checkpnpm run docs:check-linkspnpm run buildpnpm run buildpasses with existing warnings around Shiki externalization, multiple lockfiles, deprecatedmiddleware, and the Fumadocs provider import.Summary by CodeRabbit
Release Notes
New Features
status,mcp-config, enhancedrecordingandconfigcommands)Documentation
Improvements