mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-20 05:11:48 +00:00
Merge pull request #596 from kaitranntt/feat/refactor-hardcode-dx-one-pr
refactor(core): centralize hardcoded paths and command/provider sources
This commit is contained in:
30 files changed
+1364
-681
No files matched your search
@@ -144,6 +144,14 @@ describe('applyExtendedContextConfig', () => {
|
||||
expect(env.ANTHROPIC_MODEL).toBe('gemini-2.5-pro(high)[1m]');
|
||||
});
|
||||
|
||||
it('handles model IDs that already include both thinking and [1m] suffixes', () => {
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
ANTHROPIC_MODEL: 'gemini-2.5-pro(high)[1m]',
|
||||
};
|
||||
applyExtendedContextConfig(env, 'gemini', undefined);
|
||||
expect(env.ANTHROPIC_MODEL).toBe('gemini-2.5-pro(high)[1m]');
|
||||
});
|
||||
|
||||
it('handles empty env vars gracefully', () => {
|
||||
const env: NodeJS.ProcessEnv = {};
|
||||
applyExtendedContextConfig(env, 'gemini', undefined);
|
||||
@@ -164,8 +172,12 @@ describe('applyExtendedContextConfig', () => {
|
||||
it('strips [1m] suffix when --no-1m is explicit even if model has it', () => {
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
ANTHROPIC_MODEL: 'gemini-2.5-pro[1m]',
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: 'gemini-3-pro-preview[1m]',
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: 'gemini-2.5-pro[1m]',
|
||||
};
|
||||
applyExtendedContextConfig(env, 'gemini', false);
|
||||
expect(env.ANTHROPIC_MODEL).toBe('gemini-2.5-pro');
|
||||
expect(env.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe('gemini-3-pro-preview');
|
||||
expect(env.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe('gemini-2.5-pro');
|
||||
});
|
||||
});
|
||||
@@ -9,6 +9,10 @@ import {
|
||||
getProvidersByOAuthFlow,
|
||||
isCLIProxyProvider,
|
||||
mapExternalProviderName,
|
||||
QUOTA_SUPPORTED_PROVIDER_IDS,
|
||||
isQuotaSupportedProvider,
|
||||
QUOTA_PROVIDER_OPTION_VALUES,
|
||||
QUOTA_PROVIDER_HELP_TEXT,
|
||||
} from '../../../src/cliproxy/provider-capabilities';
|
||||
import {
|
||||
OAUTH_CALLBACK_PORTS as DIAGNOSTIC_CALLBACK_PORTS,
|
||||
@@ -63,9 +67,31 @@ describe('provider-capabilities', () => {
|
||||
expect(mapExternalProviderName('github-copilot')).toBe('ghcp');
|
||||
expect(mapExternalProviderName('copilot')).toBe('ghcp');
|
||||
expect(mapExternalProviderName('anthropic')).toBe('claude');
|
||||
expect(mapExternalProviderName(' COPILOT ')).toBe('ghcp');
|
||||
expect(mapExternalProviderName('')).toBeNull();
|
||||
expect(mapExternalProviderName('unknown-provider')).toBeNull();
|
||||
});
|
||||
|
||||
it('exposes quota-supported providers and guards correctly', () => {
|
||||
expect(QUOTA_SUPPORTED_PROVIDER_IDS).toEqual(['agy', 'codex', 'gemini', 'ghcp']);
|
||||
expect(QUOTA_PROVIDER_OPTION_VALUES).toEqual([
|
||||
'agy',
|
||||
'codex',
|
||||
'gemini',
|
||||
'ghcp',
|
||||
'antigravity',
|
||||
'gemini-cli',
|
||||
'github-copilot',
|
||||
'copilot',
|
||||
'all',
|
||||
]);
|
||||
expect(QUOTA_PROVIDER_HELP_TEXT).toBe(
|
||||
'agy, codex, gemini, ghcp, antigravity, gemini-cli, github-copilot, copilot, all'
|
||||
);
|
||||
expect(isQuotaSupportedProvider('ghcp')).toBe(true);
|
||||
expect(isQuotaSupportedProvider('kiro')).toBe(false);
|
||||
});
|
||||
|
||||
it('exposes callback port and display name capabilities', () => {
|
||||
expect(getOAuthCallbackPort('qwen')).toBeNull();
|
||||
expect(getOAuthCallbackPort('kiro')).toBeNull();
|
||||
|
||||
Reference in new issue
Block a user