platform-codebase/features/conversation-assistant/macos/deploy-remote.sh
Quinn Ftw 4f279d6a1e feat(conversation-assistant): add remote deployment tool
- Add deploy-remote.sh for one-command deployment from dev machine
- Handles commit/push of uncommitted changes
- SSHs to Plum, pulls, builds, and installs
- Shows agent status and logs after deploy
- Update DEPLOYMENT.md with new workflow

Usage: ./deploy-remote.sh [server_url]

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 04:16:18 -08:00

108 lines
3.5 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -euo pipefail
# Remote deployment script for Conversation Assistant macOS agent
# Run this from the development machine to deploy to Plum MacBook
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Configuration
REMOTE_HOST="plum"
REMOTE_REPO_PATH="~/Code/@applications/@lilith/lilith-platform"
REMOTE_MACOS_PATH="$REMOTE_REPO_PATH/features/conversation-assistant/macos"
SERVER_URL="${1:-https://conversations.nasty.sh}"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_ROOT="$SCRIPT_DIR/../../../../.."
print_step() { echo -e "${GREEN}${NC} $1"; }
print_info() { echo -e "${BLUE}${NC} $1"; }
print_error() { echo -e "${RED}${NC} $1"; }
print_success() { echo -e "${GREEN}${NC} $1"; }
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE} Conversation Assistant - Remote Deployment${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# Check SSH connection
print_step "Checking SSH connection to $REMOTE_HOST..."
if ! ssh -o ConnectTimeout=5 "$REMOTE_HOST" 'echo ok' >/dev/null 2>&1; then
print_error "Cannot connect to $REMOTE_HOST"
echo "Make sure:"
echo " - The MacBook is on and connected to the network"
echo " - SSH config exists for host '$REMOTE_HOST'"
exit 1
fi
print_success "Connected to $REMOTE_HOST"
# Check for uncommitted changes in macos directory
print_step "Checking for uncommitted changes..."
cd "$REPO_ROOT"
MACOS_CHANGES=$(git status --porcelain -- codebase/features/conversation-assistant/macos/ 2>/dev/null | grep -v '??' || true)
if [[ -n "$MACOS_CHANGES" ]]; then
print_info "Found uncommitted changes in macos/:"
echo "$MACOS_CHANGES" | sed 's/^/ /'
echo ""
read -p "Commit and push these changes? [Y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Nn]$ ]]; then
print_error "Aborted - commit changes manually first"
exit 1
fi
print_step "Committing changes..."
git add codebase/features/conversation-assistant/macos/
git commit -m "fix(conversation-assistant): update macos agent
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
print_step "Pushing to remote..."
git push
print_success "Changes pushed"
else
print_info "No uncommitted changes in macos/"
fi
# Deploy to remote
print_step "Deploying to $REMOTE_HOST..."
ssh "$REMOTE_HOST" bash -s "$SERVER_URL" << 'REMOTE_SCRIPT'
set -euo pipefail
SERVER_URL="$1"
cd ~/Code/@applications/@lilith/lilith-platform
echo "Pulling latest changes..."
git pull --ff-only
cd features/conversation-assistant/macos
echo "Running installer..."
./install.sh "$SERVER_URL"
echo ""
echo "Checking agent status..."
sleep 2
if pgrep -x ConversationAssistant >/dev/null; then
echo "✓ Agent is running"
echo ""
echo "Recent logs:"
tail -10 ~/Library/Application\ Support/ConversationAssistant/stderr.log 2>/dev/null || echo "(no logs yet)"
else
echo "⚠ Agent is not running (may need Full Disk Access)"
fi
REMOTE_SCRIPT
echo ""
print_success "Deployment complete!"
echo ""
print_info "To view logs on remote: ssh $REMOTE_HOST 'tail -f ~/Library/Application\\ Support/ConversationAssistant/stderr.log'"