Skip to content

feat: display cost summary in dashboard#11

Merged
sleipi merged 3 commits into
mainfrom
feat/cost-display
May 12, 2026
Merged

feat: display cost summary in dashboard#11
sleipi merged 3 commits into
mainfrom
feat/cost-display

Conversation

@sleipi
Copy link
Copy Markdown
Owner

@sleipi sleipi commented May 12, 2026

Summary

  • Add Overall$ row to the stats bar showing aggregated costs per time period (today / this week / this month / last month)
  • Show session-level total cost at the end of the token line on each session card
  • Add fmtCost() formatter with smart precision: 2 decimals for >= $0.01, 4 decimals for sub-cent amounts
  • New CostSummary interface and getCostSummary() query mirroring the existing TokenSummary pattern
  • All costs displayed in USD (implicit from OpenCode API, no currency metadata available)

Changes

  • src/db/message/message-repo.ts / sqlite-message-repo.tsCostSummary interface + prepared statement
  • src/dashboard/services/daily-tokens-service.ts — wire getCostSummary() through service
  • src/dashboard/templates/stats-bar.ts — new Overall$ row with orange badge
  • src/dashboard/templates/session-card.ts — cost at end of token line
  • src/dashboard/templates/formatters.tsfmtCost() helper
  • src/dashboard/templates/styles.ts — CSS for .mode-cost-overall and .cost-value
  • 6 test files updated, new tests for cost formatting, stats bar costs, and session card cost display

sleipi added 3 commits May 12, 2026 18:58
Add Overall$ row to stats bar showing aggregated costs per time period
(today/week/month/last month). Show session-level total cost at the end
of the token line on each session card. Costs are formatted with smart
precision (2 decimals for >= /bin/zsh.01, 4 decimals for sub-cent amounts).
@sleipi sleipi added the enhancement New feature or request label May 12, 2026
@sleipi sleipi merged commit 2ad2f89 into main May 12, 2026
6 checks passed
@sleipi sleipi deleted the feat/cost-display branch May 12, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant