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>
This commit is contained in:
2026-05-19 10:32:53 +01:00
parent d516e93323
commit 89b24d4c34
24 changed files with 1263 additions and 243 deletions
+13 -3
View File
@@ -1,17 +1,27 @@
import 'dotenv/config';
const home = process.env.HOME || process.env.USERPROFILE || '';
const defaultGrokBin = process.env.GROK_BIN
|| (home ? `${home}/.grok/bin/grok` : '')
|| '/usr/local/bin/grok';
export const env = {
port: parseInt(process.env.PORT || '3000', 10),
nodeEnv: process.env.NODE_ENV || 'development',
appUrl: process.env.APP_URL || 'https://tesla-roadtrip.test',
apiUrl: process.env.API_URL || 'https://tesla-roadtrip.test',
apiUrl: process.env.API_URL || 'https://api.tony.codes',
// Auth
authSecret: process.env.AUTH_SECRET || '',
authUrl: process.env.AUTH_URL || 'https://auth.tony.codes',
authClientId: process.env.AUTH_CLIENT_ID || 'tesla-roadtrip',
// Grok / xAI
grokBin: process.env.GROK_BIN || '/usr/local/bin/grok',
// Database (optional — trips persist to memory if unset)
databaseUrl: process.env.DATABASE_URL || '',
// Grok / xAI — local personal CLI (your authenticated Heavy account) is preferred for development
grokBin: defaultGrokBin,
xaiApiKey: process.env.XAI_API_KEY || '',
grokEnabled: process.env.GROK_ENABLED !== 'false',
forceXaiApi: process.env.FORCE_XAI_API === 'true',
} as const;