Commit graph

5 commits

Author SHA1 Message Date
Vadym Samoilenko
38d7da93e2 fix(auth): restore session before registering router to prevent refresh redirect
- Move app.use(router) after await authStore.init() so the beforeEach guard
  sees the correct isAuthenticated state on page load
- Fix backfill_session_costs._root_prefix: remove underscore→dash replacement
  that caused paths like /Users/ai_leed/... to not match ~/.claude/projects/ folders

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 14:14:27 +01:00
Vadym Samoilenko
fde9b61465 feat(cost): track Claude Code token usage and cost per project
- cc-collector.py: extract input/output/cache tokens from JSONL usage
  fields and calculate cost_usd using model-based pricing table
- Session model: add input_tokens, output_tokens, cost_usd columns
- Migration 0010: ALTER TABLE sessions ADD cost columns
- Ingest: persist cost fields on upsert (updated on every sync)
- Dashboard /projects: aggregate total_cost_usd per project from sessions
- ProjectHours schema + ProjectSummary TS type: expose total_cost_usd
- ProjectsView: replace Budget% column with "Cost $" showing total spend;
  Grid cards show CC Cost row when cost > 0
- backfill_session_costs.py: one-time script to populate cost for all
  historical sessions from local JSONL files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 12:47:26 +01:00
Vadym Samoilenko
26127061ec fix: OMG auto-sync, Projects OMG# column, ADO OMG Deliverable Number, session persistence
- Auto-create/update OmgEntry when Project.job_number changes (PATCH /api/projects);
  delete stale entry on clear; sync name/client when those fields change too
- Backfill script: scripts/backfill_omg_from_projects.py
- Projects List-view: add OMG # column with link to /omg?highlight=<job_number>;
  Grid-view badge also made clickable; OmgView supports ?highlight= deep-link with scroll+highlight
- AzureWorkItem: add omg_number column (migration 0009), extracted from
  fields_json[Custom.OMGDeliverableNumber] on sync; DevOps table shows OMG # column
  with CC-project link when matched; toolbar badge shows count of items without OMG #
- Session no longer lost on F5: refresh_token moved to HttpOnly+SameSite=Lax cookie;
  authStore.init() restores session on app start; axios interceptor retries on 401
  via cookie refresh before logging out; POST /api/auth/logout clears cookie

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 12:30:40 +01:00
Vadym Samoilenko
96e6f4ee14 feat: replace local auth with Azure AD SSO (MSAL PKCE)
- New POST /api/auth/microsoft endpoint validates Azure ID token via JWKS
- Removed POST /api/auth/login and /change-password
- Added azure_oid + nullable password_hash to users (migration 0007)
- Auto-provisions all @oliver.agency accounts on first SSO login
- Case-insensitive email matching links existing vadymsamoilenko@ account
- DEV_AUTH_BYPASS flag for local development without MSAL
- Frontend: MSAL loginPopup replaces email/password form
- Added scripts/grant_admin.py for role management

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 10:43:19 +01:00
Vadym Samoilenko
7b30880d44 Initial commit — CC Dashboard v1.0
Multi-tenant Claude Code monitoring dashboard.
FastAPI + PostgreSQL + Docker + SSE real-time updates.
Montserrat font, black/#FFC407 color scheme.
Apache reverse proxy config at /cc-dashboard/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 12:54:47 +00:00