Skip to content

feat(skills): port Skills/ to cua-driver-rs + add WINDOWS.md/LINUX.md + deploy at install time - #1553

Merged
f-trycua merged 3 commits into
mainfrom
feat/cua-driver-rs-skills
May 18, 2026
Merged

feat(skills): port Skills/ to cua-driver-rs + add WINDOWS.md/LINUX.md + deploy at install time#1553
f-trycua merged 3 commits into
mainfrom
feat/cua-driver-rs-skills

Conversation

@f-trycua

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

Copy link
Copy Markdown
Collaborator

Summary

Brings the Claude Code skill bundle from libs/cua-driver/Skills/cua-driver/ (macOS) into libs/cua-driver-rs/Skills/cua-driver-rs/ and adds platform-specific carve-outs for the cross-platform Rust port.

This is PR A of a two-part split discussed in #1551:

  • PR A (this PR) — port verbatim + add WINDOWS.md + LINUX.md stub + banner the macOS-skewed SKILL.md so Windows / Linux agents can find the right doc.
  • PR B (follow-up) — refactor SKILL.md into a shared core + MACOS.md adjunct, and wire install.ps1 / install.sh to deploy the Skills/ dir at install time.

PR A lets Windows agents load a useful skill today without touching the macOS workflow.

What's new

  • WINDOWS.md (686 lines, new) — Windows-specific skill covering:

    • No-foreground contract with Windows forbidden-list: Start-Process (defaults to SW_SHOWNORMAL), SetForegroundWindow, SwitchToThisWindow, BringWindowToTop, cmd /c start, explorer.exe shell:AppsFolder\…, AttachThreadInput tricks, raw SendInput, Chromium Ctrl+L / Ctrl+T / Ctrl+1..9, Win+key shell shortcuts.
    • Intent → tool mapping with Windows analogs (Win32 vs UWP launching, urls-via-launch_app, hotkey({pid, keys:["alt","f4"]}) for quit, etc.).
    • CLI argument plumbing on Windows — stdin pipe is the only path immune to PowerShell 5.1's argv quoting quirks (strings containing both " and spaces).
    • Session 0 vs Session 1+ — UIA enumeration, screenshot via PrintWindow, and IApplicationActivationManager all return empty / time out in Session 0. The daemon must run via the autostart Scheduled Task (LogonType=Interactive), not via SSH-into-Windows.
    • Click semanticselement_index mode = UIA Invoke(); (x,y) mode = layered UIA hit-test in target HWND subtree → PostMessage(WM_LBUTTONDOWN/UP) fallback. Right-click and count > 1 skip UIA Invoke per design. References the mechanism PR fix(windows-click): hit-test inside target HWND's UIA subtree for vision (x,y) #1551 ships.
    • UWP / packaged apps — AUMID resolution, ApplicationFrameHost.exe outer hosting + inner UWP process, Win11 Calc / Notepad / Settings AUMIDs, why Start-Process notepad gives you a 7 KB stub that exits.
    • Web apps on Windows section (per the conversation's "WEB_APPS inside each OS" call) — Edge/Chrome via launch_app({urls}), forbidden browser shortcuts table, tabs-vs-windows pattern, WebView2 in non-browser hosts.
    • Common failure modes — Session 0, stale HWND 0x80070578, the "Posted click to pid N" success message that didn't actually click on UWP, browser tab-switching leak, AUMID resolution misses, cold-launch HWND race.
    • Diagnostics via cua-driver doctor and autostart status.
  • LINUX.md (84 lines, new) — BETA-status placeholder. Documents what works today (read-only inspection mostly), what doesn't (no FocusRestoreGuard equivalent, Wayland gated by portals, no recording), and lists the platform-specific forbidden vectors (wmctrl -a, xdotool windowactivate, etc.).

  • SKILL.md — banner added at the top pointing Windows / Linux readers at the right carve-out file. name: frontmatter updated from cua-drivercua-driver-rs. Body unchanged from the macOS source.

  • README.md — header + Files section updated to reflect cross-platform structure. The WEB_APPS.md note now flags that Windows web-apps content lives in WINDOWS.md instead.

  • WEB_APPS.md / RECORDING.md / TESTS.md — copied verbatim from the macOS skill. WEB_APPS.md stays macOS-only (Windows version embedded in WINDOWS.md).

Test plan

  • Manual review of WINDOWS.md against PR fix(windows-click): hit-test inside target HWND's UIA subtree for vision (x,y) #1551's click chain — every claim about the layered UIA + PostMessage path matches the implementation
  • Manual review of WINDOWS.md AUMID list against Get-StartApps output on the Win11 VM
  • Manual cross-check of forbidden Windows shortcuts against actual behavior on the VM (Ctrl+L on Edge does foreground; Win+S opens Search)
  • Lint check: wc -l reports 2657 total lines across the skill dir (was 1843; +814 from WINDOWS.md / LINUX.md / README updates)
  • Follow-up PR B: refactor SKILL.md into shared core + MACOS.md, wire install scripts

Notes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Comprehensive documentation suite added for the cua-driver-rs skill, covering installation/setup, core usage patterns, platform-specific operational guidance (macOS/Windows/Linux), web app automation strategies, testing procedures with real-world examples, session recording/replay functionality, and troubleshooting support.

Review Change Stack

…md / LINUX.md

Drop the macOS Skills/cua-driver/ tree into libs/cua-driver-rs/Skills/cua-driver-rs/ verbatim, then add platform-specific carve-outs for the cross-platform port:

- `SKILL.md` — top-of-file platform-reading banner pointing Windows / Linux agents at the right carve-out. `name:` updated to `cua-driver-rs`. Body unchanged from the macOS source (still macOS-skewed; full shared-core extraction is a follow-up).

- `WINDOWS.md` — new, 686 lines. Windows-specific carve-out covering:
  - No-foreground contract w/ Windows forbidden-list (`Start-Process`, `SetForegroundWindow`, `SwitchToThisWindow`, `cmd /c start`, `explorer.exe shell:AppsFolder\\…`, `AttachThreadInput` tricks, `SendInput`, Chromium `Ctrl+L` / `Ctrl+T` / `Ctrl+1..9`, Win+key shell shortcuts).
  - Intent → tool mapping table with Windows analogs.
  - CLI argument plumbing on Windows (stdin pipe vs argv quoting; PowerShell 5.1 limitations).
  - Prerequisites including the Session 0 vs Session 1+ distinction (UIA/screenshot fail silently in Session 0; daemon must run via the LogonType=Interactive Scheduled Task, not via SSH-into-Windows).
  - Click semantics: `element_index` mode = UIA Invoke; `(x,y)` mode = layered UIA hit-test in target HWND subtree → PostMessage fallback. Right-click and count>1 skip UIA Invoke per design.
  - UWP / packaged apps section: AUMID resolution, `ApplicationFrameHost.exe` cross-process hosting, Win11 Calc/Notepad/Settings AUMIDs.
  - Web apps on Windows section: Edge/Chrome via `launch_app({urls})`, forbidden browser shortcuts table, tabs-vs-windows pattern, WebView2 in non-browser hosts.
  - Common failure modes (Session 0, stale HWND, "Posted click" success messages on UWP that didn't actually click, browser tab-switch leak, AUMID resolution, cold-launch HWND race).
  - Diagnostics via `cua-driver doctor` and `autostart status`.
  - Recording: not-yet-supported note.

- `LINUX.md` — new, 84 lines. Status placeholder. Marks the Linux backend as BETA, documents the X11/Wayland split, lists what works today and what doesn't.

- `README.md` — updated header + Files section to reflect cross-platform structure; the WEB_APPS.md note now flags that Windows web-apps content lives in WINDOWS.md instead.

`WEB_APPS.md`, `RECORDING.md`, `TESTS.md` — copied verbatim from the macOS skill. WEB_APPS.md remains macOS-only for now (Windows web-apps coverage is in WINDOWS.md's "Web apps on Windows" section). Refactoring `SKILL.md` into a shared core + `MACOS.md` adjunct is planned as a follow-up PR (PR B in the design split discussed in #1551 thread); this PR (PR A) ships the Windows carve-out without disrupting macOS workflows.

Install plumbing (drop Skills/ at install time, expose via `cua-driver doctor`, optional `cua-driver skills install` verb) is also a follow-up.
@vercel

vercel Bot commented May 18, 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 Preview May 18, 2026 0:37am

Request Review

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3ab2184d-1f31-4d6b-bab8-2a8680c415b9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds comprehensive documentation for the cua-driver-rs Claude Code skill. It provides end-to-end guidance for driving native GUI applications across macOS, Windows, and Linux via accessibility tree snapshots, covering setup, core mechanics, platform-specific implementations, web app automation, session recording, and test procedures.

Changes

cua-driver-rs Skill Documentation Suite

Layer / File(s) Summary
Skill setup and overview
README.md
Entry point documenting skill purpose (driving native GUI apps via accessibility snapshots), prerequisites (cua-driver/CuaDriver.app install, TCC permissions), installation scopes, invocation methods, MCP compatibility mode, included markdown files, troubleshooting, updates, and licensing.
Core skill mechanics and macOS implementation
SKILL.md
Primary documentation defining the no-foreground contract (user's frontmost app must not change), forbidden/allowed launch and focus patterns, prerequisites and permission checks, snapshot-before-and-after invariant for reliable element_index addressing, capture modes (som/ax/vision), canonical interaction loop using launch_app and get_window_state verification, element_index and pixel-coordinate click addressing with window-local conventions, addressability limits for OpenGL/Metal/Qt surfaces, native menu bar navigation rules, web app cross-reference, JavaScript/DOM access, post-action re-snapshot requirements, recording/replay entry points, error patterns, and end-to-end task examples.
Web-rendered apps implementation
WEB_APPS.md
Detailed guidance for Chromium/Electron/PWA apps: sparse AX tree assumptions, retry and pixel-fallback strategies, URL navigation via launch_app with focus-restoration contract, forbidden omnibox activation, window-vs-tab rules with independent AX trees and read-only tabs, minimized window interaction caveats, scrolling via key synthesis, clicking in web pages (AX element-indexed and coordinate-based), context menu handling, browser support matrix for JavaScript, detailed enable procedures for Chrome/Brave/Edge (Preferences JSON edits), Safari UI automation, Arc clipboard workaround, Firefox alternatives, and type_text fallback behavior.
Windows implementation guide
WINDOWS.md
Comprehensive Windows-specific guidance: no-foreground contract with forbidden shell/Windows focus-stealing commands, tool/transport defaults (prefer cua-driver CLI), PowerShell JSON argument plumbing (stdin pipe recommended), intent→tool mapping table, required get_window_state before/after every action to resolve stale indices and UWP silent no-ops, click semantics for element_index mode (UIA Invoke with PostMessage fallback) and coordinate mode (UIA hit-test with PostMessage fallback), DirectX/OpenGL/Vulkan surface limitations, right-click/multi-click behavior, UWP/packaged app guidance with AUMID, AppFrame hosting quirks, known AUMIDs list, browser automation constraints (non-activating launch, allowed click/input, forbidden shortcuts), WebView2 guidance, common failure modes with diagnosis/remedies, cua-driver doctor diagnostics, and recording unsupported status.
Linux implementation status
LINUX.md
Linux backend marked as BETA, enumerating unsupported/partial features (no-foreground limitations, Wayland input synthesis gated by compositor/portals, partial AT-SPI trees, no recording), quick triage steps (cua-driver doctor, XDG_SESSION_TYPE check, RemoteDesktop portal verification), forbidden foreground-activating patterns, and status table for supported tool intents.
Session recording and replay procedures
RECORDING.md
Documentation for trajectory recording and replay: enable/disable commands, captured action-tool calls vs excluded read-only tools, on-disk turn folder schema (turn-NNNNN/ with app_state.json, screenshot.png, action.json, click.png overlays), replay invocation with optional delay_ms and stop_on_error, and replay caveats (element_index non-persistence, recording during replay effects).
End-to-end testing procedures
TESTS.md
Copy-paste test prompts and global invariants (no focus flash, no cursor movement, app backgrounded, canonical action/verification loop with disallowed fallbacks), structured test cases for native AppKit apps (Calculator, Finder, Preview, Notes, Numbers, System Settings), Chromium/Electron/PWA targets (VS Code, Slack, Linear, Superhuman, Google Calendar PWA, Chrome omnibox), multi-step Calendar event-creation flow with per-field verification, explicit failure-mode probes (non-AX canvas, destructive without target, autonomous launch), and recommended runbooks (quick smoke and regression battery with refactor checklist).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • ddupont808

Poem

🐰 With cua-driver docs, the path grows clear,
No-foreground contracts hold steadfast here,
From macOS menus to Windows APIs,
Web apps and Linux—all covered, no lies,
Test prompts and replays hop all the way,
Automating apps without ruining your day!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and specifically describes the main changes: porting Skills/ to cua-driver-rs and adding platform-specific documentation (WINDOWS.md/LINUX.md) with deployment at install time.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cua-driver-rs-skills

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (3)
libs/cua-driver-rs/Skills/cua-driver-rs/LINUX.md (1)

14-21: 💤 Low value

Consider clarifying the Windows SendInput comparison.

The comparison to "Windows SendInput" on line 18 is technically accurate (both XTest and SendInput steal focus), but readers might wonder why this matters. Consider adding brief context that Windows cua-driver avoids SendInput by using PostMessage for the no-foreground contract, which clarifies why XTest's focus-stealing behavior is a limitation.

✏️ Optional clarity improvement
   `XTestFakeButtonEvent` synthesize input but route to the focused
-  window — same focus-steal characteristics as Windows `SendInput`.
+  window (similar focus-stealing behavior to Windows `SendInput`,
+  which the Windows backend avoids by using `PostMessage` instead).
   AT-SPI `accDoDefaultAction` works for accessible elements but
🤖 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-rs/Skills/cua-driver-rs/LINUX.md` around lines 14 - 21,
Update the X11 vs Windows comparison to explain why "focus-stealing" matters:
mention that XTestFakeKeyEvent / XTestFakeButtonEvent synthesize input and steal
focus similar to Windows SendInput, but on Windows the cua-driver avoids
SendInput when implementing the "no-foreground contract" by using PostMessage
(e.g., PostMessage(WM_LBUTTONDOWN)) to target a specific window without changing
focus; reference XTestFakeKeyEvent, XTestFakeButtonEvent, SendInput, and
PostMessage in the LINUX.md paragraph and add one short sentence noting that
this difference is why XTest's focus-stealing behavior is a limitation.
libs/cua-driver-rs/Skills/cua-driver-rs/WEB_APPS.md (1)

1-4: ⚡ Quick win

Add platform scope banner for clarity.

This document is macOS-specific (referencing CGEvent, SLEventPostToPid, AppleScript, etc.) but only mentions "macOS" in passing on line 4. Given that this PR introduces platform-specific carve-outs (WINDOWS.md, LINUX.md), consider adding a prominent platform banner at the top similar to the approach in other platform docs to immediately signal scope.

📝 Suggested banner
 # Driving web-rendered apps
 
+> **Platform:** This guide is macOS-specific. For Windows or Linux web automation guidance, see the platform sections in WINDOWS.md and LINUX.md.
+
 Covers apps whose UI is rendered in a web runtime inside a native
 macOS shell:
🤖 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-rs/Skills/cua-driver-rs/WEB_APPS.md` around lines 1 - 4, Add
a prominent platform scope banner at the top of the "Driving web-rendered apps"
document to clearly indicate this doc is macOS-specific; update the heading
"Driving web-rendered apps" (and nearby references to CGEvent, SLEventPostToPid,
AppleScript) to include a short macOS banner or note in the same style used in
other platform docs so readers immediately see the scope. Ensure the banner is
placed before the first paragraph and uses the same phrasing/format as the
existing platform banners in WINDOWS.md / LINUX.md for consistency.
libs/cua-driver-rs/Skills/cua-driver-rs/README.md (1)

22-36: ⚡ Quick win

Add platform qualifiers or generalize macOS-specific implementation details.

Lines 26-28 mention "yabai focus-without-raise + stamped SLEventPostToPid" which are macOS-specific implementation details. Since this README introduces the skill as cross-platform (lines 3-9), readers on Windows/Linux will find these technical details confusing or misleading.

Consider either:

  • Adding a platform qualifier: "(on macOS: yabai focus-without-raise...)"
  • Generalizing the description: "The backgrounded-click recipe that lets synthetic clicks land on web content without raising the window or pulling the user across virtual desktops."
📝 Proposed fix to generalize platform-specific details
 - The snapshot-before-AND-after invariant that keeps the agent honest
   about whether an action actually landed.
-- The backgrounded-click recipe (yabai focus-without-raise + stamped
-  SLEventPostToPid) that lets synthetic clicks land on Chrome web
-  content without raising the window or pulling the user across Spaces.
+- The backgrounded-click recipe that lets synthetic clicks land on web
+  content without raising the window or pulling the user across virtual
+  desktops (macOS: yabai focus-without-raise + SLEventPostToPid).
🤖 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-rs/Skills/cua-driver-rs/README.md` around lines 22 - 36, In
the "What the skill covers" section, update the backgrounded-click bullet (the
line mentioning "yabai focus-without-raise + stamped SLEventPostToPid") to avoid
macOS-only jargon: either add a platform qualifier such as "(on macOS: yabai
focus-without-raise + stamped SLEventPostToPid)" or replace the phrase with a
generalized description like "the backgrounded-click recipe that lets synthetic
clicks land on web content without raising the window or pulling the user across
virtual desktops"; modify the README.md bullet text for clarity so it matches
the cross-platform framing used elsewhere in the file.
🤖 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-rs/Skills/cua-driver-rs/README.md`:
- Around line 147-160: Update the README instruction that copies the skill:
replace the old path string "libs/cua-driver/Skills/cua-driver" with the correct
"libs/cua-driver-rs/Skills/cua-driver-rs" so the cp command copies from the
cua-driver-rs directory; modify the line in README.md under the "Updates"
section where the copy instruction appears to use the corrected path.
- Around line 89-98: Update the "Invoking the skill" section in README.md to
reflect the cross-platform scope (replace the phrase "macOS GUI automation" with
a neutral term like "GUI automation" or "cross-platform GUI automation") and
change the explicit invocation command from "/cua-driver" to match the skill
frontmatter name "cua-driver-rs" (use "/cua-driver-rs"); locate the section
titled "Invoking the skill" in README.md and the SKILL.md frontmatter name
"cua-driver-rs" to ensure the invocation string and platform description are
consistent across docs.
- Around line 65-87: Update the README install paths that incorrectly reference
"Skills/cua-driver" to the correct "Skills/cua-driver-rs" variants: replace
occurrences in the Personal scope, symlink example, and Project scope so cp and
ln commands point to Skills/cua-driver-rs and create
~/.claude/skills/cua-driver-rs (or .claude/skills/cua-driver-rs for project
scope) instead of the non-existent cua-driver directory; ensure the symlink
target and copied source paths consistently use "cua-driver-rs".
- Around line 39-63: The Prerequisites section currently lists macOS-only
requirements under the general "Prerequisites" heading which contradicts the
README intro claiming macOS/Windows/Linux support; update the README.md
Prerequisites block to clearly separate platform-specific instructions by adding
distinct subsections (e.g., "macOS Prerequisites", "Windows Prerequisites",
"Linux Prerequisites") and move the macOS items (macOS 14 requirement,
CuaDriver.app install steps, TCC grants and cua-driver check_permissions) under
"macOS Prerequisites", then add brief notes under "Windows Prerequisites" and
"Linux Prerequisites" pointing to new platform docs (e.g., WINDOWS.md, LINUX.md)
or to BETA caveats so Windows/Linux users aren’t misled and can find
platform-specific installation/permissions guidance.

In `@libs/cua-driver-rs/Skills/cua-driver-rs/RECORDING.md`:
- Around line 1-5: Add a clear platform-availability caveat to the top of the
"Recording & replaying trajectories" doc and the "replay" section stating that
recording and replay are currently macOS-only (or otherwise platform-limited),
and include explicit pointer links to WINDOWS.md and LINUX.md so users on those
platforms know recording is unsupported and where to find alternatives; update
the intro paragraph under the "Recording & replaying trajectories" heading and
the replay subsection (the blocks around the current replay instructions) to
include this note and the two file links.

In `@libs/cua-driver-rs/Skills/cua-driver-rs/TESTS.md`:
- Around line 1-17: Add a short header to TESTS.md clarifying that the test
suite is macOS-focused and not universal: explicitly state that
prompts/assertions reference AppKit, NSWorkspace.frontmostApplication, and macOS
keyboard modifiers (e.g., cmd) and should only be run on macOS; then either add
links to or stub sections for Windows/Linux carve-outs (or instructions for
platform-specific variants) so reviewers running on non-macOS platforms know to
skip or use the alternate tests.

In `@libs/cua-driver-rs/Skills/cua-driver-rs/WEB_APPS.md`:
- Around line 417-431: The AppleScript snippet calls tell application "Safari"
to activate which violates the no-foreground contract referenced in SKILL.md;
update the WEB_APPS.md entry to either (A) explicitly document this AppleScript
as an exception requiring explicit user consent and callout the foreground
impact (referencing the "tell application \"Safari\" to activate" line and the
surrounding script), or (B) remove that activation from the example and instead
state clearly that enabling "Allow JavaScript from Apple Events" for Safari
cannot be automated without breaking the contract and must be performed manually
by the user; make the chosen approach obvious next to the snippet and adjust the
comment on line ~419 to match.
- Around line 304-319: The documentation asserts fixed Chrome sync timing
windows and uses a hardcoded sleep (sleep 5) after open -a "Google Chrome" which
can cause flaky tests; update the prose around the osascript/Chrome launch
section to use qualified language (e.g., "typically" or "may") instead of
definitive timings and either increase the sleep to a more conservative default
or replace the single sleep 5 with a documented retry/wait approach (e.g.,
looped checks using the same osascript snippet until a stable expected value is
observed or a timeout is reached) so the guidance and the launch + verify
sequence (open -a "Google Chrome", sleep 5, the osascript execute javascript
block) reflect environment-dependent behavior.

---

Nitpick comments:
In `@libs/cua-driver-rs/Skills/cua-driver-rs/LINUX.md`:
- Around line 14-21: Update the X11 vs Windows comparison to explain why
"focus-stealing" matters: mention that XTestFakeKeyEvent / XTestFakeButtonEvent
synthesize input and steal focus similar to Windows SendInput, but on Windows
the cua-driver avoids SendInput when implementing the "no-foreground contract"
by using PostMessage (e.g., PostMessage(WM_LBUTTONDOWN)) to target a specific
window without changing focus; reference XTestFakeKeyEvent,
XTestFakeButtonEvent, SendInput, and PostMessage in the LINUX.md paragraph and
add one short sentence noting that this difference is why XTest's focus-stealing
behavior is a limitation.

In `@libs/cua-driver-rs/Skills/cua-driver-rs/README.md`:
- Around line 22-36: In the "What the skill covers" section, update the
backgrounded-click bullet (the line mentioning "yabai focus-without-raise +
stamped SLEventPostToPid") to avoid macOS-only jargon: either add a platform
qualifier such as "(on macOS: yabai focus-without-raise + stamped
SLEventPostToPid)" or replace the phrase with a generalized description like
"the backgrounded-click recipe that lets synthetic clicks land on web content
without raising the window or pulling the user across virtual desktops"; modify
the README.md bullet text for clarity so it matches the cross-platform framing
used elsewhere in the file.

In `@libs/cua-driver-rs/Skills/cua-driver-rs/WEB_APPS.md`:
- Around line 1-4: Add a prominent platform scope banner at the top of the
"Driving web-rendered apps" document to clearly indicate this doc is
macOS-specific; update the heading "Driving web-rendered apps" (and nearby
references to CGEvent, SLEventPostToPid, AppleScript) to include a short macOS
banner or note in the same style used in other platform docs so readers
immediately see the scope. Ensure the banner is placed before the first
paragraph and uses the same phrasing/format as the existing platform banners in
WINDOWS.md / LINUX.md for consistency.
🪄 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: b2688589-ba53-4cdd-bf0d-e31528bdd72c

📥 Commits

Reviewing files that changed from the base of the PR and between a344858 and e7d3098.

📒 Files selected for processing (7)
  • libs/cua-driver-rs/Skills/cua-driver-rs/LINUX.md
  • libs/cua-driver-rs/Skills/cua-driver-rs/README.md
  • libs/cua-driver-rs/Skills/cua-driver-rs/RECORDING.md
  • libs/cua-driver-rs/Skills/cua-driver-rs/SKILL.md
  • libs/cua-driver-rs/Skills/cua-driver-rs/TESTS.md
  • libs/cua-driver-rs/Skills/cua-driver-rs/WEB_APPS.md
  • libs/cua-driver-rs/Skills/cua-driver-rs/WINDOWS.md

Comment on lines +39 to +63
## Prerequisites

1. **macOS 14 or newer** — the driver depends on SkyLight private SPIs
that were stabilized in Sonoma.
2. **`cua-driver` CLI + `CuaDriver.app`** — installable one-liner:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh)"
```
Or from a clone of `trycua/cua`:
```bash
cd libs/cua-driver
scripts/install-local.sh # builds + installs + symlinks for dev use
```
The driver runs as an `.app` bundle because macOS TCC grants are
tied to a stable bundle id (`com.trycua.driver`). The CLI symlink
lets Claude invoke tools via plain shell.
3. **TCC grants on `CuaDriver.app`** — **Accessibility** and
**Screen Recording** in System Settings → Privacy & Security.
Verify with:
```bash
cua-driver check_permissions
```
Both fields must be `true`. If not, the app appears in the
relevant panes of System Settings after first use; toggle it on
there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Prerequisites section contradicts cross-platform claims.

The introduction (lines 3-9) describes this skill as supporting macOS, Windows, and Linux. However, the Prerequisites section (lines 39-63) presents macOS-only requirements as if they're universal:

  • Line 41: "macOS 14 or newer" (excludes Windows/Linux)
  • Lines 43-63: CuaDriver.app, TCC grants (macOS-specific)

Windows and Linux users reading this will incorrectly conclude the skill doesn't support their platform.

📋 Proposed fix to clarify platform-specific prerequisites
 ## Prerequisites
 
+### macOS Prerequisites
+
 1. **macOS 14 or newer** — the driver depends on SkyLight private SPIs
    that were stabilized in Sonoma.
 2. **`cua-driver` CLI + `CuaDriver.app`** — installable one-liner:
    ```bash
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/cua-driver/scripts/install.sh)"
    ```
+
+### Windows Prerequisites
+
+See `WINDOWS.md` for Windows-specific installation and permissions.
+
+### Linux Prerequisites
+
+See `LINUX.md` for Linux-specific installation and setup (BETA).
🤖 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-rs/Skills/cua-driver-rs/README.md` around lines 39 - 63, The
Prerequisites section currently lists macOS-only requirements under the general
"Prerequisites" heading which contradicts the README intro claiming
macOS/Windows/Linux support; update the README.md Prerequisites block to clearly
separate platform-specific instructions by adding distinct subsections (e.g.,
"macOS Prerequisites", "Windows Prerequisites", "Linux Prerequisites") and move
the macOS items (macOS 14 requirement, CuaDriver.app install steps, TCC grants
and cua-driver check_permissions) under "macOS Prerequisites", then add brief
notes under "Windows Prerequisites" and "Linux Prerequisites" pointing to new
platform docs (e.g., WINDOWS.md, LINUX.md) or to BETA caveats so Windows/Linux
users aren’t misled and can find platform-specific installation/permissions
guidance.

Comment on lines +65 to +87
## Install

The skill is two drop-in directories.

**Personal scope** (all Claude Code sessions on your machine):

```bash
mkdir -p ~/.claude/skills
cp -R Skills/cua-driver ~/.claude/skills/
```

Or symlink if you want edits-in-place:

```bash
ln -s "$PWD/Skills/cua-driver" ~/.claude/skills/cua-driver
```

**Project scope** (committed alongside a specific repo):

```bash
mkdir -p .claude/skills
cp -R /path/to/cua/libs/cua-driver/Skills/cua-driver .claude/skills/
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Correct installation paths to use cua-driver-rs directory name.

All installation commands reference Skills/cua-driver but the actual directory structure (per PR objectives and file paths) is Skills/cua-driver-rs. Users following these instructions will attempt to copy from a non-existent path or create incorrectly-named skill directories.

🔧 Proposed fix for installation paths
 **Personal scope** (all Claude Code sessions on your machine):
 
 ```bash
 mkdir -p ~/.claude/skills
-cp -R Skills/cua-driver ~/.claude/skills/
+cp -R Skills/cua-driver-rs ~/.claude/skills/

Or symlink if you want edits-in-place:

-ln -s "$PWD/Skills/cua-driver" ~/.claude/skills/cua-driver
+ln -s "$PWD/Skills/cua-driver-rs" ~/.claude/skills/cua-driver-rs

Project scope (committed alongside a specific repo):

mkdir -p .claude/skills
-cp -R /path/to/cua/libs/cua-driver/Skills/cua-driver .claude/skills/
+cp -R /path/to/cua/libs/cua-driver-rs/Skills/cua-driver-rs .claude/skills/
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **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.

```suggestion
## Install

The skill is two drop-in directories.

**Personal scope** (all Claude Code sessions on your machine):

🤖 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-rs/Skills/cua-driver-rs/README.md` around lines 65 - 87,
Update the README install paths that incorrectly reference "Skills/cua-driver"
to the correct "Skills/cua-driver-rs" variants: replace occurrences in the
Personal scope, symlink example, and Project scope so cp and ln commands point
to Skills/cua-driver-rs and create ~/.claude/skills/cua-driver-rs (or
.claude/skills/cua-driver-rs for project scope) instead of the non-existent
cua-driver directory; ensure the symlink target and copied source paths
consistently use "cua-driver-rs".

Comment on lines +89 to +98
## Invoking the skill

Claude Code auto-invokes the skill when you ask for macOS GUI
automation — e.g. "open the Downloads folder in Finder", "click the
Save button in Numbers", "navigate to trycua.com in Chrome". You can
also invoke it explicitly:

```
/cua-driver
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update platform references and invocation command to match cross-platform scope.

Line 92 mentions "macOS GUI automation" exclusively, contradicting the cross-platform introduction. Line 97 shows /cua-driver but the skill's frontmatter name (SKILL.md line 2) is cua-driver-rs.

📝 Proposed fixes
 ## Invoking the skill
 
-Claude Code auto-invokes the skill when you ask for macOS GUI
-automation — e.g. "open the Downloads folder in Finder", "click the
-Save button in Numbers", "navigate to trycua.com in Chrome". You can
-also invoke it explicitly:
+Claude Code auto-invokes the skill when you ask for native GUI
+automation — e.g. "open the Downloads folder in Finder" (macOS),
+"click the Save button in Notepad" (Windows), "open System Settings"
+(Linux). You can also invoke it explicitly:
 

-/cua-driver
+/cua-driver-rs

🤖 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-rs/Skills/cua-driver-rs/README.md` around lines 89 - 98,
Update the "Invoking the skill" section in README.md to reflect the
cross-platform scope (replace the phrase "macOS GUI automation" with a neutral
term like "GUI automation" or "cross-platform GUI automation") and change the
explicit invocation command from "/cua-driver" to match the skill frontmatter
name "cua-driver-rs" (use "/cua-driver-rs"); locate the section titled "Invoking
the skill" in README.md and the SKILL.md frontmatter name "cua-driver-rs" to
ensure the invocation string and platform description are consistent across
docs.

Comment on lines +147 to +160
## Updates

The skill evolves alongside the driver. To update:

```bash
cd /path/to/cua && git pull
# if you copied: re-copy
cp -R libs/cua-driver/Skills/cua-driver ~/.claude/skills/
# if you symlinked: nothing needed
```

## License

MIT. Same license as the parent `trycua/cua` repo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Correct update instructions to use cua-driver-rs path.

Line 154 references the old libs/cua-driver/Skills/cua-driver path instead of libs/cua-driver-rs/Skills/cua-driver-rs.

🔧 Proposed fix
 ## Updates
 
 The skill evolves alongside the driver. To update:
 
 ```bash
 cd /path/to/cua && git pull
 # if you copied: re-copy
-cp -R libs/cua-driver/Skills/cua-driver ~/.claude/skills/
+cp -R libs/cua-driver-rs/Skills/cua-driver-rs ~/.claude/skills/
 # if you symlinked: nothing needed
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

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-rs/Skills/cua-driver-rs/README.md around lines 147 - 160,
Update the README instruction that copies the skill: replace the old path string
"libs/cua-driver/Skills/cua-driver" with the correct
"libs/cua-driver-rs/Skills/cua-driver-rs" so the cp command copies from the
cua-driver-rs directory; modify the line in README.md under the "Updates"
section where the copy instruction appears to use the corrected path.


</details>

<!-- fingerprinting:phantom:triton:puma -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +1 to +5
# Recording & replaying trajectories

Session-scoped capture of action sequences + pre/post state, suitable
for demos, regression diffs, and training data. Invoked only when the
user explicitly asks to record — the skill does not auto-enable this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add explicit platform availability caveat for recording/replay.

This doc reads as universally supported, but the stack context indicates recording is not supported on Windows and Linux yet. Please add a clear note near the top (and in replay section) that recording/replay is currently macOS-only (or platform-limited), with pointers to WINDOWS.md / LINUX.md to avoid failed user workflows.

Also applies to: 15-20, 81-87

🤖 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-rs/Skills/cua-driver-rs/RECORDING.md` around lines 1 - 5, Add
a clear platform-availability caveat to the top of the "Recording & replaying
trajectories" doc and the "replay" section stating that recording and replay are
currently macOS-only (or otherwise platform-limited), and include explicit
pointer links to WINDOWS.md and LINUX.md so users on those platforms know
recording is unsupported and where to find alternatives; update the intro
paragraph under the "Recording & replaying trajectories" heading and the replay
subsection (the blocks around the current replay instructions) to include this
note and the two file links.

Comment on lines +1 to +17
# Natural-language tests for `cua-driver`

Prompts you can copy-paste into Claude Code to exercise the skill
end-to-end. Each one has an explicit success criterion you can verify.

Check off as you go. Mark ❌ + a short note when something regresses.

**Global invariants that apply to every test (unless otherwise
noted):** no focus flash, cursor doesn't move, the target app stays
backgrounded throughout, and Claude uses the canonical
`launch_app → get_window_state → act → get_window_state → verify` loop
(never shells out to `open -a`, never calls `simulate_click` or
`click_at` as a fallback).

---

## Native AppKit targets

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify platform scope at the top of this test plan.

This file currently reads as universal, but most prompts/assertions are macOS-specific (e.g., NSWorkspace.frontmostApplication, AppKit targets, cmd shortcuts). In a cross-platform skill bundle, please add a short header note that this suite is macOS-focused and link to Windows/Linux carve-outs (or add parallel sections) to avoid running invalid tests on those platforms.

🤖 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-rs/Skills/cua-driver-rs/TESTS.md` around lines 1 - 17, Add a
short header to TESTS.md clarifying that the test suite is macOS-focused and not
universal: explicitly state that prompts/assertions reference AppKit,
NSWorkspace.frontmostApplication, and macOS keyboard modifiers (e.g., cmd) and
should only be run on macOS; then either add links to or stub sections for
Windows/Linux carve-outs (or instructions for platform-specific variants) so
reviewers running on non-macOS platforms know to skip or use the alternate
tests.

Comment on lines +304 to +319
# 3. Relaunch Chrome and wait for sync to stabilise.
# Chrome sync fires ~1-2 s after launch and may briefly pull
# an older value from the server before Chrome pushes our local
# True back. Either test before sync fires (<1 s) or after it
# settles (>4 s). Waiting exactly ~2 s lands in the race window
# and is the most likely way to see a false negative.
open -a "Google Chrome"
sleep 5

# 4. Verify
osascript -e 'tell application "Google Chrome"
tell active tab of front window
execute javascript "1+1"
end tell
end tell'
# → 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "WEB_APPS.md" | head -20

Repository: trycua/cua

Length of output: 156


🌐 Web query:

Chrome sync timing after launch seconds official documentation

💡 Result:

There is no single, publicly documented "official" number of seconds that Chrome waits after launch before initiating a sync operation. Chrome’s synchronization engine is designed to be dynamic and event-driven rather than strictly time-based [1][2]. Key aspects of Chrome sync timing include: 1. Event-Driven Synchronization: Chrome sync is primarily triggered by changes to data (e.g., adding a bookmark, updating a password, or opening a new tab) [3][2]. When such an event occurs, the browser attempts to propagate the change to the server and other devices as soon as possible [2]. 2. Background Operations: Upon browser launch, Chrome performs a "check-in" with the sync servers to reconcile the local state with the cloud state [2]. This process is generally designed to be near-instantaneous for typical data volumes [4]. 3. Performance Optimization: Chrome prioritizes browser responsiveness over immediate synchronization [5]. If the browser is under heavy load or network conditions are poor, sync operations may be queued or throttled to avoid impacting the user experience [5]. 4. Diagnostic Tools: For users or administrators needing to investigate sync timing or latency, Google provides the internal page chrome://sync-internals/ [6][7]. This tool allows you to view the sync engine's status, trace specific operations, and monitor for errors or delays in real-time [6]. While some third-party technical guides suggest that healthy sync cycles typically complete in under 500 milliseconds [5] and that specific configurations can influence startup latency [6], these are not official Google-specified timing constants. If you are experiencing significant delays, it is typically attributed to network issues, large data payloads, or local profile corruption rather than a fixed startup delay [5][6][8].

Citations:


🌐 Web query:

Google Chrome sync behavior timing race condition

💡 Result:

Google Chrome Sync is designed as a distributed system that prioritizes eventual consistency, allowing users to modify data across multiple devices simultaneously without requiring a constant, synchronous connection to the server [1][2]. Because of this architecture, race conditions are a fundamental challenge that the system manages through specific conflict resolution strategies and data structures rather than strict global locking [3][1][4]. Key mechanisms for managing sync behavior and race conditions include: Conflict Resolution: When a conflict occurs—such as when a client has a pending local change while simultaneously receiving an update for the same entity from the server—the system employs a default conflict resolution strategy [3]. While the specific implementation can be customized by data type bridges, the system generally aims to resolve these conflicts automatically without user intervention [1]. Merging of data during conflict resolution is not currently supported; the system typically chooses between keeping the local pending change or applying the remote update [3]. Prevention of Ping-Pong Effects: To avoid "ping-pong" issues, where multiple clients continuously overwrite each other's changes due to differing interpretations of the "correct" state, developers are advised to avoid triggering outgoing sync updates directly from incoming sync updates [3]. Instead, best practices suggest fixing data locally without committing it, allowing the next natural change to propagate the fix, or implementing rate-limiting if a re-upload is strictly necessary [3]. Unique Positions: For ordered data types (like bookmarks), Chrome Sync uses a "Unique Position" API [5]. This approach uses globally unique identifiers to maintain a consistent, well-defined ordering across all clients [5]. By using these unique positions, the system reduces the likelihood of conflicts that would otherwise arise from index-based ordering, which is highly susceptible to race conditions when multiple clients modify the same list [5]. Architecture and Threading: The sync engine operates on a layered architecture that separates high-level service logic from low-level protocol management [1][2]. It utilizes multiple threads to maintain UI responsiveness, with specific data types (like bookmarks or passwords) often running on dedicated threads [2]. Within the Chromium codebase, developers use standard synchronization primitives, such as mutexes and condition variables, to protect shared state and prevent race conditions during local processing [6]. For developers working with Chrome extensions, the chrome.storage.sync API is managed by the browser's internal sync infrastructure [7][8]. Because this API is asynchronous and operates in a distributed environment, developers must be aware that race conditions can occur if multiple storage operations are performed without proper coordination, as the underlying state may change due to cloud updates [7].

Citations:


🏁 Script executed:

sed -n '304,319p' ./libs/cua-driver-rs/Skills/cua-driver-rs/WEB_APPS.md

Repository: trycua/cua

Length of output: 609


Qualify Chrome sync timing claims with environmental context.

The specific sync timing windows documented here (1-2s launch, 4s+ settle, 2s race condition) lack official Chrome documentation. Chrome sync is event-driven rather than time-based, and timing varies significantly with network conditions, data volume, machine performance, and Chrome version. Presenting these as definitive thresholds could cause flaky test failures across different environments.

Change the language from definitive statements ("Chrome sync fires ~1-2 s after launch") to qualified descriptions ("typically fires within 1-2 s", "usually settles by 4 s") to reflect the empirical and environment-dependent nature of these timings. Alternatively, update sleep 5 to a longer conservative value or add documented fallback logic for timing-sensitive checks.

🤖 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-rs/Skills/cua-driver-rs/WEB_APPS.md` around lines 304 - 319,
The documentation asserts fixed Chrome sync timing windows and uses a hardcoded
sleep (sleep 5) after open -a "Google Chrome" which can cause flaky tests;
update the prose around the osascript/Chrome launch section to use qualified
language (e.g., "typically" or "may") instead of definitive timings and either
increase the sleep to a more conservative default or replace the single sleep 5
with a documented retry/wait approach (e.g., looped checks using the same
osascript snippet until a stable expected value is observed or a timeout is
reached) so the guidance and the launch + verify sequence (open -a "Google
Chrome", sleep 5, the osascript execute javascript block) reflect
environment-dependent behavior.

Comment on lines +417 to +431
```applescript
-- Requires Accessibility permission for the calling process.
-- Safari must already be running with the Develop menu visible.
tell application "Safari" to activate
delay 0.3
tell application "System Events"
tell process "Safari"
click menu item "Allow JavaScript from Apple Events" of menu 1 ¬
of menu bar item "Develop" of menu bar 1
delay 0.3
-- Safari shows a confirmation dialog — click Allow
click button "Allow" of window 1
end tell
end tell
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚖️ Poor tradeoff

Safari activation violates the no-foreground contract.

Line 420 explicitly activates Safari (tell application "Safari" to activate), which directly violates the no-foreground contract established in SKILL.md and referenced elsewhere in this document (lines 81-83). This activation brings Safari to the front and disrupts the user's current window focus.

The comment on line 419 states "Safari must already be running" but then proceeds to activate it anyway, which is inconsistent with the backgrounded-driving principles applied to Chrome and other browsers throughout this guide.

Consider either:

  1. Documenting this as an explicit exception to the no-foreground contract with user consent required, or
  2. Noting that Safari's JS enablement cannot be automated without breaking the contract and must be done manually by the user

The current presentation makes it appear as standard procedure, which could mislead users about the contract guarantees.

🤖 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-rs/Skills/cua-driver-rs/WEB_APPS.md` around lines 417 - 431,
The AppleScript snippet calls tell application "Safari" to activate which
violates the no-foreground contract referenced in SKILL.md; update the
WEB_APPS.md entry to either (A) explicitly document this AppleScript as an
exception requiring explicit user consent and callout the foreground impact
(referencing the "tell application \"Safari\" to activate" line and the
surrounding script), or (B) remove that activation from the example and instead
state clearly that enabling "Allow JavaScript from Apple Events" for Safari
cannot be automated without breaking the contract and must be performed manually
by the user; make the chosen approach obvious next to the snippet and adjust the
comment on line ~419 to match.

f-trycua added a commit that referenced this pull request May 18, 2026
…ymlinks

Wire the skill pack added in #1553 into the installer pipeline so it
actually reaches users' machines. Matches the Swift cua-driver
install behavior — drop a symlink/junction for each detected agent
(Claude Code, Codex, OpenClaw, OpenCode) that auto-loads
Anthropic-format SKILL.md skills from a folder. Never overwrites
existing user links.

## Changes

### CD workflow (`.github/workflows/cd-rust-cua-driver.yml`)

- Linux package step: include `Skills/cua-driver-rs/` at top level of
  the directory tarball (`cua-driver-rs-<v>-linux-<arch>.tar.gz`).
- Windows package step: include `Skills/cua-driver-rs/` at top level
  of the directory zip.
- macOS package step: copy `Skills/cua-driver-rs/` INTO the bundle
  at `CuaDriverRs.app/Contents/Resources/Skills/cua-driver-rs/`
  BEFORE codesigning, so the notarized bundle ships with skills baked
  in. Matches the Swift cua-driver path layout.

### `libs/cua-driver-rs/scripts/install.ps1`

- After extracting the release zip, copy `Skills/` from the staged
  dir into `<versionedDir>/Skills/cua-driver-rs/` so the per-version
  dir holds the active skill pack.
- After the bin/current junctions are wired, drop directory junctions
  (`mklink /J`) for each detected agent's skills dir. Junctions
  resolve through `current\Skills\cua-driver-rs`, so upgrades stay
  transparent. Junctions don't require Developer Mode / admin (same
  property the bin/current junctions rely on).

### `libs/cua-driver-rs/scripts/install.sh`

- **Tarball selection**: Linux now fetches the directory tarball
  (`cua-driver-rs-<v>-<label>.tar.gz`) instead of the bare-binary
  tarball, so the skill pack at `<stage>/Skills/cua-driver-rs/` is
  included. Backward-compat path retained for older bare-binary
  layouts.
- macOS: the `ditto $SRC_APP $APP_DEST` step already copies the skill
  pack from inside the .app bundle; SKILL_TARGET points there.
- Linux: copy `Skills/cua-driver-rs/` from `<stage>` to
  `<VERSIONED_DIR>/Skills/cua-driver-rs/` next to the binary;
  SKILL_TARGET points through the `current` symlink.
- New `link_skill_into()` helper mirrors the Swift installer's
  implementation exactly: symlink into `~/.claude/skills`,
  `~/.agents/skills`, `~/.openclaw/skills`, `~/.config/opencode/skills`
  for each detected agent.

### `libs/cua-driver-rs/scripts/install-local.{ps1,sh}`

- Stage `Skills/cua-driver-rs/` from the repo into the versioned
  release dir alongside the just-built binary, mirroring what the
  production install scripts do from the release artifact.
- Same agent-detection symlink/junction loop as the production
  scripts.

## Net effect

After install (or auto-update) on any platform:

- `~/.claude/skills/cua-driver-rs` → resolves to the active version's
  Skills dir.
- Same for `~/.agents/skills/`, `~/.openclaw/skills/`,
  `~/.config/opencode/skills/` (each created if its parent agent
  config exists and the `skills/` subdir is missing).
- Agents auto-discover `SKILL.md`, `WINDOWS.md`, `LINUX.md`,
  `WEB_APPS.md`, `RECORDING.md`, `TESTS.md` on next start.

User-side opt-out: don't have any of the four agent config dirs
present; the installer silently skips the symlink step. Dev users
with hand-rolled symlinks pointing at a working repo: the
`if [[ -e $link_path ]]` guard preserves them across re-runs.

## Test plan

- [ ] cua-driver-rs release with skills baked into all three tarballs
- [ ] Windows: irm | iex install on a fresh VM creates
      `%USERPROFILE%\.claude\skills\cua-driver-rs` junction
- [ ] macOS: install creates `~/.claude/skills/cua-driver-rs` symlink
      pointing into the .app
- [ ] Linux: install creates `~/.claude/skills/cua-driver-rs` symlink
      pointing through the `current` symlink

Builds on #1553 (which added the Skills/cua-driver-rs/ tree).
Deferred to a follow-up: `cua-driver skills {path|status|link}` CLI
verb and `cua-driver doctor` reporting of skill-install state.
@f-trycua f-trycua changed the title docs(skills): port cua-driver Skills/ to cua-driver-rs + add WINDOWS.md / LINUX.md feat(skills): port Skills/ to cua-driver-rs + add WINDOWS.md/LINUX.md + deploy at install time May 18, 2026
@f-trycua

Copy link
Copy Markdown
Collaborator Author

Update: extended PR with the install-plumbing piece (PR B from the design split) so the skills actually reach users' machines.

New commit e1378eb3 adds:

  1. CD workflow — packages Skills/cua-driver-rs/ into all three platform tarballs (cua-driver-rs-<v>-linux-<arch>.tar.gz, cua-driver-rs-<v>-windows-<arch>.zip, and INSIDE the macOS CuaDriverRs.app bundle at Contents/Resources/Skills/cua-driver-rs/ before codesigning).

  2. install.ps1 — extracts the skill pack into the versioned release dir, then drops directory junctions (mklink /J) for each detected agent:

    • %USERPROFILE%\.claude\skills\cua-driver-rs (Claude Code)
    • %USERPROFILE%\.agents\skills\cua-driver-rs (Codex)
    • %USERPROFILE%\.openclaw\skills\cua-driver-rs (OpenClaw)
    • %APPDATA%\opencode\skills\cua-driver-rs (OpenCode)
    • Junctions resolve through current\Skills\cua-driver-rs so upgrades stay transparent. No admin/Developer Mode required.
  3. install.sh — switches the Linux download from bare-binary to the directory tarball (so the skill pack is included; bare-binary path kept for backwards-compat). Mirrors the Swift cua-driver install path for agent symlinks (ln -s into ~/.claude/skills, etc.).

  4. install-local.{ps1,sh} — stages Skills/cua-driver-rs/ from the repo into the versioned dir + same agent-symlink loop. Local dev gets the same UX as production install.

  5. Idempotent + safe — never overwrites existing user symlinks (preserves dev users' working-copy links). Skips silently if an agent's config dir doesn't exist (don't create ~/.claude/skills if Claude Code isn't installed).

Test plan delta:

  • cua-driver-rs release with skills baked into all three tarballs
  • Windows: irm | iex install on a fresh VM creates %USERPROFILE%\.claude\skills\cua-driver-rs junction resolving to the .md files
  • macOS: install creates ~/.claude/skills/cua-driver-rs symlink into /Applications/CuaDriverRs.app/Contents/Resources/Skills/cua-driver-rs/
  • Linux: install creates ~/.claude/skills/cua-driver-rs symlink resolving through ~/.cua-driver-rs/packages/current/Skills/cua-driver-rs/

Deferred to follow-up issue: cua-driver skills {path|status|link} CLI verb and cua-driver doctor reporting of skill-install state.

…n install)

User feedback on the previous auto-link approach: don't touch
~/.claude/skills/ from the install script. Make it explicit. Match
the same shape the user opted into — the verb fetches a versioned
release asset from GitHub and symlinks into detected agent dirs.

## Subcommands

- `cua-driver skills install` — fetch + place at <HomeDir>/skills/cua-driver-rs + symlink into each detected agent's skills dir.
- `cua-driver skills update` — alias for `install --force`; re-fetch and refresh content.
- `cua-driver skills uninstall [--all]` — remove agent symlinks; with `--all`, delete the local copy too.
- `cua-driver skills status` — read-only probe of local + per-agent state.
- `cua-driver skills path` — print the local skill pack path.
- `--from main` — bleeding-edge mode: fetch each .md from raw.githubusercontent.com/trycua/cua/main instead of the tagged release.

## Fetch source

Default: `https://github.com/trycua/cua/releases/download/cua-driver-rs-v<v>/cua-driver-rs-v<v>-skills.tar.gz` where `<v>` is the binary's own version (`CARGO_PKG_VERSION`). Pins the skill content to the binary release. CD now publishes this tarball as a per-release asset alongside the platform tarballs.

## Agent detection (same 4 the Swift cua-driver wires)

- Claude Code: `~/.claude/skills/`
- Codex:       `~/.agents/skills/`
- OpenClaw:    `~/.openclaw/skills/`
- OpenCode:    `~/.config/opencode/skills/` (macOS/Linux), `%APPDATA%\opencode\skills\` (Windows)

Only acts when the agent's parent skills dir already exists. Never overwrites an existing `<agent_skills>/cua-driver-rs` link — preserves dev users' hand-rolled symlinks. Windows uses `mklink /J` (no admin/devmode); macOS/Linux use `ln -s`.

## Install scripts revert

Previously this branch had auto-link logic in install.ps1 / install.sh / install-local.{ps1,sh}. All four reverted: no skill staging from the release artifact, no agent-symlink loops. Post-install hint now points at the verb:

```
Agent skill pack (optional):
  cua-driver skills install
```

## CD workflow

- New step in the release job: package `Skills/cua-driver-rs/` into a single platform-agnostic `cua-driver-rs-v<v>-skills.tar.gz` asset and upload alongside the binary tarballs.
- Reverted: the per-platform tarball changes (skills inside the macOS .app bundle, alongside the Linux/Windows binaries). The verb's dedicated asset is the only source.

## Module

- New: `crates/cua-driver/src/skills.rs` (~390 LOC). HTTP via `ureq` (already a dep), tarball via `tar` + `flate2` (new deps).
- `cli.rs`: new `Command::Skills { subcommand, flags }` variant + parsing + telemetry mapping (`cua_driver_skills_<sub>`).
- `main.rs`: dispatch in both the macOS and other-OS branches.
- Help text updated in cli.rs to document the verb.

## Telemetry

`cua_driver_skills_install` / `_update` / `_uninstall` / `_status` / `_path` events, same shape as autostart's per-subcommand split. Respects the opt-out flag.

## Test plan

- [x] Code review / structure
- [ ] cua-driver-rs release with the skills.tar.gz asset
- [ ] `cua-driver skills install` on the Win11 VM: fetches the tarball, places at `%USERPROFILE%\.cua-driver-rs\skills\cua-driver-rs`, junctions into `%USERPROFILE%\.claude\skills\cua-driver-rs`
- [ ] `cua-driver skills status` reports correctly
- [ ] `cua-driver skills uninstall --all` cleans up
- [ ] macOS `ln -s` symlink path

Follow-up issues for future work:
- `cua-driver doctor` reports skill install state
- `cua-driver skills install --local` flag pointing at install-local's staged copy
@f-trycua
f-trycua force-pushed the feat/cua-driver-rs-skills branch from e1378eb to ae3a14d Compare May 18, 2026 12:10
…rm banners

- README.md: fix stale `Skills/cua-driver` paths → `Skills/cua-driver-rs`. Split Prerequisites into macOS / Windows / Linux sections (the previous flat list was macOS-only despite the cross-platform claim in the intro). Update install + invocation snippets (`/cua-driver` → `/cua-driver-rs`). Replace yabai/SLEventPostToPid macOS-specific jargon in "What the skill covers" with a per-platform breakdown.
- WEB_APPS.md: platform banner at top — doc is macOS-only; point Windows readers at WINDOWS.md's "Web apps on Windows" section and Linux at LINUX.md.
- RECORDING.md: platform banner — recording is macOS-only today; documents the Windows "not yet supported" message + Linux unsupported status.
- TESTS.md: platform banner — prompts reference NSWorkspace / cmd / Finder / Numbers; explicitly mark macOS-only and point Windows / Linux readers at their respective triage sections.
- LINUX.md: expand the X11 vs Windows-SendInput comparison to explain why focus-stealing matters here (Windows avoids it via PostMessage; Linux has no equivalent per-window-message channel).

Net effect: a reader landing on any platform-flavoured doc can immediately tell whether they're on the right page; all install / copy / invoke snippets in README work as written; no stale `cua-driver` (Swift) path references remain in the cua-driver-rs Skills tree.
@f-trycua
f-trycua merged commit b1be93d into main May 18, 2026
5 checks passed
@f-trycua
f-trycua deleted the feat/cua-driver-rs-skills branch May 18, 2026 12:47
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