Files
tesla-roadtrip/scripts/dev.sh
T
tony 89b24d4c34 feat: wire build/test infra, trips API, and enriched journey stops
- Add tsconfig.json (server) + client/tsconfig.{json,app.json,node.json}
  so typecheck and tsc -b actually work.
- Fix npm test to run Playwright (was running vitest on Playwright specs);
  typecheck now covers both server and client.
- Mount routes before app.listen, add error handler, mount optional
  @tonycodes/auth-express middleware when AUTH_SECRET is set.
- Add /api/trips (GET/POST/PATCH/DELETE) backed by an in-memory store
  that gracefully degrades when DATABASE_URL is unset.
- Add prisma/seed.ts skeleton and server/types/express.d.ts for req.auth.
- Rewrite Grok prompt for combo-aware planning: charge+eat,
  stay+destination-charging, eat+viewpoint, etc., with amenities,
  cuisine, priceLevel, duration, day titles and trip highlights.
- Extend Stop schema + normalization to preserve all enrichment fields.
- New StopCard component renders combo pill, description, meta row
  (charge / stop / battery / cuisine / £-level) and amenity icons;
  map popups show the same enriched detail; timeline gains day titles
  and a HIGHLIGHTS sidebar.
- Fix server TS errors (vehicle accepted as string | {name,rangeKm},
  JSON parse results typed).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 10:32:53 +01:00

77 lines
2.5 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# One-command development script for Tesla Roadtrip
# Usage: ./scripts/dev.sh
#
# This script now prefers your personal authenticated Grok CLI (~/.grok/bin/grok)
# for local development (free + full Heavy capabilities).
# The xAI API key is still used for production deploys and when FORCE_XAI_API=true.
set -e
echo "🚀 Starting Tesla Roadtrip development environment..."
# Load .env if it exists
if [ -f .env ]; then
set -a
source .env
set +a
fi
# === Detect which Grok provider will be active ===
LOCAL_GROK_BIN="${GROK_BIN:-$HOME/.grok/bin/grok}"
HAS_LOCAL_GROK=false
HAS_AUTH=false
if [ -x "$LOCAL_GROK_BIN" ]; then
HAS_LOCAL_GROK=true
fi
if [ -f "$HOME/.grok/auth.json" ]; then
HAS_AUTH=true
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
if [ "$FORCE_XAI_API" = "true" ]; then
echo "🔑 FORCE_XAI_API=true → Using xAI API (grok-4.3) for this session"
echo " (Good for testing the exact production path locally)"
elif [ "$HAS_LOCAL_GROK" = true ] && [ "$HAS_AUTH" = true ]; then
echo "✅ LOCAL PERSONAL GROK CLI (Heavy)"
echo " Binary : $LOCAL_GROK_BIN"
echo " Auth : ~/.grok/auth.json (your personal account)"
echo " Mode : web_search + high effort — free + powerful for iteration"
echo ""
echo " All local testing (dev.sh, iterate.sh, Playwright) will use YOUR Grok account."
elif [ "$HAS_LOCAL_GROK" = true ]; then
echo "⚠️ Local grok binary found but no ~/.grok/auth.json"
echo " → Run 'grok login' in your terminal first, then restart dev.sh"
echo " Falling back to xAI API (if key present)"
else
echo "️ No local grok binary at $LOCAL_GROK_BIN"
echo " Using xAI API instead (if XAI_API_KEY is set)"
fi
if [ -n "$XAI_API_KEY" ]; then
echo ""
echo " XAI_API_KEY is present (will be used for production + FORCE_XAI_API mode)"
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Starting Backend + Frontend..."
echo " Backend: http://localhost:3000"
echo " Frontend: http://localhost:5173"
echo ""
# Run both with nice colored labels
npx concurrently \
-n "BACKEND,FRONTEND" \
-c "cyan,green" \
--kill-others-on-fail \
"npm run dev:server" \
"npm --prefix client run dev"