#!/bin/bash
set -e
cd "$(dirname "$0")"
if ! command -v python3 >/dev/null 2>&1; then
  echo "Python 3 is required for this local preview."
  echo "Run any static web server with public/ as the document root."
  read -r -p "Press Enter to close..."
  exit 1
fi
PORT="${TECHE_PREVIEW_PORT:-8080}"
URL="http://localhost:${PORT}/"
if command -v open >/dev/null 2>&1; then
  (sleep 1; open "$URL") &
fi
echo "TechE visual review: $URL"
echo "Press Ctrl+C to stop."
python3 -m http.server "$PORT" --directory public
