agcodex_tui/
cli.rs

1use agcodex_common::ApprovalModeCliArg;
2use agcodex_common::CliConfigOverrides;
3use clap::Parser;
4use std::path::PathBuf;
5
6#[derive(Parser, Debug)]
7#[command(version)]
8pub struct Cli {
9    /// Optional user prompt to start the session.
10    pub prompt: Option<String>,
11
12    /// Optional image(s) to attach to the initial prompt.
13    #[arg(long = "image", short = 'i', value_name = "FILE", value_delimiter = ',', num_args = 1..)]
14    pub images: Vec<PathBuf>,
15
16    /// Model the agent should use.
17    #[arg(long, short = 'm')]
18    pub model: Option<String>,
19
20    /// Convenience flag to select the local open source model provider.
21    /// Equivalent to -c model_provider=oss; verifies a local Ollama server is
22    /// running.
23    #[arg(long = "oss", default_value_t = false)]
24    pub oss: bool,
25
26    /// Configuration profile from config.toml to specify default options.
27    #[arg(long = "profile", short = 'p')]
28    pub config_profile: Option<String>,
29
30    /// Operating mode: plan, build, or review. Default is build.
31    #[arg(long = "mode", value_name = "MODE")]
32    pub mode: Option<String>,
33
34    /// Select the sandbox policy to use when executing model-generated shell
35    /// commands.
36    #[arg(long = "sandbox", short = 's')]
37    pub sandbox_mode: Option<agcodex_common::SandboxModeCliArg>,
38
39    /// Configure when the model requires human approval before executing a command.
40    #[arg(long = "ask-for-approval", short = 'a')]
41    pub approval_policy: Option<ApprovalModeCliArg>,
42
43    /// Convenience alias for low-friction sandboxed automatic execution (-a on-failure, --sandbox workspace-write).
44    #[arg(long = "full-auto", default_value_t = false)]
45    pub full_auto: bool,
46
47    /// Skip all confirmation prompts and execute commands without sandboxing.
48    /// EXTREMELY DANGEROUS. Intended solely for running in environments that are externally sandboxed.
49    #[arg(
50        long = "dangerously-bypass-approvals-and-sandbox",
51        alias = "yolo",
52        default_value_t = false,
53        conflicts_with_all = ["approval_policy", "full_auto"]
54    )]
55    pub dangerously_bypass_approvals_and_sandbox: bool,
56
57    /// Tell the agent to use the specified directory as its working root.
58    #[clap(long = "cd", short = 'C', value_name = "DIR")]
59    pub cwd: Option<PathBuf>,
60
61    #[clap(skip)]
62    pub config_overrides: CliConfigOverrides,
63}