mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-15 16:14:26 +00:00
fix(codex): pass native ccsx subcommands through (#1290)
This commit is contained in:
1 parent
fa06cb2c92
commit
8a37578702
6 files changed
+117
-13
No files matched your search
@@ -9,7 +9,37 @@ import { describe, it, expect, beforeEach, afterEach, mock, spyOn } from 'bun:te
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { bootstrapAndParseEarlyCli } from '../cli-argument-parser';
|
||||
import {
|
||||
bootstrapAndParseEarlyCli,
|
||||
CODEX_NATIVE_PASSTHROUGH_SUBCOMMANDS,
|
||||
getNativeCodexPassthroughArgs,
|
||||
} from '../cli-argument-parser';
|
||||
import { setGlobalConfigDir } from '../../utils/config-manager';
|
||||
|
||||
const EXPECTED_NATIVE_CODEX_SUBCOMMANDS = [
|
||||
'a',
|
||||
'app',
|
||||
'app-server',
|
||||
'apply',
|
||||
'cloud',
|
||||
'completion',
|
||||
'debug',
|
||||
'e',
|
||||
'exec',
|
||||
'exec-server',
|
||||
'features',
|
||||
'fork',
|
||||
'help',
|
||||
'login',
|
||||
'logout',
|
||||
'mcp',
|
||||
'mcp-server',
|
||||
'plugin',
|
||||
'remote-control',
|
||||
'resume',
|
||||
'review',
|
||||
'sandbox',
|
||||
];
|
||||
|
||||
// ========== Helpers ==========
|
||||
|
||||
@@ -53,6 +83,7 @@ describe('bootstrapAndParseEarlyCli', () => {
|
||||
configurable: true,
|
||||
});
|
||||
delete process.env['CI'];
|
||||
setGlobalConfigDir(undefined);
|
||||
exitSpy.mockRestore();
|
||||
});
|
||||
|
||||
@@ -150,3 +181,30 @@ describe('bootstrapAndParseEarlyCli', () => {
|
||||
expect(result.browserLaunchOverride).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('native Codex passthrough parsing', () => {
|
||||
it('keeps the native Codex passthrough subcommand list explicit', () => {
|
||||
expect([...CODEX_NATIVE_PASSTHROUGH_SUBCOMMANDS].sort()).toEqual(
|
||||
EXPECTED_NATIVE_CODEX_SUBCOMMANDS
|
||||
);
|
||||
|
||||
for (const subcommand of EXPECTED_NATIVE_CODEX_SUBCOMMANDS) {
|
||||
expect(getNativeCodexPassthroughArgs(['--target', 'codex', subcommand, '--help'])).toEqual([
|
||||
subcommand,
|
||||
'--help',
|
||||
]);
|
||||
expect(
|
||||
getNativeCodexPassthroughArgs(['--target', 'codex', 'codex', subcommand, '--help'])
|
||||
).toEqual([subcommand, '--help']);
|
||||
}
|
||||
});
|
||||
|
||||
it('keeps CCS-owned codex runtime commands out of native passthrough', () => {
|
||||
for (const subcommand of ['auth', 'doctor', 'update']) {
|
||||
expect(getNativeCodexPassthroughArgs(['--target', 'codex', subcommand, '--help'])).toBeNull();
|
||||
expect(
|
||||
getNativeCodexPassthroughArgs(['--target', 'codex', 'codex', subcommand, '--help'])
|
||||
).toBeNull();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -175,7 +175,30 @@ export const CODEX_RUNTIME_REASONING_LEVELS = new Set([
|
||||
]);
|
||||
|
||||
export const CODEX_NATIVE_PASSTHROUGH_FLAGS = new Set(['--help', '-h', '--version', '-v']);
|
||||
export const CODEX_NATIVE_PASSTHROUGH_SUBCOMMANDS = new Set(['resume']);
|
||||
export const CODEX_NATIVE_PASSTHROUGH_SUBCOMMANDS = new Set([
|
||||
'a',
|
||||
'app',
|
||||
'app-server',
|
||||
'apply',
|
||||
'cloud',
|
||||
'completion',
|
||||
'debug',
|
||||
'e',
|
||||
'exec',
|
||||
'exec-server',
|
||||
'features',
|
||||
'fork',
|
||||
'help',
|
||||
'login',
|
||||
'logout',
|
||||
'mcp',
|
||||
'mcp-server',
|
||||
'plugin',
|
||||
'remote-control',
|
||||
'resume',
|
||||
'review',
|
||||
'sandbox',
|
||||
]);
|
||||
|
||||
export const NATIVE_CLAUDE_EFFORT_LEVELS = ['low', 'medium', 'high', 'xhigh', 'max'] as const;
|
||||
|
||||
|
||||
Reference in new issue
Block a user