93 lines
3.3 KiB
Rust
93 lines
3.3 KiB
Rust
use clap::Parser;
|
||
use codex_common::ApprovalModeCliArg;
|
||
use codex_common::CliConfigOverrides;
|
||
use std::path::PathBuf;
|
||
|
||
#[derive(Parser, Debug)]
|
||
#[command(version)]
|
||
pub struct Cli {
|
||
/// Optional user prompt to start the session.
|
||
pub prompt: Option<String>,
|
||
|
||
/// 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>,
|
||
|
||
/// Open an interactive picker to resume a previous session recorded on disk
|
||
/// instead of starting a new one.
|
||
///
|
||
/// Notes:
|
||
/// - Mutually exclusive with `--continue`.
|
||
/// - The picker displays recent sessions and a preview of the first real user
|
||
/// message to help you select the right one.
|
||
#[arg(
|
||
long = "resume",
|
||
default_value_t = false,
|
||
conflicts_with = "continue",
|
||
hide = true
|
||
)]
|
||
pub resume: bool,
|
||
|
||
/// Continue the most recent conversation without showing the picker.
|
||
///
|
||
/// Notes:
|
||
/// - Mutually exclusive with `--resume`.
|
||
/// - If no recorded sessions are found, this behaves like starting fresh.
|
||
/// - Equivalent to picking the newest item in the resume picker.
|
||
#[arg(
|
||
id = "continue",
|
||
long = "continue",
|
||
default_value_t = false,
|
||
conflicts_with = "resume",
|
||
hide = true
|
||
)]
|
||
pub r#continue: bool,
|
||
|
||
/// Model the agent should use.
|
||
#[arg(long, short = 'm')]
|
||
pub model: Option<String>,
|
||
|
||
/// Convenience flag to select the local open source model provider.
|
||
/// Equivalent to -c model_provider=oss; verifies a local Ollama server is
|
||
/// running.
|
||
#[arg(long = "oss", default_value_t = false)]
|
||
pub oss: bool,
|
||
|
||
/// Configuration profile from config.toml to specify default options.
|
||
#[arg(long = "profile", short = 'p')]
|
||
pub config_profile: Option<String>,
|
||
|
||
/// Select the sandbox policy to use when executing model-generated shell
|
||
/// commands.
|
||
#[arg(long = "sandbox", short = 's')]
|
||
pub sandbox_mode: Option<codex_common::SandboxModeCliArg>,
|
||
|
||
/// Configure when the model requires human approval before executing a command.
|
||
#[arg(long = "ask-for-approval", short = 'a')]
|
||
pub approval_policy: Option<ApprovalModeCliArg>,
|
||
|
||
/// Convenience alias for low-friction sandboxed automatic execution (-a on-failure, --sandbox workspace-write).
|
||
#[arg(long = "full-auto", default_value_t = false)]
|
||
pub full_auto: bool,
|
||
|
||
/// Skip all confirmation prompts and execute commands without sandboxing.
|
||
/// EXTREMELY DANGEROUS. Intended solely for running in environments that are externally sandboxed.
|
||
#[arg(
|
||
long = "dangerously-bypass-approvals-and-sandbox",
|
||
alias = "yolo",
|
||
default_value_t = false,
|
||
conflicts_with_all = ["approval_policy", "full_auto"]
|
||
)]
|
||
pub dangerously_bypass_approvals_and_sandbox: bool,
|
||
|
||
/// Tell the agent to use the specified directory as its working root.
|
||
#[clap(long = "cd", short = 'C', value_name = "DIR")]
|
||
pub cwd: Option<PathBuf>,
|
||
|
||
/// Enable web search (off by default). When enabled, the native Responses `web_search` tool is available to the model (no per‑call approval).
|
||
#[arg(long = "search", default_value_t = false)]
|
||
pub web_search: bool,
|
||
|
||
#[clap(skip)]
|
||
pub config_overrides: CliConfigOverrides,
|
||
}
|