Skip to main content

atomr_agents_coding_cli_vendor_codex/
command.rs

1use std::path::Path;
2
3use atomr_agents_coding_cli_core::{CliCommand, CliRequest};
4
5const CODEX_BIN: &str = "codex";
6
7pub fn build_headless(req: &CliRequest, workdir: &Path) -> CliCommand {
8    let mut cmd = CliCommand::new(CODEX_BIN, workdir).arg("exec").arg(&req.prompt);
9    if let Some(model) = req.model.as_deref() {
10        cmd = cmd.arg_pair("--model", model);
11    }
12    if req.project.policy.auto_approve_unrestricted {
13        cmd = cmd.arg("--full-access");
14    }
15    cmd
16}
17
18pub fn build_interactive(req: &CliRequest, workdir: &Path) -> CliCommand {
19    let mut cmd = CliCommand::new(CODEX_BIN, workdir).with_pty();
20    if let Some(model) = req.model.as_deref() {
21        cmd = cmd.arg_pair("--model", model);
22    }
23    cmd
24}