start.sh 1.6 KB
#!/bin/bash
# ─────────────────────────────────────────────
# LemonBoss — 启动脚本
# ─────────────────────────────────────────────

set -e

echo "🧬 LemonBoss 启动中..."
echo "═══════════════════════════════════"

# 检查依赖
if [ ! -d "node_modules" ]; then
    echo "⚠️  未安装依赖,先运行: ./install.sh"
    exit 1
fi

# 杀掉旧进程
lsof -ti:3000 | xargs kill -9 2>/dev/null || true
lsof -ti:5173 | xargs kill -9 2>/dev/null || true

# 启动后端 Agent Chat Server
echo "🔌 启动 Agent Server (端口 3000)..."
node server/agent-server.js &
SERVER_PID=$!

# 等待后端启动
sleep 1

# 启动前端 Vite Dev Server
echo "🖥️  启动前端 (端口 5173)..."
cd web && npx vite --host 2>/dev/null &
WEB_PID=$!

# 等待前端启动
sleep 2

echo ""
echo "═══════════════════════════════════"
echo "✅ LemonBoss 已启动!"
echo ""
echo "   🌐 打开: http://localhost:5173"
echo "   🧬 Innovator: http://localhost:5173/agent/innovator-001"
echo "   🔌 API: http://localhost:3000/api/agent/list"
echo ""
echo "   按 Ctrl+C 停止"
echo "═══════════════════════════════════"

# 等待中断
trap "echo ''; echo '🛑 正在关闭...'; kill $SERVER_PID $WEB_PID 2>/dev/null; exit 0" SIGINT SIGTERM
wait