This introduces an experimental `--output-last-message` flag that can be used to identify a file where the final message from the agent will be written. Two use cases: - Ultimately, we will likely add a `--quiet` option to `exec`, but even if the user does not want any output written to the terminal, they probably want to know what the agent did. Writing the output to a file makes it possible to get that information in a clean way. - Relatedly, when using `exec` in CI, it is easier to review the transcript written "normally," (i.e., not as JSON or something with extra escapes), but getting programmatic access to the last message is likely helpful, so writing the last message to a file gets the best of both worlds. I am calling this "experimental" because it is possible that we are overfitting and will want a more general solution to this problem that would justify removing this flag.
60 lines
1.9 KiB
Rust
60 lines
1.9 KiB
Rust
use clap::Parser;
|
||
use clap::ValueEnum;
|
||
use codex_common::SandboxPermissionOption;
|
||
use std::path::PathBuf;
|
||
|
||
#[derive(Parser, Debug)]
|
||
#[command(version)]
|
||
pub struct Cli {
|
||
/// Optional image(s) to attach to the initial prompt.
|
||
#[arg(long = "image", short = 'i', value_name = "FILE", value_delimiter = ',', num_args = 1..)]
|
||
pub images: Vec<PathBuf>,
|
||
|
||
/// Model the agent should use.
|
||
#[arg(long, short = 'm')]
|
||
pub model: Option<String>,
|
||
|
||
/// Configuration profile from config.toml to specify default options.
|
||
#[arg(long = "profile", short = 'p')]
|
||
pub config_profile: Option<String>,
|
||
|
||
/// Convenience alias for low-friction sandboxed automatic execution (network-disabled sandbox that can write to cwd and TMPDIR)
|
||
#[arg(long = "full-auto", default_value_t = false)]
|
||
pub full_auto: bool,
|
||
|
||
#[clap(flatten)]
|
||
pub sandbox: SandboxPermissionOption,
|
||
|
||
/// Tell the agent to use the specified directory as its working root.
|
||
#[clap(long = "cd", short = 'C', value_name = "DIR")]
|
||
pub cwd: Option<PathBuf>,
|
||
|
||
/// Allow running Codex outside a Git repository.
|
||
#[arg(long = "skip-git-repo-check", default_value_t = false)]
|
||
pub skip_git_repo_check: bool,
|
||
|
||
/// Disable server‑side response storage (sends the full conversation context with every request)
|
||
#[arg(long = "disable-response-storage", default_value_t = false)]
|
||
pub disable_response_storage: bool,
|
||
|
||
/// Specifies color settings for use in the output.
|
||
#[arg(long = "color", value_enum, default_value_t = Color::Auto)]
|
||
pub color: Color,
|
||
|
||
/// Specifies file where the last message from the agent should be written.
|
||
#[arg(long = "output-last-message")]
|
||
pub last_message_file: Option<PathBuf>,
|
||
|
||
/// Initial instructions for the agent.
|
||
pub prompt: String,
|
||
}
|
||
|
||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]
|
||
#[value(rename_all = "kebab-case")]
|
||
pub enum Color {
|
||
Always,
|
||
Never,
|
||
#[default]
|
||
Auto,
|
||
}
|