Commit Graph

2 Commits

Author SHA1 Message Date
teernisse
35fae37ba4 feat: overhaul TUI dashboard with subscription data, new tabs, and setup wizard
Major rewrite of the Bubble Tea dashboard, adding live claude.ai
integration and splitting the monolithic app.go into focused tab modules.

App model (app.go):
- Integrate claudeai.Client for live subscription/rate-limit data
- Add SubDataMsg and async fetch with periodic refresh (every 5 min)
- Add spinner for loading states (charmbracelet/bubbles spinner)
- Integrate huh form library for in-TUI setup wizard
- Rework tab routing to dispatch to dedicated tab renderers
- Add compact layout detection for narrow terminals (<100 cols)

TUI setup wizard (setup.go):
- Full huh-based setup flow embedded in the TUI (not just CLI)
- Three-step form: credentials, preferences (time range + theme), confirm
- Pre-populates from existing config, validates session key prefix
- Returns to dashboard on completion with config auto-saved

New tab modules:
- tab_overview.go: summary cards (sessions, prompts, cost, time), daily
  activity sparkline, rate-limit progress bars from live subscription data
- tab_breakdown.go: per-model usage table with calls, input/output tokens,
  cost, and share percentage; compact mode for narrow terminals
- tab_costs.go: cost analysis with daily cost chart, model cost breakdown,
  cache efficiency metrics, and budget tracking with progress bar

Rewritten tabs:
- tab_sessions.go: paginated session browser with sort-by-cost/tokens/time,
  per-session detail view, model usage breakdown per session, improved
  navigation (j/k, enter/esc, n/p for pages)
- tab_settings.go: updated to work with new theme struct and config fields
2026-02-20 16:08:26 -05:00
teernisse
a04a0065a0 feat: add root TUI app model with 10-tab dashboard and async data loading
Add the core App Bubble Tea model that orchestrates the entire TUI
dashboard. The model manages:

- 10 navigable tabs: Dashboard, Costs, Sessions, Models, Projects,
  Trends, Efficiency, Activity, Budget, and Settings. Each tab is
  accessible via single-key shortcuts (d/c/s/m/p/t/e/a/b/x) or
  left/right arrows for sequential navigation.

- Async data pipeline: launches the JSONL loader in a goroutine and
  receives progress updates via a channel subscription, displaying
  an animated loading screen with a spinner and file count. Data
  loads once on startup and recomputes aggregates when filters change.

- Filter state: supports configurable time range (7/30/90 days),
  project filter, and model filter. Changing any filter triggers
  recomputation of all derived stats (summary, daily, model, project
  breakdowns) including a comparison period for delta calculations.

- First-run detection: if no config file exists when data finishes
  loading, automatically enters the setup wizard flow before showing
  the dashboard.

- Tab-specific rendering: Dashboard shows metric cards with period-
  over-period deltas, daily token/cost bar charts, model pie-style
  breakdown, and top projects. Costs shows a per-model cost table.
  Trends renders daily tokens, cost, and session bar charts.
  Efficiency shows cache hit rate and savings metrics. Activity
  renders an hourly heatmap. Budget tracks spend against plan limits
  with a burn-rate projection chart.

- Help overlay: toggleable help panel listing all keyboard shortcuts,
  rendered as a centered overlay above the active tab content.
2026-02-19 15:38:43 -05:00