#!/bin/bash
# Build CLI - Build Next.js standalone and copy to cli/app/
# Run from project root: bash scripts/build-cli.sh

set -e

echo ""
echo "[1/3] Building Next.js standalone..."
npm run build

echo ""
echo "[2/3] Copying standalone to cli/app/..."
rm -rf cli/app
mkdir -p cli/app
cp -r .next/standalone/* cli/app/
cp -r .next/static cli/app/.next/static
cp -r public cli/app/public

echo ""
echo "[3/3] Done!"
echo ""
echo "CLI ready at cli/"
echo "Test with: cd cli && node cli.js"
