This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
When working on a new feature:
- Create a new branch before making any changes
- Make all commits on that feature branch
- Before opening a PR, run the
code-simplifieragent to clean up the code
npm run dev # Start dev server (localhost:5173)
npm run build # Build to /build directory
npm run preview # Preview production build (localhost:4173)
npm run check # TypeScript type checking
npm run check:watch # Type checking in watch mode
npm run test # Run Vitest in watch mode
npm run test:unit # Run unit tests once
npm run test:e2e # Run Playwright E2E tests (requires preview server)
npm run lint # ESLint + Prettier check
npm run format # Auto-format with Prettier- SvelteKit 2.0 with Svelte 5 reactivity (
$state,$derived,$effectrunes) - TypeScript (strict mode enabled)
- Tailwind CSS with custom dark theme
- Vitest (unit) + Playwright (E2E) for testing
- Static adapter - deploys as pure static site to GitHub Pages
analysis/- Pattern correlation, narrative tracking, main character detection across news itemsapi/- Data fetching from GDELT, RSS feeds (30+ sources), market APIs, CoinGeckocomponents/- Svelte components organized into layout/, panels/, modals/, common/config/- Centralized configuration for feeds, keywords, analysis patterns, panels, map hotspotsservices/- Resilience layer: CacheManager, CircuitBreaker, RequestDeduplicator, ServiceClientstores/- Svelte stores for settings, news, markets, monitors, refresh orchestrationtypes/- TypeScript interfaces
$lib → src/lib
$components → src/lib/components
$stores → src/lib/stores
$services → src/lib/services
$config → src/lib/config
$types → src/lib/typesAll HTTP requests go through ServiceClient which integrates:
- CacheManager: Per-service caching with TTL
- CircuitBreaker: Prevents cascading failures
- RequestDeduplicator: Prevents concurrent duplicate requests
Data fetches happen in 3 stages with staggered delays:
- Critical (0ms): News, markets, alerts
- Secondary (2s): Crypto, commodities, intel
- Tertiary (4s): Contracts, whales, layoffs, polymarket
Unique business logic for intelligence analysis:
- Correlation detection across disparate news items
- Narrative tracking (fringe → mainstream progression)
- Entity prominence calculation ("main character" analysis)
- All use configurable regex patterns from
src/lib/config/analysis.ts
feeds.ts: 30+ RSS sources across 6 categories (politics, tech, finance, gov, ai, intel)keywords.ts: Alert keywords, region detection, topic detectionanalysis.ts: Correlation topics and narrative patterns with severity levelspanels.ts: Panel registry with display ordermap.ts: Geopolitical hotspots, conflict zones, strategic locations
Unit tests: Located alongside source as *.test.ts or *.spec.ts
E2E tests: In tests/e2e/*.spec.ts, run against preview server
GitHub Actions workflow builds with BASE_PATH=/situation-monitor and deploys to GitHub Pages at https://hipcityreg.github.io/situation-monitor/
- D3.js for interactive map visualization
- CORS proxy (Cloudflare Worker) for RSS feed parsing
- CoinGecko API for cryptocurrency data