fix(codex): resolve ccsxp argv alias as codex

This commit is contained in:
Tam Nhu Tran
2026-04-26 13:19:58 -04:00
parent fa34ee82a1
commit cd941195d1
3 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ export const TARGET_METADATA: Record<TargetType, TargetMetadata> = {
},
codex: {
displayName: 'Codex CLI',
runtimeAliases: ['ccs-codex', 'ccsx'],
runtimeAliases: ['ccs-codex', 'ccsx', 'ccsxp'],
legacyAliasEnvVar: 'CCS_CODEX_ALIASES',
persistedTarget: false,
},
@@ -89,17 +89,28 @@ describe('ccsd alias integration', () => {
expect(path.basename(argvPath)).toBe('ccsx');
});
it('should preserve ccsxp symlink basename in argv[1] under node', () => {
if (process.platform === 'win32') {
return;
}
const argvPath = probeArgvPath('ccsxp');
expect(path.basename(argvPath)).toBe('ccsxp');
});
it('should preserve extension-style alias basenames for wrapper compatibility', () => {
const cmdArgvPath = probeArgvPathDirect('ccsd.cmd');
const ps1ArgvPath = probeArgvPathDirect('ccsd.ps1');
const explicitCmdArgvPath = probeArgvPathDirect('ccs-droid.cmd');
const codexCmdArgvPath = probeArgvPathDirect('ccs-codex.cmd');
const codexShortCmdArgvPath = probeArgvPathDirect('ccsx.cmd');
const codexProxyCmdArgvPath = probeArgvPathDirect('ccsxp.cmd');
expect(path.basename(cmdArgvPath)).toBe('ccsd.cmd');
expect(path.basename(ps1ArgvPath)).toBe('ccsd.ps1');
expect(path.basename(explicitCmdArgvPath)).toBe('ccs-droid.cmd');
expect(path.basename(codexCmdArgvPath)).toBe('ccs-codex.cmd');
expect(path.basename(codexShortCmdArgvPath)).toBe('ccsx.cmd');
expect(path.basename(codexProxyCmdArgvPath)).toBe('ccsxp.cmd');
});
});
@@ -98,6 +98,11 @@ describe('resolveTargetType', () => {
expect(resolveTargetType([])).toBe('codex');
});
it('should detect built-in ccsxp argv[0] alias', () => {
process.argv = ['node', 'ccsxp'];
expect(resolveTargetType([])).toBe('codex');
});
it('should detect custom target aliases from CCS_TARGET_ALIASES', () => {
process.env.CCS_TARGET_ALIASES = 'droid=droidx,my-droid';
process.argv = ['node', 'my-droid'];
@@ -273,6 +278,9 @@ describe('resolveTargetType', () => {
process.argv = ['node', 'ccsx'];
expect(resolveTargetType([])).toBe('codex');
process.argv = ['node', 'ccsxp'];
expect(resolveTargetType([])).toBe('codex');
process.argv = ['node', 'mydroid'];
expect(resolveTargetType([])).toBe('droid');