pub struct ExecCommand { /* private fields */ }Expand description
Run Codex non-interactively (codex exec <prompt>).
This is the primary command for programmatic use. It supports the full range of exec flags: model selection, sandbox policy, approval policy, images, config overrides, feature flags, JSON output, and more.
§Example
use codex_wrapper::{Codex, CodexCommand, ExecCommand, SandboxMode};
let codex = Codex::builder().build()?;
let output = ExecCommand::new("fix the failing test")
.model("o3")
.sandbox(SandboxMode::WorkspaceWrite)
.ephemeral()
.execute(&codex)
.await?;
println!("{}", output.stdout);Implementations§
Source§impl ExecCommand
impl ExecCommand
Sourcepub fn from_stdin() -> Self
pub fn from_stdin() -> Self
Read the prompt from stdin (-).
pub fn config(self, key_value: impl Into<String>) -> Self
pub fn enable(self, feature: impl Into<String>) -> Self
pub fn disable(self, feature: impl Into<String>) -> Self
pub fn image(self, path: impl Into<String>) -> Self
pub fn model(self, model: impl Into<String>) -> Self
pub fn oss(self) -> Self
pub fn local_provider(self, provider: impl Into<String>) -> Self
pub fn sandbox(self, sandbox: SandboxMode) -> Self
pub fn approval_policy(self, policy: ApprovalPolicy) -> Self
pub fn profile(self, profile: impl Into<String>) -> Self
pub fn full_auto(self) -> Self
pub fn dangerously_bypass_approvals_and_sandbox(self) -> Self
pub fn cd(self, dir: impl Into<String>) -> Self
pub fn skip_git_repo_check(self) -> Self
pub fn add_dir(self, dir: impl Into<String>) -> Self
pub fn ephemeral(self) -> Self
pub fn output_schema(self, path: impl Into<String>) -> Self
pub fn color(self, color: Color) -> Self
pub fn progress_cursor(self) -> Self
pub fn json(self) -> Self
pub fn output_last_message(self, path: impl Into<String>) -> Self
pub fn retry(self, policy: RetryPolicy) -> Self
pub async fn execute_json_lines( &self, codex: &Codex, ) -> Result<Vec<JsonLineEvent>>
Trait Implementations§
Source§impl Clone for ExecCommand
impl Clone for ExecCommand
Source§fn clone(&self) -> ExecCommand
fn clone(&self) -> ExecCommand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CodexCommand for ExecCommand
impl CodexCommand for ExecCommand
Auto Trait Implementations§
impl Freeze for ExecCommand
impl RefUnwindSafe for ExecCommand
impl Send for ExecCommand
impl Sync for ExecCommand
impl Unpin for ExecCommand
impl UnsafeUnpin for ExecCommand
impl UnwindSafe for ExecCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more