feat: add Claude plan usage stat card to Command Center#19
Open
sj-unit72 wants to merge 1 commit intoMeisnerDan:mainfrom
Open
feat: add Claude plan usage stat card to Command Center#19sj-unit72 wants to merge 1 commit intoMeisnerDan:mainfrom
sj-unit72 wants to merge 1 commit intoMeisnerDan:mainfrom
Conversation
Shows 5-hour session and 7-day window utilization directly in the dashboard stats bar, with OAuth PKCE sign-in built into the card. - New `src/app/api/claude-auth/route.ts` — OAuth PKCE flow (start / exchange / signout), stores token in data/claude-oauth-token - New `src/app/api/claude-usage/route.ts` — fetches from https://api.anthropic.com/api/oauth/usage with anthropic-beta header - New `src/lib/claude-token.ts` — shared token loader used by both routes - Command Center stats bar: 5th card shows progress bars for 5h session and 7d window usage; turns orange above 80%; click to connect when unauthenticated; inline code-paste flow for OAuth exchange - 30-minute sessionStorage cache to avoid rate limiting (429 handled gracefully with backoff message instead of error) - Brain dump card gets h-full so it stretches correctly alongside the taller Claude plan card Co-Authored-By: Serge Jespers <serge@unit72.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Claude Plan Usage card to the Command Center stats bar, showing your 5-hour session and 7-day window utilization directly on the dashboard — no external app needed.
client_id: 9d1c250a-e61b-44d9-88ed-5944d1962f5e) to authenticatehttps://api.anthropic.com/api/oauth/usagewithanthropic-beta: oauth-2025-04-20sessionStoragecache prevents rate limiting on page navigationNew files
src/app/api/claude-auth/route.ts— OAuth PKCE (start / exchange / signout)src/app/api/claude-usage/route.ts— proxies the Anthropic usage endpointsrc/lib/claude-token.ts— shared file-based token loaderChanges
src/app/page.tsx— 5th stat card, grid updated tolg:grid-cols-5, brain dump card getsh-fullTest plan
code#statestring → card shows usage bars🤖 Generated with Claude Code