Skip to main content

atomr_agents_coding_cli_vendor_gemini/
command.rs

1use std::path::Path;
2
3use atomr_agents_coding_cli_core::{CliCommand, CliRequest};
4
5const GEMINI_BIN: &str = "gemini";
6
7pub fn build_headless(req: &CliRequest, workdir: &Path) -> CliCommand {
8    let mut cmd = CliCommand::new(GEMINI_BIN, workdir);
9    cmd = cmd
10        .arg("-p")
11        .arg(&req.prompt)
12        .arg_pair("--output-format", "stream-json")
13        .arg("--non-interactive");
14    if let Some(model) = req.model.as_deref() {
15        cmd = cmd.arg_pair("--model", model);
16    }
17    if req.project.policy.auto_approve_unrestricted {
18        cmd = cmd.arg("--yolo");
19    }
20    cmd
21}
22
23pub fn build_interactive(req: &CliRequest, workdir: &Path) -> CliCommand {
24    let mut cmd = CliCommand::new(GEMINI_BIN, workdir).with_pty();
25    if let Some(model) = req.model.as_deref() {
26        cmd = cmd.arg_pair("--model", model);
27    }
28    cmd
29}