Remove --host flag from dev.sh that was overriding vite.config.ts to bind on 0.0.0.0. Server now defaults to localhost; use VITE_HOST env var to opt-in to LAN access for mobile testing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1001 B
Bash
Executable File
39 lines
1001 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Start Claude proxy and Vite dev server together.
|
|
# Both are killed when either exits or when this script receives SIGINT/SIGTERM.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
APP_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
cd "$APP_DIR"
|
|
|
|
# Generate a dev API token if not already set
|
|
if [ -z "$VITE_DEV_API_TOKEN" ]; then
|
|
export VITE_DEV_API_TOKEN=$(openssl rand -hex 16)
|
|
fi
|
|
|
|
cleanup() {
|
|
kill 0 2>/dev/null || true
|
|
wait 2>/dev/null || true
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
|
|
# Use local node_modules binaries
|
|
BIN="$APP_DIR/node_modules/.bin"
|
|
|
|
# Start Claude proxy in background (skip gracefully if already running on :3141)
|
|
if lsof -ti:3141 > /dev/null 2>&1; then
|
|
echo " Claude proxy already running on :3141 — skipping"
|
|
else
|
|
"$BIN/tsx" server/claude-proxy.ts &
|
|
sleep 0.3
|
|
fi
|
|
|
|
# Start Vite dev server in background (host binding controlled by vite.config.ts / VITE_HOST)
|
|
"$BIN/vite" &
|
|
|
|
# Wait for all background jobs (compatible with bash 3.2 on macOS)
|
|
wait
|