feat(cliproxy): add xAI Grok provider

This commit is contained in:
minhbi245 committed 2026-07-17 00:02:12 +07:00
1 parent 1b67c7840b
commit 54a2b4759b
37 files changed
+510 -54

No files matched your search

+8
View File
@@ -94,12 +94,20 @@ describe('ProfileDetector', () => {
});
it('should detect newly added cliproxy providers', () => {
expect(detector.detectProfileType('xai').provider).toBe('xai');
expect(detector.detectProfileType('gitlab').provider).toBe('gitlab');
expect(detector.detectProfileType('codebuddy').provider).toBe('codebuddy');
expect(detector.detectProfileType('kilo').provider).toBe('kilo');
expect(detector.detectProfileType('qoder').provider).toBe('qoder');
});
it('should resolve the grok CLI alias to canonical xai routing', () => {
const result = detector.detectProfileType('grok');
expect(result.type).toBe('cliproxy');
expect(result.name).toBe('xai');
expect(result.provider).toBe('xai');
});
it('should detect settings-based profile from unified config', () => {
const settingsPath = path.join(tempDir, 'glm.settings.json');
fs.writeFileSync(settingsPath, JSON.stringify({ env: { ANTHROPIC_MODEL: 'glm-4' } }));
@@ -82,6 +82,8 @@ describe('completion backend', () => {
expect(values).toContain('cursor');
expect(values).toContain('copilot');
expect(values).toContain('gemini');
expect(values).toContain('xai');
expect(values).toContain('grok');
expect(values).toContain('gitlab');
expect(values).toContain('codebuddy');
expect(values).toContain('kilo');
@@ -94,6 +96,11 @@ describe('completion backend', () => {
expect(values).not.toContain('--uninstall');
});
test('offers provider flags for both xai and grok shortcuts', () => {
expect(suggestionValues(['xai'])).toEqual(expect.arrayContaining(['--auth', '--accounts']));
expect(suggestionValues(['grok'])).toEqual(expect.arrayContaining(['--auth', '--accounts']));
});
test('suggests help topics from the help command', () => {
const values = suggestionValues(['help']);
expect(values).toContain('profiles');
@@ -57,6 +57,8 @@ describe('help command parity', () => {
expect(rendered.includes('ccs help kiro')).toBe(true);
expect(rendered.includes('gemini')).toBe(true);
expect(rendered.includes('codex')).toBe(true);
expect(rendered.includes('xai')).toBe(true);
expect(rendered.includes('alias: grok')).toBe(true);
expect(rendered.includes('ghcp')).toBe(true);
expect(rendered.includes('gitlab')).toBe(true);
expect(rendered.includes('codebuddy')).toBe(true);