Skip to main content

dot/
cli.rs

1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(name = "dot", about = "minimal ai agent")]
5pub struct Cli {
6    #[command(subcommand)]
7    pub command: Option<Commands>,
8
9    #[arg(
10        short = 's',
11        long = "session",
12        help = "resume a previous session by id"
13    )]
14    pub session: Option<String>,
15
16    /// Run in headless mode with a prompt (no TUI)
17    #[arg(short = 'p', long = "prompt")]
18    pub prompt: Option<String>,
19
20    /// Output format for headless mode
21    #[arg(short = 'o', long = "output", default_value = "text", value_parser = ["text", "json", "stream-json"])]
22    pub output: String,
23
24    /// Print only the final text response (no tool output)
25    #[arg(long = "no-tools", default_value_t = false)]
26    pub no_tools: bool,
27
28    /// Multi-turn interactive headless mode (read prompts from stdin line by line)
29    #[arg(short = 'i', long = "interactive")]
30    pub interactive: bool,
31}
32
33#[derive(Subcommand)]
34pub enum Commands {
35    Login,
36    Config,
37    /// List configured MCP servers and their tools
38    Mcp,
39    /// List installed extensions
40    Extensions,
41    /// Install an extension from a git URL
42    Install {
43        /// Git URL or local path to the extension
44        source: String,
45    },
46    /// Uninstall an extension by name
47    Uninstall {
48        /// Name of the extension to remove
49        name: String,
50    },
51    /// Run headless with a prompt (alternative to -p)
52    Run {
53        /// The prompt to send (omit to read from stdin)
54        prompt: Option<String>,
55
56        /// Output format: text, json, stream-json
57        #[arg(short = 'o', long = "output", default_value = "text")]
58        output: String,
59
60        /// Print only the final text response (no tool output)
61        #[arg(long = "no-tools", default_value_t = false)]
62        no_tools: bool,
63
64        /// Resume a previous session
65        #[arg(short = 's', long = "session")]
66        session: Option<String>,
67
68        /// Multi-turn interactive mode (read prompts from stdin line by line)
69        #[arg(short = 'i', long = "interactive")]
70        interactive: bool,
71    },
72}