cc-dashboard/AGENTS.md
Vadym Samoilenko 162f4ba822 feat: AI assistant widget, design system upgrade via 21st-dev Magic
Backend:
- Add AI assistant service with gap detection, anomaly analysis, Anthropic tool_use streaming
- Add assistant router (chat SSE, history, flags CRUD, session categorization)
- Fix agentic loop: text+tool_use in single assistant message per Anthropic spec
- Migrate logging from stdlib to structlog in assistant modules
- Fix migration 0005: UUID type for ai_flags/assistant_messages FKs

Frontend:
- Fix vite base path → /cc-dashboard/static/ to match FastAPI StaticFiles mount
- Redesign Sidebar: gradient background, amber gradient active state, 44px touch targets, user avatar
- Redesign KpiCard: corner decorations, ring border, trend icon, baseline bar (21st.dev pattern)
- Redesign TopBar: backdrop-blur, sticky, gradient user avatar, sign-out button
- Improve AssistantWidget: fix setInterval leak, aria-labels, proper markdown block parser
- Fix AssistantWidget renderMarkdown: line-by-line parser for correct list/header nesting

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 19:34:17 +01:00

2.7 KiB

CC Dashboard — Project Entry Point

What Is This Project

FastAPI + PostgreSQL personal productivity dashboard that ingests Claude Code session data (via a stop hook), aggregates it into daily stats, and displays KPIs, timeline, project breakdown, tool usage, and session activity through a single-page web UI with JWT authentication.

Client: Oliver Internal (Vadym Samoilenko — personal tooling) Server: unknown URL: unknown (base path /cc-dashboard)


Quick Navigation

Need Go to
FastAPI app entry point + routers src/main.py
App config and env var schema src/config.py
SQLAlchemy models (Project, Session, DailyStat) src/models/
Pydantic response schemas src/schemas/
Auth router (login, refresh, JWT) src/routers/auth.py
Dashboard aggregation endpoints src/routers/dashboard.py
Data ingest endpoint (session stop hook) src/routers/ingest.py
Project management endpoints src/routers/projects.py
API key management src/routers/keys.py
Admin routes src/routers/admin.py
Event endpoints src/routers/events.py
Database init and session factory src/database.py
SPA frontend (static HTML/JS/CSS) src/static/index.html
Docker compose (app + postgres:16) docker-compose.yml
Environment config template .env.example
Python dependencies requirements.txt

Dev Commands

Action Command
Start full stack (Docker) docker compose up -d
Rebuild after code changes docker compose up -d --build
Stop stack docker compose down
View logs docker compose logs -f app
Run migrations (Alembic) docker compose exec app alembic upgrade head
Run locally without Docker uvicorn src.main:app --host 0.0.0.0 --port 8800 --reload
Copy env cp .env.example .env (fill DB_PASSWORD, SECRET_KEY)

Key Constraints

  • NO SSH to server without explicit user instruction
  • SECRET_KEY must be at least 32 random chars — never use the placeholder
  • DB_PASSWORD must be changed from change_me_strong_password before deployment
  • JWT tokens: access = 30 min, refresh = 7 days (configurable in .env)
  • Base path is /cc-dashboard — all routes and SPA fallback are scoped to this prefix
  • Static files hot-reload without rebuild: src/static/ is bind-mounted in Docker
  • Overlap-union dedup: session hours use interval union per day to prevent double-counting parallel sessions (see _union_hours in dashboard.py)
  • PostgreSQL 16 required — uses to_char and extract('dow') PG-specific functions