alpha-arena/scripts/build-macos-app.sh
oho 774f8b3f61 Initial commit: Alpha Arena - Polymarket Autonomous Trading Harness
A comprehensive autonomous trading system for Polymarket prediction markets
featuring multi-LLM provider support, a native macOS menu bar app, and a
web-based control dashboard.

Key features:
- Multi-agent trading system (Research, Risk, Execution, Reflection agents)
- LLM provider flexibility (Anthropic, OpenAI, Google, xAI, Local models)
- Automatic provider fallback chain for resilience
- Native Swift/SwiftUI macOS menu bar application
- FastAPI web dashboard with real-time WebSocket updates
- Risk management with kill switch
- Technical indicators and market analysis
2026-01-12 23:04:58 +01:00

106 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
#
# Build Alpha Arena.app for macOS
#
# This script:
# 1. Generates icon assets (if Pillow is available)
# 2. Builds the .app bundle using py2app
# 3. Optionally installs to /Applications
#
# Usage:
# ./scripts/build-macos-app.sh Build only
# ./scripts/build-macos-app.sh install Build and install to /Applications
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
echo "========================================"
echo " Alpha Arena macOS App Builder"
echo "========================================"
echo ""
# Check for virtual environment
if [ ! -d ".venv" ]; then
echo "Error: Virtual environment not found."
echo "Run ./scripts/setup.sh first."
exit 1
fi
# Activate venv
source .venv/bin/activate
# Check for py2app
if ! python -c "import py2app" 2>/dev/null; then
echo "Installing py2app..."
pip install py2app
fi
# Check for rumps
if ! python -c "import rumps" 2>/dev/null; then
echo "Installing rumps and other macOS dependencies..."
pip install rumps pyobjc-framework-Cocoa pyobjc-framework-UserNotifications websocket-client
fi
# Generate icons
echo ""
echo "Step 1: Generating icons..."
if python -c "from PIL import Image" 2>/dev/null; then
python scripts/generate-icons.py
else
echo "Pillow not installed. Installing..."
pip install Pillow
python scripts/generate-icons.py
fi
# Clean previous builds
echo ""
echo "Step 2: Cleaning previous builds..."
rm -rf build dist
# Build the app
echo ""
echo "Step 3: Building Alpha Arena.app..."
python scripts/macos-app-setup.py py2app
# Check if build succeeded
APP_PATH="dist/Alpha Arena.app"
if [ -d "$APP_PATH" ]; then
echo ""
echo "========================================"
echo " Build Successful!"
echo "========================================"
echo ""
echo "App location: $PROJECT_DIR/$APP_PATH"
echo ""
# Install if requested
if [ "$1" == "install" ]; then
echo "Installing to /Applications..."
rm -rf "/Applications/Alpha Arena.app"
cp -r "$APP_PATH" /Applications/
echo "Installed to /Applications/Alpha Arena.app"
echo ""
echo "You can now launch Alpha Arena from:"
echo " - Spotlight (Cmd+Space, type 'Alpha Arena')"
echo " - Applications folder"
echo " - Launchpad"
else
echo "To install, run:"
echo " cp -r '$APP_PATH' /Applications/"
echo ""
echo "Or run this script with 'install' argument:"
echo " ./scripts/build-macos-app.sh install"
fi
else
echo ""
echo "Build failed! Check the output above for errors."
exit 1
fi
echo ""
echo "Done!"