This commit is contained in:
Chris Tate
2026-01-11 04:30:01 -06:00
parent e36d03c8d9
commit 87f11b4190
4 changed files with 11 additions and 29 deletions
-4
View File
@@ -1,6 +1,4 @@
#!/bin/sh #!/bin/sh
# agent-browser CLI wrapper
SCRIPT="$0" SCRIPT="$0"
while [ -L "$SCRIPT" ]; do while [ -L "$SCRIPT" ]; do
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd)"
@@ -8,12 +6,10 @@ while [ -L "$SCRIPT" ]; do
case "$SCRIPT" in /*) ;; *) SCRIPT="$SCRIPT_DIR/$SCRIPT" ;; esac case "$SCRIPT" in /*) ;; *) SCRIPT="$SCRIPT_DIR/$SCRIPT" ;; esac
done done
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd)"
OS=$(uname -s | tr '[:upper:]' '[:lower:]') OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m) ARCH=$(uname -m)
case "$OS" in darwin) OS="darwin" ;; linux) OS="linux" ;; mingw*|msys*|cygwin*) OS="win32" ;; esac case "$OS" in darwin) OS="darwin" ;; linux) OS="linux" ;; mingw*|msys*|cygwin*) OS="win32" ;; esac
case "$ARCH" in x86_64|amd64) ARCH="x64" ;; aarch64|arm64) ARCH="arm64" ;; esac case "$ARCH" in x86_64|amd64) ARCH="x64" ;; aarch64|arm64) ARCH="arm64" ;; esac
BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}" BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}"
[ -f "$BINARY" ] && [ -x "$BINARY" ] && exec "$BINARY" "$@" [ -f "$BINARY" ] && [ -x "$BINARY" ] && exec "$BINARY" "$@"
exec node "$SCRIPT_DIR/../dist/index.js" "$@" exec node "$SCRIPT_DIR/../dist/index.js" "$@"
-3
View File
@@ -1,8 +1,5 @@
@echo off @echo off
setlocal setlocal
set "SCRIPT_DIR=%~dp0" set "SCRIPT_DIR=%~dp0"
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (set "ARCH=x64") else if "%PROCESSOR_ARCHITECTURE%"=="ARM64" (set "ARCH=arm64") else (set "ARCH=x64")
set "BINARY=%SCRIPT_DIR%agent-browser-win32-%ARCH%.exe"
if exist "%BINARY%" ("%BINARY%" %* & exit /b %errorlevel%)
node "%SCRIPT_DIR%..\dist\index.js" %* node "%SCRIPT_DIR%..\dist\index.js" %*
exit /b %errorlevel% exit /b %errorlevel%
+8 -21
View File
@@ -1,12 +1,12 @@
# Docker Compose for building agent-browser # Docker Compose for building agent-browser
# Usage: docker compose -f docker/docker-compose.yml run build-all # Usage: docker compose -f docker/docker-compose.yml run build-linux
# #
# Note: Windows is skipped because the Rust CLI uses Unix sockets. # Note: macOS builds should be done natively on macOS for compatibility.
# Windows users will use the Node.js fallback automatically. # Windows uses Node.js fallback (Unix sockets not supported).
services: services:
# Build for all Unix platforms # Build for Linux platforms only (macOS should be built natively)
build-all: build-linux:
build: build:
context: .. context: ..
dockerfile: docker/Dockerfile.build dockerfile: docker/Dockerfile.build
@@ -16,7 +16,7 @@ services:
command: | command: |
-c ' -c '
set -e set -e
echo "Building for all platforms..." echo "Building for Linux platforms..."
# Linux x64 # Linux x64
echo "→ Linux x64" echo "→ Linux x64"
@@ -30,22 +30,9 @@ services:
cp /build/target/aarch64-unknown-linux-gnu/release/agent-browser /output/agent-browser-linux-arm64 cp /build/target/aarch64-unknown-linux-gnu/release/agent-browser /output/agent-browser-linux-arm64
chmod +x /output/agent-browser-linux-arm64 chmod +x /output/agent-browser-linux-arm64
# macOS x64
echo "→ macOS x64"
cargo zigbuild --release --target x86_64-apple-darwin
cp /build/target/x86_64-apple-darwin/release/agent-browser /output/agent-browser-darwin-x64
chmod +x /output/agent-browser-darwin-x64
# macOS ARM64
echo "→ macOS ARM64"
cargo zigbuild --release --target aarch64-apple-darwin
cp /build/target/aarch64-apple-darwin/release/agent-browser /output/agent-browser-darwin-arm64
chmod +x /output/agent-browser-darwin-arm64
echo "" echo ""
echo "✓ All platforms built successfully!" echo "✓ Linux platforms built successfully!"
echo "(Windows uses Node.js fallback - Unix sockets not supported)" ls -la /output/agent-browser-linux-*
ls -la /output/agent-browser-*
' '
# Build for a single target (override with TARGET env var) # Build for a single target (override with TARGET env var)
+3 -1
View File
@@ -15,7 +15,9 @@
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"build:native": "cargo build --release --manifest-path cli/Cargo.toml && node scripts/copy-native.js", "build:native": "cargo build --release --manifest-path cli/Cargo.toml && node scripts/copy-native.js",
"build:all-platforms": "docker compose -f docker/docker-compose.yml run --rm build-all", "build:linux": "docker compose -f docker/docker-compose.yml run --rm build-linux",
"build:macos": "cargo build --release --manifest-path cli/Cargo.toml --target aarch64-apple-darwin && cargo build --release --manifest-path cli/Cargo.toml --target x86_64-apple-darwin && cp cli/target/aarch64-apple-darwin/release/agent-browser bin/agent-browser-darwin-arm64 && cp cli/target/x86_64-apple-darwin/release/agent-browser bin/agent-browser-darwin-x64",
"build:all-platforms": "npm run build:linux && npm run build:macos",
"build:docker": "docker build -t agent-browser-builder -f docker/Dockerfile.build .", "build:docker": "docker build -t agent-browser-builder -f docker/Dockerfile.build .",
"start": "node dist/index.js", "start": "node dist/index.js",
"dev": "tsx src/index.ts", "dev": "tsx src/index.ts",