Add lifetime full-history menubar trend across macOS, GNOME, and CLI#391
Add lifetime full-history menubar trend across macOS, GNOME, and CLI#3910monish wants to merge 1 commit into
Conversation
Keep Lifetime uncapped in the menubar payload, add adaptive monthly/quarterly/yearly trend aggregation, and extend the macOS menubar status-period setting to support Lifetime.
|
Thanks for the thorough work here, especially the adaptive trend cadences and the cross-surface coverage. However, we're going in a different direction for the period strip. We're adding a custom calendar popover (inline calendar icon after "6 Months") that lets users pick arbitrary dates — single days or non-contiguous multi-day selections. With that in place, adding a "Lifetime" tab explicitly creates too much congestion in the strip: The strip is already tight, and "Lifetime" as a permanent tab doesn't earn its space when the calendar picker can already cover any date range the user wants. What we'd accept instead: put Lifetime as an option under Settings — if the user enables it, it replaces "6 Months" with "Lifetime" in the strip. That way users who want unbounded history get it, without adding visual clutter for everyone else. The trend cadence work (intraday buckets for Today, weekly bars for 6 Months, adaptive monthly/quarterly/yearly for long ranges) is solid and could land separately once we sort out the Lifetime UX question. |
|
Also — this PR touches 24 files across 4 surfaces (CLI, macOS menubar, GNOME, docs) with 1800+ additions. That's hard to review as a single unit. Would you be open to splitting this into separate PRs? For example:
Each surface can land and be tested independently. Smaller PRs are easier to review and less likely to have merge conflicts pile up. |
|
One more thing — the adaptive trend bars for Lifetime (monthly/quarterly/yearly) aren't something we'd want in the menubar. The popover is a small screen and cramming months or years of bars into it just creates visual clutter without being useful. Lifetime in the menubar should just show the aggregate stats (total spend, calls, top models) without a trend chart. The trend section can simply be hidden when Lifetime is active. That removes a big chunk of the complexity in this PR. |
Yes Sure |
First of all welcome and I love this tool thank you. And I was also thinking for that calendar view earlier then I ended up with this, no issues I will put it in the settings. |
NOTED 🫡 |
Issue Reference
Proposed issue reference:
#389Summary
8total.2Lifetime correctness fixes (Lifetimeperiod wiring + uncapped/full-history semantics)6desktop menubar follow-up fixes (Trend cadence mismatch,LifetimeStats semantics, Top Projects session-count contrast, backward-compatiblestatspayload decoding, GNOME period-aware chart/trend rendering, and period-appropriate visualization)4product surfaces +2docs surfaces.5core validations completed.What Changed
Today, using6 x 4-hourbuckets.Today:6 x 4-hourbuckets7 Days: daily bars30 Days: daily barsMonth: month-to-date daily bars6 Months: weekly bars acrossRecent 26 weeksLifetime: adaptive full-history bars<= 24 months: monthly<= 60 months: quarterly> 60 months: yearlyLifetimeStats all-time withTracked spend (all time).Lifetime, since there is no sensible fixed prior-window comparison once the chart spans full history.Lifetime, so the always-visible status item can track the same uncapped period independently from the popover.statsblock.Trend Window Approach
For this compact popover UI, I found that forcing every period into daily bars did not feel like the best tradeoff. The bars become visually dense, hover targets get worse, and the chart communicates the trend less clearly.
In this PR, I used the following approach:
Todayuses intraday buckets instead of a single daily bar.6 Monthsuses weekly aggregation so the full half-year can fit cleanly.Lifetimeuses full-history aggregation rather than a fixed recent window:My goal here was to keep each selected period semantically correct while still keeping the chart legible. If there is a better presentation for any of these windows, I am very open to adjusting it.
Testing
npm testpassesnpm run buildsucceedsAdditional validation performed:
npm testnpm test -- --run tests/menubar-json.test.ts tests/gnome-trend-series.test.ts tests/cli-status-menubar.test.ts2024/2025/2026dataset.Today,6 Months, andLifetimemonthly/quarterly/yearly aggregation.--provider claude.swift buildpassed after the Trend aggregation refactor.swift testnow runs under an explicitswift-testingpackage dependency inmac/Package.swift.Lifetimeselection and suffix rendering.Lifetime.Lifetimeand render adaptive monthly/quarterly/yearly bars based on full history.Lifetimeas a selectable default period.Todaynow shows6 x 4-hourbars withAvg/4h,Peak slot, andCurrent 4h7 Daysnow showsLast 7 days6 Monthsnow showsRecent 26 weekswith weekly bars61tracked days) now showsLifetimeasAll time by month2024-2026data showsLifetimeasAll time by quarter2020-2026data showsLifetimeasAll time by yearLifetimeStats now showsTracked spend (all time)2023-2026snapshot showsLifetimeasAll time by quarter2020-2026snapshot showsLifetimeasAll time by yearScreenshots