Files
archy/packages/app/scripts/dev.sh
T

30 lines
695 B
Bash
Raw Normal View History

#!/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)"
cleanup() {
# Kill all child processes
kill 0 2>/dev/null || true
wait 2>/dev/null || true
}
trap cleanup EXIT INT TERM
# Start Claude proxy in background
npx tsx "$APP_DIR/server/claude-proxy.ts" &
PROXY_PID=$!
# Give proxy a moment to bind port
sleep 0.3
# Start Vite dev server in foreground
npx vite --host &
VITE_PID=$!
# Wait for either to exit — then cleanup kills both
wait -n $PROXY_PID $VITE_PID 2>/dev/null || true