Implementation:0xsline OpenChatCut Codex Command
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Codex, Cross_Platform |
| Last Updated | 2026-10-22 14:00 GMT |
Overview
Windows-safe command construction for spawning the Codex CLI with proper escaping of cmd metacharacters and .cmd shims.
Description
The Codex Command module handles Windows-specific command escaping: `.cmd`/`.bat` executables need special escaping via `cmd.exe /d /s /c`. Escapes cmd metacharacters and handles node_modules `.cmd` shims with double escaping. Non-Windows returns the executable and args directly.
Usage
- Codex app server: Used by `CodexAppServerClient` to spawn the Codex CLI safely on Windows.
Code Reference
Source Location
- Repository: OpenChatCut
- File: server/codex/command.ts
- Lines: 1-42
Signature
export function codexCommand(executable: string, args: readonly string[]): { command: string; args: string[] };
Import
import { codexCommand } from './codex/command.ts';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| executable | string | Yes | Codex CLI binary path |
| args | string[] | Yes | Arguments to pass |
Outputs
| Name | Type | Description |
|---|---|---|
| codexCommand() returns | { command, args } | Windows-safe command and args |
Usage Examples
Spawning Codex on Windows
import { codexCommand } from './codex/command.ts';
const { command, args } = codexCommand('/path/to/codex.cmd', ['app-server']);
spawn(command, args);
Related Pages
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment