Skip to main content

rho_coding_agent/
cli.rs

1use std::path::PathBuf;
2
3use clap::{Parser, Subcommand};
4
5use crate::reasoning::ReasoningLevel;
6
7#[derive(Parser, Debug)]
8#[command(name = "rho")]
9pub struct Cli {
10    #[arg(long)]
11    pub provider: Option<String>,
12    #[arg(long)]
13    pub model: Option<String>,
14    #[arg(long)]
15    pub config: Option<PathBuf>,
16    #[arg(long, value_parser = ["api-key", "codex", "anthropic-api-key", "github-copilot", "xai-oauth"])]
17    pub auth: Option<String>,
18    /// Do not send rho's system prompt, including AGENTS.md and skill context.
19    #[arg(long)]
20    pub no_system_prompt: bool,
21    /// Do not expose any tools to the model.
22    #[arg(long)]
23    pub no_tools: bool,
24    /// Do not expose the subagent tools (agent/agents) to the model.
25    #[arg(long, global = true)]
26    pub no_subagents: bool,
27    /// Override reasoning level: off, minimal, low, medium, high, xhigh, or max.
28    #[arg(long)]
29    pub reasoning: Option<ReasoningLevel>,
30    /// Resume an existing session by UUID or UUID prefix. Omit the ID to choose from a picker.
31    #[arg(short = 'R', long, value_name = "ID", num_args = 0..=1)]
32    pub resume: Option<Option<String>>,
33    #[command(subcommand)]
34    pub command: Option<Command>,
35}
36
37#[derive(Subcommand, Debug)]
38pub enum Command {
39    /// Run one non-interactive automation prompt and print the final answer.
40    Run {
41        /// Read additional prompt text from stdin.
42        #[arg(long)]
43        stdin: bool,
44        /// Run as a subagent preset: apply its model/reasoning/tool
45        /// restrictions and append its instructions to the system prompt.
46        #[arg(long, value_name = "NAME")]
47        preset: Option<String>,
48        /// Stream progress to stdout and write a structured status/result
49        /// file (JSON) that is updated during the run and finalized on exit.
50        #[arg(long, value_name = "PATH")]
51        output_file: Option<PathBuf>,
52        /// Prompt text to send to the agent.
53        #[arg(value_name = "PROMPT", num_args = 0..)]
54        prompt: Vec<String>,
55    },
56    /// Watch a subagent in a read-only TUI.
57    Attach {
58        /// Subagent ID shown when the agent was started.
59        #[arg(value_name = "ID")]
60        id: String,
61    },
62    /// Log in to a provider from a browser or device-code flow.
63    Login {
64        /// Provider to authenticate, for example openai-codex or github-copilot.
65        #[arg(value_name = "PROVIDER")]
66        provider: String,
67        /// Use device-code login instead of opening a local browser callback.
68        #[arg(long)]
69        device_auth: bool,
70    },
71    /// Update rho using the detected installation method.
72    Update,
73}
74
75#[cfg(test)]
76#[path = "cli_tests.rs"]
77mod tests;