Skip to main content

dot/
cli.rs

1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(
5    name = "dot",
6    about = "minimal ai agent",
7    version,
8    disable_version_flag = true
9)]
10pub struct Cli {
11    #[command(subcommand)]
12    pub command: Option<Commands>,
13
14    #[arg(
15        short = 's',
16        long = "session",
17        help = "resume a previous session by id"
18    )]
19    pub session: Option<String>,
20
21    /// Output format for headless mode
22    #[arg(short = 'o', long = "output", default_value = "text", value_parser = ["text", "json", "stream-json"])]
23    pub output: String,
24
25    /// Print only the final text response (no tool output)
26    #[arg(long = "no-tools", default_value_t = false)]
27    pub no_tools: bool,
28
29    /// Multi-turn interactive headless mode (read prompts from stdin line by line)
30    #[arg(short = 'i', long = "interactive")]
31    pub interactive: bool,
32
33    /// Print version
34    #[arg(short = 'v', long = "version")]
35    pub print_version: bool,
36}
37
38#[derive(Subcommand)]
39pub enum Commands {
40    Login,
41    Config,
42    /// List configured MCP servers and their tools
43    Mcp,
44    /// List installed extensions
45    Extensions,
46    /// Install an extension from a git URL
47    Install {
48        /// Git URL or local path to the extension
49        source: String,
50    },
51    /// Uninstall an extension by name
52    Uninstall {
53        /// Name of the extension to remove
54        name: String,
55    },
56    /// Connect to an ACP agent
57    Acp {
58        /// Agent name (configured in config.toml)
59        name: String,
60    },
61    /// Run in headless mode (no TUI). Use "bg" as first arg for background mode.
62    Run {
63        /// The prompt to send (prefix with "bg" for background mode, omit to read from stdin)
64        prompt: Vec<String>,
65
66        /// Output format: text, json, stream-json
67        #[arg(short = 'o', long = "output", default_value = "text")]
68        output: String,
69
70        /// Print only the final text response (no tool output)
71        #[arg(long = "no-tools", default_value_t = false)]
72        no_tools: bool,
73
74        /// Resume a previous session
75        #[arg(short = 's', long = "session")]
76        session: Option<String>,
77
78        /// Multi-turn interactive mode (read prompts from stdin line by line)
79        #[arg(short = 'i', long = "interactive")]
80        interactive: bool,
81    },
82    /// List background tasks
83    Tasks,
84    /// View a background task's status and output
85    Task {
86        /// Task ID to view
87        id: String,
88    },
89    /// Show version information
90    Version,
91}