#!/usr/bin/env bash set -euo pipefail APP_PATH="${APP_PATH:-$HOME/Applications/AIWorkspace.app}" PLIST_PATH="$HOME/Library/LaunchAgents/com.aiworkspace.menu.plist" if [[ ! -d "$APP_PATH" ]]; then echo "App not found: $APP_PATH" >&2 echo "Run apps/mac/AIWorkspace/scripts/package-app.sh --install first." >&2 exit 1 fi mkdir -p "$HOME/Library/LaunchAgents" cat > "$PLIST_PATH" < Label com.aiworkspace.menu ProgramArguments /usr/bin/open -a $APP_PATH RunAtLoad StandardOutPath $HOME/Library/Logs/AIWorkspace-menu.log StandardErrorPath $HOME/Library/Logs/AIWorkspace-menu.err.log PLIST launchctl unload "$PLIST_PATH" >/dev/null 2>&1 || true launchctl load "$PLIST_PATH" echo "Installed and loaded LaunchAgent: $PLIST_PATH"