@bitkyc08/opencodex
Version:
Universal provider proxy for OpenAI Codex & Claude Code — use any LLM with Codex CLI/App/SDK and Claude Code
23 lines (20 loc) • 814 B
text/typescript
import { commandInvocation, type ResolveDeps, type SpawnInvocation } from "../lib/win-exec";
export function isSpawnableCodexCandidate(path: string, platform: NodeJS.Platform = process.platform): boolean {
if (platform !== "win32") return true;
return /\.(cmd|bat|exe|com)$/i.test(path);
}
/**
* Platform-safe Codex launcher invocation.
*
* Windows `.cmd`/`.bat` must go through `cmd.exe`, but never via `shell: true`
* (Node does not escape cmd metacharacters there). Reuse the shared
* `commandInvocation` helper (`ComSpec /d /s /c` + cross-spawn escaping).
*/
export function codexExecInvocation(
command: string,
args: readonly string[],
platform: NodeJS.Platform = process.platform,
deps: ResolveDeps = {},
): SpawnInvocation {
return commandInvocation(command, args, platform, deps);
}