Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "clawd-cursor",
"version": "0.5.1",
"description": "AI Desktop Agent Native screen control via @nut-tree-fork/nut-js. Your AI sees the screen, moves the mouse, types, and completes tasks autonomously.",
"description": "AI Desktop Agent \u2014 Native screen control via @nut-tree-fork/nut-js. Your AI sees the screen, moves the mouse, types, and completes tasks autonomously.",
"main": "dist/index.js",
"bin": {
"clawd-cursor": "dist/index.js"
Expand All @@ -13,7 +13,8 @@
"stop": "node dist/index.js stop",
"doctor": "node dist/index.js doctor",
"lint": "eslint src/",
"test": "vitest"
"test": "vitest",
"postinstall": "bash scripts/arm-fix-libnut.sh"
},
"dependencies": {
"@nut-tree-fork/nut-js": "^4.2.0",
Expand All @@ -35,4 +36,4 @@
"node": ">=20.0.0"
},
"license": "MIT"
}
}
43 changes: 43 additions & 0 deletions scripts/arm-fix-libnut.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail

ARCH="$(uname -m)"
if [[ "$ARCH" != "aarch64" && "$ARCH" != "arm64" ]]; then
exit 0
fi

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TARGET="$ROOT_DIR/node_modules/@nut-tree-fork/libnut-linux/build/Release/libnut.node"

# Optional override: export LIBNUT_NODE_PATH=/abs/path/to/libnut.node
CANDIDATES=(
"${LIBNUT_NODE_PATH:-}"
"$ROOT_DIR/libnut-core/build/Release/libnut.node"
"$ROOT_DIR/../libnut-core/build/Release/libnut.node"
)

SRC=""
for candidate in "${CANDIDATES[@]}"; do
if [[ -n "$candidate" && -f "$candidate" ]]; then
SRC="$candidate"
break
fi
done

if [[ -z "$SRC" ]]; then
echo "[arm-fix-libnut] ARM detected but no prebuilt libnut.node found." >&2
echo "[arm-fix-libnut] Checked: ROOT/libnut-core and ../libnut-core (or LIBNUT_NODE_PATH). Skipping patch." >&2
exit 0
fi

mkdir -p "$(dirname "$TARGET")"
cp "$SRC" "$TARGET"

if command -v file >/dev/null 2>&1; then
file "$TARGET" | grep -Eq 'aarch64|ARM aarch64' || {
echo "[arm-fix-libnut] copied file does not look like ARM64 binary: $TARGET" >&2
exit 1
}
fi

echo "[arm-fix-libnut] OK (ARM) -> $TARGET (source: $SRC)"