Skip to content

feat: add shareable usage cards - #98

Merged
ericjypark merged 1 commit into
mainfrom
codex/shareable-usage-cards
Sep 11, 2026
Merged

ericjypark merged 1 commit into
mainfrom
codex/shareable-usage-cards

Conversation

@ericjypark

@ericjypark ericjypark commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Add a native usage-card studio from Overview and Settings. Users can spotlight estimated API value or tokens, choose five date ranges, filter providers, add a signature, and export feed, square, or story images. White, Black, and Blue cards are earned from the selected metric; the cumulative chart, provider totals, and captions all use the same selected history.

Cards support native macOS sharing, PNG saving, image/caption copying, and an actual-size preview. Missing prices and recovered daily totals remain explicit, and API value is identified as an estimate rather than a subscription bill. Existing users see the card once after an update when usage is ready; fresh installs and normal restarts do not repeatedly open it.

Validation: the full repository test runner passes, including 126 card assertions and all archive/recovery checks. The production app builds for Intel and Apple Silicon with the existing version, bundle identity, and Sparkle configuration. The rendering harness verifies 48 images across formats, metrics, earned colors, longer date ranges, and edge cases, plus native sharing content and clipboard image round trips. The final integrated build was also checked in the native card and recovery interfaces.

GitHub security scan passes. The optional Claude review could not execute because its CI account returned HTTP 403 (oauth_org_not_allowed); it produced no review findings. Manual review and all local checks above completed before merge.

Summary by CodeRabbit

  • New Features

    • Added shareable usage cards with API-value or token views, selectable periods, formats, themes, signatures, captions, and provider filters.
    • Cards can be copied, shared through macOS, or saved as PNG images.
    • Added usage-card access from Overview and Settings, with an automatic weekly-card prompt after app updates when usage is available.
    • Usage history is retained locally for recovery and remains on-device without storing conversations or credentials.
  • Documentation

    • Updated English and Simplified Chinese documentation with usage-card, privacy, and recovery details.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: e5d05ef1-9af1-4ca6-8a0d-8a5d7b608a18

📥 Commits

Reviewing files that changed from the base of the PR and between b5bbd84 and 84bfc86.

📒 Files selected for processing (25)
  • README.md
  • README.zh-CN.md
  • Resources/en.lproj/Localizable.strings
  • Resources/zh-Hans.lproj/Localizable.strings
  • Sources/App.swift
  • Sources/Cost/CostStore.swift
  • Sources/Sharing/WeeklyCardExporter.swift
  • Sources/Sharing/WeeklyCardHistoryStore.swift
  • Sources/Sharing/WeeklyCardLaunchGate.swift
  • Sources/Sharing/WeeklyCardShareButton.swift
  • Sources/Sharing/WeeklyCardStudio.swift
  • Sources/Sharing/WeeklyCardStyle.swift
  • Sources/Sharing/WeeklyCardTier.swift
  • Sources/Sharing/WeeklyCardWindowController.swift
  • Sources/Sharing/WeeklyUsageCard.swift
  • Sources/Sharing/WeeklyUsageSnapshot.swift
  • Sources/Views/PanelFooter.swift
  • Sources/Views/Settings/SegmentedControl.swift
  • Sources/Views/SettingsView.swift
  • Tests/WeeklyCardRenderHarness.swift
  • Tests/WeeklyUsageSnapshotTests.swift
  • docs/USAGE-HISTORY.md
  • scripts/preview-weekly-card.sh
  • scripts/run-tests.sh
  • scripts/test-weekly-card.sh

📝 Walkthrough

Walkthrough

The PR adds a macOS weekly usage card. It aggregates local provider history, supports multiple metrics and periods, renders themed cards, provides sharing and PNG export, adds launch and settings entry points, and includes tests, preview tooling, localization, and documentation.

Changes

Weekly usage card

Layer / File(s) Summary
Usage model and card rendering
Sources/Cost/CostStore.swift, Sources/Sharing/WeeklyUsageSnapshot.swift, Sources/Sharing/WeeklyCardTier.swift, Sources/Sharing/WeeklyCardStyle.swift, Sources/Sharing/WeeklyUsageCard.swift
Adds usage periods, API-value and token metrics, milestone and tier calculations, provider totals, cumulative charts, themed layouts, and demo pricing data.
History loading and launch integration
Sources/Sharing/WeeklyCardHistoryStore.swift, Sources/Sharing/WeeklyCardLaunchGate.swift, Sources/App.swift, Sources/Sharing/WeeklyCardWindowController.swift, Sources/Views/PanelFooter.swift, Sources/Views/SettingsView.swift
Retains provider history, loads daily buckets, gates post-update launches, and adds Overview and Settings entry points.
Card studio and export actions
Sources/Sharing/WeeklyCardStudio.swift, Sources/Sharing/WeeklyCardExporter.swift, Sources/Sharing/WeeklyCardShareButton.swift, Resources/*/Localizable.strings, Sources/Views/Settings/SegmentedControl.swift
Adds card configuration, preview states, recovery and pricing notices, sharing, clipboard copying, PNG saving, and localized controls.
Validation, scripts, and documentation
Tests/*WeeklyCard*, Tests/WeeklyUsageSnapshotTests.swift, scripts/*weekly-card*, scripts/run-tests.sh, README*.md, docs/USAGE-HISTORY.md
Adds render and snapshot tests, preview and test scripts, usage-history updates, and English and Chinese feature documentation.

Estimated code review effort: 4 (Complex) | ~60 minutes

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/shareable-usage-cards

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ericjypark
ericjypark merged commit 8ce6dcb into main Sep 11, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant