feat(cli): add codegraph usage command to show AI balance and recent usage

Adds a `usage` subcommand that pings `/v1/usage` with the stored token and
displays balance, plan, 30-day explore/token counts, and allowance reset date.

Degrades quietly in all non-happy-path states — signed out, BYO endpoint, or
unreachable server — so managed reasoning remaining optional doesn't change.

Also extends `OffloadUsage` with the fields the endpoint already returns
(`unlimited`, `banned`, `tokensLast30`, `callsLast30`, `creditsLast30`) that
were previously untyped.
This commit is contained in:
Colby McHenry
2026-06-18 01:22:58 -05:00
parent 193722de45
commit c9e207a0f2
2 changed files with 49 additions and 1 deletions
+5
View File
@@ -47,6 +47,11 @@ export interface OffloadUsage {
overage?: number;
remaining?: number;
periodEnd?: number;
unlimited?: boolean;
banned?: boolean;
tokensLast30?: number;
callsLast30?: number;
creditsLast30?: number;
models?: string[];
}