feat(desktop): add a setting to show the Usage button in the sidebar
What & why
Adds an opt-in Usage button below Pull requests in the expanded and collapsed desktop sidebar. The Show usage tab on sidebar switch sits alongside the Token usage and Machine resources tabs in Settings > Usage. Clicking the sidebar button opens the last visited Usage section. The setting defaults off and persists through local SQLite, desktop tRPC, and the CLI.
Usage history and quota results remain cached for 24 hours while the app is open, with five-minute freshness. Returning to Usage retains the previous content during background scans and shows a scan indicator. Range changes can reuse the same host's chart; changing hosts cannot reuse another host's results.
Also fixes CLI settings writes on legacy profiles to update the existing singleton row atomically, addressing the outstanding review finding. The sidebar switch remains disabled until its saved value is known.
How I tested it
- macOS Electron over CDP: default off, enable/disable, expanded and collapsed navigation, remembered Usage subsection, toggle alignment, and previous chart/account content during an intentionally delayed background refresh.
- Desktop typecheck, i18n extraction/strict compilation, changed-file Biome checks, and plugin validation passed.
- CLI settings: 47 tests passed, including the legacy-row write regression.
- Usage cache: 3 regression tests passed; settings search: 13 passed; i18n: 119 passed.
- Earlier full desktop run: 3,487 passed, one unrelated marketing-URL-dependent LeaderboardRank failure; its five tests passed with the expected marketing URL.
- GitHub CI is being run for the final revision before merge.
Checklist
- Updated translations across all supported locales
- Verified the real macOS desktop flow
- Addressed the legacy settings row review finding
Summary by CodeRabbit
-
New Features
- Added a setting to show or hide the Usage tab in the home sidebar.
- Usage navigation now returns users to their previously viewed Usage section.
- Added a “Scanning transcript logs…” status indicator while usage data refreshes.
- Usage preferences are now available through the CLI settings registry.
-
Bug Fixes
- Improved usage-history and quota data retention when navigating or refreshing.
-
Localization
- Added and updated Usage sidebar translations across supported languages.