mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-16 00:14:37 +00:00
fix(env): address P1-P3 review items from code review
- P1: Fix bash completion $cliproxy_profiles scoping — inline profiles in env block since variable is only defined at COMP_CWORD=1 scope - P2: Detect account-based profiles and show specific error message instead of generic "not found" - P2: Show `ccs migrate` hint when unified mode is disabled and settings profile resolution fails - P2: transformToOpenAI omits empty entries at transform time instead of relying on output filter (removes fragile coupling) - P3: Add zsh and auto to --shell completions across all 4 shells; map --shell zsh to bash in command handler since syntax is identical - P3: Auto-detect PowerShell from SHELL containing pwsh on non-Windows - Tests: 33 pass (+1 pwsh detection test, updated transform assertions)
This commit is contained in:
1 parent
d5c03d1f2d
commit
3f5ecd4d69
6 files changed
+43
-20
No files matched your search
@@ -60,6 +60,11 @@ describe('env-command', () => {
|
||||
process.env['SHELL'] = '/bin/bash';
|
||||
expect(detectShell('invalid')).toBe('bash');
|
||||
});
|
||||
|
||||
it('auto-detects powershell from SHELL containing pwsh', () => {
|
||||
process.env['SHELL'] = '/usr/local/bin/pwsh';
|
||||
expect(detectShell('auto')).toBe('powershell');
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatExportLine', () => {
|
||||
@@ -128,11 +133,7 @@ describe('env-command', () => {
|
||||
it('handles missing source vars gracefully', () => {
|
||||
const result = transformToOpenAI({});
|
||||
|
||||
expect(result).toEqual({
|
||||
OPENAI_API_KEY: '',
|
||||
OPENAI_BASE_URL: '',
|
||||
LOCAL_ENDPOINT: '',
|
||||
});
|
||||
expect(result).toEqual({});
|
||||
});
|
||||
|
||||
it('only extracts relevant vars', () => {
|
||||
@@ -143,7 +144,7 @@ describe('env-command', () => {
|
||||
DISABLE_TELEMETRY: '1',
|
||||
});
|
||||
|
||||
// Should only have 3 keys (no OPENAI_MODEL when ANTHROPIC_MODEL absent)
|
||||
// OPENAI_API_KEY + OPENAI_BASE_URL + LOCAL_ENDPOINT (no OPENAI_MODEL when ANTHROPIC_MODEL absent)
|
||||
expect(Object.keys(result)).toHaveLength(3);
|
||||
expect(result['ANTHROPIC_MAX_TOKENS']).toBeUndefined();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user