#!/bin/bash
set -e

# Ensure dist exists and has required files
if [ ! -f "dist/index.html" ]; then
    echo "Error: dist/index.html not found. Run ./scripts/build.sh first."
    exit 1
fi

if [ ! -d "dist/guides" ] || [ ! -d "dist/tools" ] || [ ! -d "dist/notebooks" ]; then
    echo "Error: dist/ is incomplete. Run ./scripts/build.sh first."
    exit 1
fi

echo "Deploying to VPS..."
echo "Contents:"
ls -la dist/

rsync -avz --delete dist/ root@46.224.190.110:/var/www/build.valuecurve.co/

echo ""
echo "Deploy complete!"
echo "Site live at: https://build.valuecurve.co"
