feat(cli): codeburn quota command reading provider capacity from the CLI - #1227
Merged
Conversation
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.
First step of Windows menubar parity.
Provider quota/capacity reading lives only inside the Electron desktop app today (TypeScript adapters under
app/electron/quota/) and inside the macOS menubar (native Swift). Non-Mac surfaces, starting with the Windows Tauri tray, have no way to show it. This moves the reading into the CLI so every surface can consume one payload.What this adds
codeburn quotareads the six providers in parallel, each with a short timeout, and always exits 0:codeburn quotaprints a table of every provider and its windowscodeburn quota --format jsonprints the machine payload{ "providers": [ { "id", "name", "available", "plan?", "windows": [ { "label", "usedPct", "resetsAt?" } ], "error?" } ] }Add-only payload, per the CLI-app contract. A provider with no credentials on the machine is reported
available: falsewith noerrorfield, so an absent tool never reads as a failure.Adapters ported: Claude, Codex, Gemini, GitHub Copilot, Antigravity, Kimi, plus the shared credential-reading and keychain helpers. Read logic and credential discovery are unchanged from the Electron originals.
Two deliberate differences, both aimed at non-Mac surfaces:
psandlsof, which Windows has no equivalent of, so it reports a clean disconnected there instead of a spawn failure.~/.codex/auth.jsondirectly rather than preferring the macOS menubar's cached OAuth. That cache is read-only to this process and goes stale, which degraded a perfectly good on-disk credential to "temporarily unavailable".Electron copies untouched
app/electron/quota/is unchanged and is still what the desktop app runs, so this PR carries no regression risk for the desktop. The newsrc/quota/index.tsnames those files as the origin. The two trees get deduped in a follow-up once the surfaces read the CLI.Verification
npx vitest run tests/quota-providers.test.tsgreen (14 tests): one decode plus one unavailable path per provider, the JSON envelope shape, and the per-provider timeout. No test touches the network; fetch and file reads are injected.npx vitest run tests/quota.test.tsstill green (17 tests). That file covers the unrelatedsrc/quota.tspace model, which keeps its name.npx tsc --noEmitclean.node dist/main.js quota --format jsonon a Mac with real credentials returns in ~0.5s, exit 0, with Claude read from the keychain and Codex from disk.