Skip to main content

expensive/
lib.rs

1//! Terminal dashboard for OpenCode token usage and spend.
2//!
3//! `expensive` is primarily a binary crate. It provides a Ratatui-based TUI
4//! that reads OpenCode's local SQLite database directly and aggregates assistant
5//! message usage into daily, weekly, monthly, and all-time views.
6//!
7//! The public modules are exposed to keep the binary small and testable. They
8//! cover configuration, OpenCode database aggregation, time-window calculation,
9//! formatting, application state, and terminal rendering.
10//!
11//! The usage data comes from OpenCode's stored assistant message fields such as
12//! `cost`, `tokens.input`, `tokens.output`, `tokens.cache.read`,
13//! `tokens.cache.write`, `providerID`, `modelID`, and `variant`.
14//!
15//! For normal use, install and run the `expensive` binary:
16//!
17//! ```text
18//! cargo install --locked expensive
19//! expensive
20//! ```
21
22pub mod app;
23pub mod config;
24pub mod db;
25pub mod format;
26pub mod time_window;
27pub mod tui;