mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-12-01 08:59:32 +01:00
feat(copilot): plan-usage chip row for the monthly premium-request quota (#662)
Squash of PR #662. The header plan-usage chip gains a Copilot row: the calendar-month premium-request quota, with the request counts and the reset in the tooltip, read every 10 minutes from GitHub's copilot_internal/user endpoint with the Copilot CLI's own sign-in token. It rides showPlanUsageLimits and is on by default while the CLI is installed and signed in; any failure leaves the chip without the row. Merge-time fixes by the maintainer: the gates (setting, then token, then the CLI probe) live in readCopilotPlanUsageIfEnabled() so a host with no Copilot sign-in never runs the login-shell probe each tick, with a test that Plan Usage Limits off means no request; the X-GitHub-Api-Version header the Copilot CLI itself does not send is dropped; and CLAUDE.md, architecture-invariants, README and copilot-integration describe the read. The hooks-config import in server.ts was merged with #666's. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f80f107445
commit
34cf798b10
22 files changed
+642
-26
No files matched your search
@@ -16,3 +16,16 @@ it('preserves the Codex row when a later Claude status-line sample arrives', ()
|
||||
codex: { sevenDay: { usedPercentage: 40, resetAt: 3000 } },
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves the Copilot row when a later Claude status-line sample arrives', () => {
|
||||
const module = latestModule as Record<string, unknown>;
|
||||
const setCopilot = module.setLatestCopilotPlanUsage as (value: unknown) => unknown;
|
||||
const setClaude = module.setLatestPlanUsage as (value: Record<string, unknown>) => unknown;
|
||||
|
||||
setCopilot({ monthly: { usedPercentage: 12, resetAt: 5000, used: 36, limit: 300 } });
|
||||
expect(setClaude({ sessionId: 's2', fiveHour: { usedPercentage: 50, resetAt: 2000 } })).toMatchObject({
|
||||
sessionId: 's2',
|
||||
fiveHour: { usedPercentage: 50, resetAt: 2000 },
|
||||
copilot: { monthly: { usedPercentage: 12, resetAt: 5000, used: 36, limit: 300 } },
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user