Skip to content

[Suggestion] 30-day & 12-month sparkline trends in /usage #8

Closed

Description

@Wikijito7

Is your feature request related to a problem? Please describe.
The /usage dialog shows single-period numbers and a % change vs the previous period, but there is no way to see the overall trend — when you are busy, when you are quiet, how usage evolves across weeks.

Describe the solution you'd like
Add a "Trends" section to the /usage dialog:

  • New g key toggles the trends section for the currently selected granularity:
    • 30-day sparkline when in month view (one ▁▂▃▄▅▆▇█-style bar per day)
    • 12-month sparkline when in month view (one bar per month over the last year)
    • Weekly/daily views show a fitting window (e.g. 12 weeks / 30 days)
    • "Busiest day of week" line (e.g. "Peak: Wednesdays")
  • New pure helper makeSparkline(values: number[], height) in model-usage/helpers (adjacent to format.ts) + unit tests
  • New db helper queryDailyTotals(startMs, endMs) in model-usage/db.ts — single GROUP BY over the day (no per-row JS work)
  • Prefer existing hierarchy cache (days already built by buildHierarchy) before touching the DB

Describe alternatives you've considered

  • Third-party chart libs — rejected, no dependencies; ASCII block glyphs fit the TUI perfectly
  • Adding trends to the sidebar — rejected; sidebar stays compact

Additional context
The sparkline helper should be pure and reusable (candidate for opencode-wlib later).

Media
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions