#!/usr/bin/env bash set -euo pipefail echo "[1/8] Checking required files..." FILES=( app/layout.jsx app/page.jsx app/globals.css components/layout/WorkspaceLayout.jsx components/editor/ProductionCodeEditor.jsx components/explorer/ProductionFileExplorer.jsx components/terminal/ProductionTerminal.jsx components/chat/ProductionAIChat.jsx components/device/DevicePreview.jsx components/build/BuildCenter.jsx components/sidebar/ActivityBar.jsx components/statusbar/StatusBar.jsx package.json next.config.js ) for f in "${FILES[@]}"; do [ -f "$f" ] || { echo "Missing: $f" exit 1 } done echo "[2/8] Installing dependencies..." npm install echo "[3/8] Linting..." if npm run lint >/dev/null 2>&1; then echo "Lint OK" else echo "Lint skipped" fi echo "[4/8] Production build..." npm run build echo "[5/8] Cleaning previous server..." pkill -f "next dev" 2>/dev/null || true pkill -f "next start" 2>/dev/null || true echo "[6/8] Starting production..." nohup npm start > production.log 2>&1 & sleep 10 echo "[7/8] Health check..." curl -fsS http://127.0.0.1:3000 >/dev/null echo "[8/8] SUCCESS" echo echo "Studio running at:" echo "http://127.0.0.1:3000"