Skip to main content

rho_coding_agent/
cli.rs

1use std::path::PathBuf;
2
3use clap::{Parser, Subcommand};
4
5use rho_providers::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-api-key", "xai-oauth", "moonshot-api-key", "openrouter-api-key", "kimi-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 delegated-agent tools (agent/agents) to the model.
25    #[arg(long, global = true)]
26    pub no_subagents: bool,
27    /// Select the agent definition used for this session or automation run.
28    #[arg(long, global = true, value_name = "ID")]
29    pub agent: Option<String>,
30    /// Override reasoning level: off, minimal, low, medium, high, xhigh, or max.
31    #[arg(long)]
32    pub reasoning: Option<ReasoningLevel>,
33    /// Resume an existing session by UUID or UUID prefix. Omit the ID to choose from a picker.
34    #[arg(short = 'R', long, value_name = "ID", num_args = 0..=1)]
35    pub resume: Option<Option<String>>,
36    #[command(subcommand)]
37    pub command: Option<Command>,
38}
39
40#[derive(Subcommand, Debug)]
41pub enum Command {
42    /// Run one non-interactive automation prompt and print the final answer.
43    Run {
44        /// Read additional prompt text from stdin.
45        #[arg(long)]
46        stdin: bool,
47        /// Stream progress to stdout and write a structured status/result
48        /// file (JSON) that is updated during the run and finalized on exit.
49        #[arg(long, value_name = "PATH")]
50        output_file: Option<PathBuf>,
51        /// Prompt text to send to the agent.
52        #[arg(value_name = "PROMPT", num_args = 0..)]
53        prompt: Vec<String>,
54    },
55    /// Watch a delegated agent run in a read-only TUI.
56    Attach {
57        /// Delegated run ID shown when the agent was started.
58        #[arg(value_name = "ID")]
59        id: String,
60    },
61    /// Log in to a provider from a browser or device-code flow.
62    Login {
63        /// Provider to authenticate, for example openai-codex or github-copilot.
64        #[arg(value_name = "PROVIDER")]
65        provider: String,
66        /// Use device-code login instead of opening a local browser callback.
67        #[arg(long)]
68        device_auth: bool,
69    },
70    /// Update rho using the detected installation method.
71    Update,
72}
73
74#[cfg(test)]
75#[path = "cli_tests.rs"]
76mod tests;