mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 20:14:34 +00:00
feat(codex): add ccsxp runtime shortcut
This commit is contained in:
1 parent
325137fd38
commit
deb1e9d71e
6 files changed
+164
-15
No files matched your search
@@ -0,0 +1,9 @@
|
||||
const { stripTargetFlag } = require('../targets/target-resolver');
|
||||
|
||||
process.env.CCS_INTERNAL_ENTRY_TARGET = 'codex';
|
||||
|
||||
// ccsxp is an opinionated shortcut for the built-in Codex-on-Codex route.
|
||||
// Strip user-supplied target overrides before forcing the shortcut target.
|
||||
const forwardedArgs = stripTargetFlag(process.argv.slice(2));
|
||||
process.argv.splice(2, process.argv.length - 2, 'codex', '--target', 'codex', ...forwardedArgs);
|
||||
require('../ccs');
|
||||
+22
-6
@@ -241,14 +241,26 @@ function resolveNativeClaudeLaunchArgs(
|
||||
}
|
||||
|
||||
function shouldPassthroughNativeCodexFlagCommand(args: string[]): boolean {
|
||||
return getNativeCodexPassthroughArgs(args) !== null;
|
||||
}
|
||||
|
||||
function getNativeCodexPassthroughArgs(args: string[]): string[] | null {
|
||||
const targetArgs = stripTargetFlag(args);
|
||||
if (targetArgs.length === 0) {
|
||||
return false;
|
||||
if (resolveTargetType(args) !== 'codex' || targetArgs.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
resolveTargetType(args) === 'codex' && CODEX_NATIVE_PASSTHROUGH_FLAGS.has(targetArgs[0] || '')
|
||||
);
|
||||
const firstArg = targetArgs[0] || '';
|
||||
if (CODEX_NATIVE_PASSTHROUGH_FLAGS.has(firstArg)) {
|
||||
return targetArgs;
|
||||
}
|
||||
|
||||
const secondArg = targetArgs[1] || '';
|
||||
if (firstArg === 'codex' && CODEX_NATIVE_PASSTHROUGH_FLAGS.has(secondArg)) {
|
||||
return targetArgs.slice(1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function execNativeCodexFlagCommand(args: string[]): void {
|
||||
@@ -265,7 +277,11 @@ function execNativeCodexFlagCommand(args: string[]): void {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const targetArgs = stripTargetFlag(args);
|
||||
const targetArgs = getNativeCodexPassthroughArgs(args);
|
||||
if (!targetArgs) {
|
||||
console.error(fail('Native Codex passthrough args could not be resolved.'));
|
||||
process.exit(1);
|
||||
}
|
||||
const creds: TargetCredentials = {
|
||||
profile: 'default',
|
||||
baseUrl: '',
|
||||
|
||||
Reference in new issue
Block a user