chore(quota): drop the Command Code usage provider

Command Code's official API has no usage endpoints; the old usage source
was the unofficial studio API reached through a now-archived plugin, so
the tile could only ever fail for officially configured users. Removed
across server, shared UI, and the VS Code extension; the provider logo
fallback stays — it serves the model picker, not usage.
This commit is contained in:
Bohdan Triapitsyn
2026-08-26 19:29:04 +03:00
parent 067c6caf0c
commit c4df01f707
9 changed files with 5 additions and 329 deletions
@@ -17,7 +17,6 @@ const AUTH = JSON.stringify({
crof: { key: 'test-token' },
neuralwatt: { key: 'test-token' },
'opencode-go': { key: 'test-token' },
'command-code': { type: 'oauth', access: 'test-token' },
'zai-coding-plan': { key: 'test-token' },
deepseek: { key: 'test-token' },
anthropic: { access: 'test-token', refresh: 'test-refresh' },
@@ -104,57 +103,6 @@ describe('OpenCode Go quota provider (VS Code parity)', () => {
});
});
describe('Command Code quota provider (VS Code parity)', () => {
test('uses the OAuth access token and resolves server-backed limits', async () => {
const requests: Array<{ url: string; init?: RequestInit }> = [];
globalThis.fetch = (async (url: string, init?: RequestInit) => {
requests.push({ url, init });
return mockResponse(url.endsWith('/alpha/whoami')
? { org: { id: 'org/a' } }
: { credits: { monthlyCredits: 120 }, windowLimits: { fiveHour: { used: 25, cap: 100, resetAt: 1_776_000_000 } } });
}) as typeof fetch;
const result = await fetchQuotaForProvider('command-code');
assert.equal(result.ok, true);
assert.deepEqual(requests.map(({ url }) => url), [
'https://api.commandcode.ai/alpha/whoami',
'https://api.commandcode.ai/alpha/billing/credits?orgId=org%2Fa',
]);
assert.equal((requests[0].init?.headers as Record<string, string>).Authorization, 'Bearer test-token');
assert.equal(result.usage!.windows['5h']!.usedPercent, 25);
assert.equal(result.usage!.windows.monthly_credits!.valueLabel, '120');
});
test('omits orgId for personal accounts', async () => {
const urls: string[] = [];
globalThis.fetch = (async (url: string) => {
urls.push(url);
return mockResponse(url.endsWith('/alpha/whoami')
? { user: { id: 'user-1' }, org: null }
: { credits: { monthlyCredits: 120 } });
}) as typeof fetch;
const result = await fetchQuotaForProvider('command-code');
assert.equal(result.ok, true);
assert.deepEqual(urls, [
'https://api.commandcode.ai/alpha/whoami',
'https://api.commandcode.ai/alpha/billing/credits',
]);
});
test('formats fractional credit values for display', async () => {
globalThis.fetch = (async (url: string) => mockResponse(url.endsWith('/alpha/whoami')
? { org: null }
: { credits: { monthlyCredits: 69.7947070034 }, windowLimits: { fiveHour: { used: 0.2052929966, cap: 14 } } })) as typeof fetch;
const result = await fetchQuotaForProvider('command-code');
assert.equal(result.usage!.windows.monthly_credits!.valueLabel, '69.79');
assert.equal(result.usage!.windows['5h']!.valueLabel, '0.21 / 14');
});
});
describe('Crof quota provider (VS Code parity)', () => {
test('reports credits balance as valueLabel with null percent', async () => {