Computer use CLI for AI agents
Rust accessibilityaccessibility-apiai-agentsautomationclicomputer-usecomputer-use-agentcomputer-use-agentsdesktop-automationmacosmcprust
feat: scalable skill architecture with ClawHub auto-publishing (#14)
Lahfir97665203a464
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 653b031bd..f6eb35362 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -158,3 +158,30 @@ jobs:working-directory: npmenv:NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}++ publish-skills:+ name: Publish Skills to ClawHub+ needs: [release-please]+ if: needs.release-please.outputs.release_created == 'true'+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ needs.release-please.outputs.tag_name }}++ - uses: actions/setup-node@v4+ with:+ node-version: "22"++ - name: Install ClawHub CLI+ run: npm i -g clawhub++ - name: Publish all skills to ClawHub+ run: |+ clawhub sync \+ --root skills/ \+ --all \+ --bump patch \+ --changelog "Release ${{ needs.release-please.outputs.tag_name }}"+ env:+ CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }}diff --git a/npm/scripts/postinstall.js b/npm/scripts/postinstall.jsindex 0609dd20b..49573268f 100644--- a/npm/scripts/postinstall.js+++ b/npm/scripts/postinstall.js@@ -94,6 +94,23 @@ function fixGlobalInstallBin() {}}+function promptSkillInstall() {+ const platformSkill = {+ darwin: 'agent-desktop-macos',+ win32: 'agent-desktop-windows',+ linux: 'agent-desktop-linux',+ }[platform()];++ log('');+ log('Claude Code skills available for agent-desktop!');+ log('Install with:');+ log(' claude mcp add-skill lahfir/agent-desktop');+ if (platformSkill) {+ log(` claude mcp add-skill lahfir/${platformSkill}`);+ }+ log('');+}+function main() {if (process.env.AGENT_DESKTOP_SKIP_DOWNLOAD === '1') {log('Skipping binary download (AGENT_DESKTOP_SKIP_DOWNLOAD=1)');@@ -193,6 +210,8 @@ function main() {}fixGlobalInstallBin();++ promptSkillInstall();}main();diff --git a/scripts/link-skills.sh b/scripts/link-skills.shnew file mode 100755index 000000000..a752d5dbb--- /dev/null+++ b/scripts/link-skills.sh@@ -0,0 +1,23 @@+#!/usr/bin/env bash+# Links skills/ directories to .claude/skills/ for local Claude Code use.+# Run after clone or when adding new skills.++set -euo pipefail++REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"+CLAUDE_SKILLS="$REPO_ROOT/.claude/skills"++mkdir -p "$CLAUDE_SKILLS"++for skill_dir in "$REPO_ROOT"/skills/*/; do+ name=$(basename "$skill_dir")+ target="../../skills/$name"+ link="$CLAUDE_SKILLS/$name"++ if [ -L "$link" ]; then+ rm "$link"+ fi++ ln -s "$target" "$link"+ echo "Linked: .claude/skills/$name → skills/$name"+donediff --git a/skills/agent-desktop/SKILL.md b/skills/agent-desktop/SKILL.mdindex 391fc1928..0e9d70bbd 100644--- a/skills/agent-desktop/SKILL.md+++ b/skills/agent-desktop/SKILL.md@@ -1,10 +1,14 @@---name: agent-desktop+version: 0.1.8+tags: desktop-automation, accessibility, ai-agent, gui-automation, cli+requirements:+ - agent-desktopdescription: >Desktop automation via native OS accessibility trees using the agent-desktop CLI.Use when an AI agent needs to observe, interact with, or automate desktop applications(click buttons, fill forms, navigate menus, read UI state, toggle checkboxes, scroll,- drag, type text, take screenshots, manage windows, use clipboard). Covers 50 commands+ drag, type text, take screenshots, manage windows, use clipboard). Covers 54 commandsacross observation, interaction, keyboard/mouse, app lifecycle, clipboard, and wait.Triggers on: "click button", "fill form", "open app", "read UI", "automate desktop","accessibility tree", "snapshot app", "type into field", "navigate menu", "toggle checkbox",@@ -38,7 +42,7 @@ Detailed documentation is split into focused reference files. Read them as neede| `references/commands-interaction.md` | click, type, set-value, select, toggle, scroll, drag, keyboard, mouse — choosing the right command || `references/commands-system.md` | launch, close, windows, clipboard, wait, batch, status, permissions, version || `references/workflows.md` | 12 common patterns: forms, menus, dialogs, scroll-find, drag-drop, async wait, anti-patterns |-| `references/macos.md` | macOS permissions/TCC, AX API internals, smart activation chain, surfaces, troubleshooting |+| `references/macos.md` | macOS permissions/TCC, AX API internals, smart activation chain, surfaces, Notification Center, troubleshooting |## The Observe-Act Loop@@ -85,7 +89,7 @@ Exit codes: `0` success, `1` structured error, `2` argument error.| `TIMEOUT` | Wait condition not met | Increase --timeout || `INVALID_ARGS` | Bad arguments | Check command syntax |-## Command Quick Reference (50 commands)+## Command Quick Reference (54 commands)### Observation```@@ -147,6 +151,17 @@ agent-desktop maximize --app "App"agent-desktop restore --app "App"```+### Notifications+```+agent-desktop list-notifications # List all notifications+agent-desktop list-notifications --app "Slack" # Filter by app+agent-desktop list-notifications --text "deploy" --limit 5 # Filter by text+agent-desktop dismiss-notification 1 # Dismiss by index+agent-desktop dismiss-all-notifications # Dismiss all+agent-desktop dismiss-all-notifications --app "Slack" # Dismiss all from app+agent-desktop notification-action 1 --action "Reply" # Click action button+```+### Clipboard```agent-desktop clipboard-get # Read clipboard@@ -162,6 +177,7 @@ agent-desktop wait --window "Title" # Wait for windowagent-desktop wait --text "Done" --app "App" # Wait for textagent-desktop wait --menu --app "App" # Wait for context menuagent-desktop wait --menu-closed --app "App" # Wait for menu dismissal+agent-desktop wait --notification --app "App" # Wait for new notification```### Systemdiff --git a/skills/agent-desktop/references/commands-system.md b/skills/agent-desktop/references/commands-system.mdindex 9513b2501..40f811656 100644--- a/skills/agent-desktop/references/commands-system.md+++ b/skills/agent-desktop/references/commands-system.md@@ -1,6 +1,6 @@# System Commands-App lifecycle, window management, clipboard, wait, and system health commands.+App lifecycle, window management, notifications, clipboard, wait, and system health commands.## App Lifecycle@@ -72,6 +72,62 @@ agent-desktop restore --app "TextEdit"```Restores a minimized or maximized window to its previous size.+## Notifications++### list-notifications+```bash+agent-desktop list-notifications+agent-desktop list-notifications --app "Slack"+agent-desktop list-notifications --text "deploy" --limit 5+```+Lists notifications in the Notification Center. Returns array of `{ index, app_name, title, body, actions }`.++| Flag | Default | Description |+|------|---------|-------------|+| `--app` | | Filter by source app name |+| `--text` | | Filter by text content (matches title and body) |+| `--limit` | | Max number of notifications to return |++### dismiss-notification+```bash+agent-desktop dismiss-notification 1+agent-desktop dismiss-notification 3 --app "Slack"+```+Dismisses a single notification by its 1-based index. Returns the dismissed notification info.++| Flag | Default | Description |+|------|---------|-------------|+| (positional) | | 1-based notification index (required) |+| `--app` | | Filter by app before indexing |++### dismiss-all-notifications+```bash+agent-desktop dismiss-all-notifications+agent-desktop dismiss-all-notifications --app "Slack"+```+Dismisses all notifications, optionally filtered by app. Reports per-notification failures.++Returns `{ "dismissed_count": N, "failures": [...], "failed_count": N }`.++### notification-action+```bash+agent-desktop notification-action 1 --action "Reply"+agent-desktop notification-action 2 --action "Mark as Read"+```+Clicks a named action button on a notification by its 1-based index.++| Flag | Default | Description |+|------|---------|-------------|+| (positional) | | 1-based notification index (required) |+| `--action` | | Action button name to click (required) |++### wait --notification+```bash+agent-desktop wait --notification --app "App" --timeout 10000+agent-desktop wait --notification --text "build passed" --timeout 15000+```+Blocks until a new notification appears (detects index-diff from previous state). Supports `--app` and `--text` filters.+## Clipboard### clipboard-getdiff --git a/skills/agent-desktop/references/macos.md b/skills/agent-desktop/references/macos.mdindex b282c9539..ee2c50bb8 100644--- a/skills/agent-desktop/references/macos.md+++ b/skills/agent-desktop/references/macos.md@@ -1,4 +1,4 @@-# agent-desktop: macOS Platform+# macOS PlatformmacOS-specific details for agent-desktop. Covers permissions, accessibility API behavior, troubleshooting, and platform quirks.@@ -85,6 +85,41 @@ agent-desktop list-surfaces --app "Finder"agent-desktop snapshot --app "Finder" --surface menu -i```+## Notification Center++agent-desktop interacts with macOS Notification Center via the accessibility API.++### How It Works++1. **NcSession** opens Notification Center by clicking the clock in ControlCenter (if not already open)+2. Notifications are read from the AX tree under the NotificationCenter process+3. After operations, NcSession closes NC and restores the previously focused app+4. The `Drop` impl ensures cleanup even on errors++### Dismiss Strategy++Headless-first approach (no cursor movement unless needed):++1. **AXDismiss** / **AXRemoveFromParent** — native accessibility actions+2. **Close button** — find and press AXButton named "close", "clear", or "dismiss"+3. **Hover + close button** — move cursor to reveal hidden close button, then press it+4. If all fail, returns `ACTION_FAILED`++**Important:** `AXPress` is intentionally excluded from dismiss — it "clicks" the notification body (opening the source app) without actually dismissing it.++### Stacked Notifications++macOS groups notifications from the same app into stacks. Dismissing the top notification may reveal more underneath. `dismiss-all-notifications` iterates in reverse order but may need multiple rounds for deeply stacked groups.++### Notification Troubleshooting++| Problem | Cause | Fix |+|---------|-------|-----|+| Script Editor opens during dismiss | Notification owned by osascript | Fixed — NcSession restores previous app focus |+| `dismiss-notification` reports success but notification stays | AXPress was firing instead of AXDismiss | Fixed — AXPress removed from dismiss chain |+| Calendar widget can't be dismissed | It's a system widget, not a notification | Expected behavior — not a real notification |+| Notifications disappear before listing | Banner-style notifications are transient | Use `wait --notification` to detect them |+## Troubleshooting### PERM_DENIED