@zuke/codex

← API reference

`@zuke/codex` — a typed [OpenAI Codex](https://developers.openai.com/codex/cli)

Symbols

# CodexApprovalPolicy type
type CodexApprovalPolicy = untrusted | on-failure | on-request | never

Approval policy for a run (--ask-for-approval).

# CodexColor type
type CodexColor = always | never | auto

When to colourise output (--color).

# CodexExecSettings class
class CodexExecSettings extends ToolSettings

Settings for a non-interactive codex exec run — the build-friendly way to send a single prompt and capture the response.

MemberSignatureDoc
prompt prompt(text: string): this The prompt to run non-interactively. Omit to read from stdin.
model model(id: string): this Pin the model, e.g. model("gpt-5-codex") (--model).
image image(...paths: string[]): this Attach an image to the prompt (--image). Repeatable.
config config(key: string, value: string): this Override a config value as key=value (--config). Repeatable.
sandbox sandbox(mode: CodexSandboxMode): this Sandbox policy for model-generated commands (--sandbox).
cd cd(dir: string): this Run as if codex was started in this directory (--cd).
askForApproval askForApproval(policy: CodexApprovalPolicy): this Approval policy for the run (--ask-for-approval).
fullAuto fullAuto(): this Low-friction sandboxed automatic execution (--full-auto).
dangerouslyBypassApprovalsAndSandbox dangerouslyBypassApprovalsAndSandbox(): this Skip all confirmation prompts and sandboxing (--dangerously-bypass-approvals-and-sandbox).
skipGitRepoCheck skipGitRepoCheck(): this Allow running outside a Git repository (--skip-git-repo-check).
json json(): this Emit events as newline-delimited JSON (--json).
outputLastMessage outputLastMessage(file: string): this Write the agent's final message to a file (--output-last-message).
outputSchema outputSchema(file: string): this Constrain the final message to a JSON schema file (--output-schema).
color color(mode: CodexColor): this When to colourise output (--color).
profile profile(name: string): this Use a named configuration profile (--profile).
oss oss(): this Use a local open-source model provider (--oss).
# CodexMcpSettings class
class CodexMcpSettings extends SubcommandSettings

Settings for a codex mcp … invocation (manage MCP servers): name the verb and operands with .command(...) and pass anything else with .flag(...).

# CodexSandboxMode type
type CodexSandboxMode = read-only | workspace-write | danger-full-access

Sandbox policy for model-generated commands (--sandbox).

# CodexTasks const
const CodexTasks: CodexTasksApi

Typed task functions for the OpenAI Codex CLI.

# CodexTasksApi interface
interface CodexTasksApi

The shape of CodexTasks.

MemberSignatureDoc
exec exec(configure?: Configure<CodexExecSettings>): Promise<CommandOutput> Run a prompt non-interactively (codex exec).
mcp mcp(configure?: Configure<CodexMcpSettings>): Promise<CommandOutput> Manage MCP servers (codex mcp …).