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 /// Simulate first run (show welcome screen)
38 #[arg(long = "first-run", hide = true)]
39 pub first_run: bool,
40}
41
42#[derive(Subcommand)]
43pub enum Commands {
44 Login,
45 Config,
46 /// List configured MCP servers and their tools
47 Mcp,
48 /// List installed extensions
49 Extensions,
50 /// Install an extension from a git URL
51 Install {
52 /// Git URL or local path to the extension
53 source: String,
54 },
55 /// Uninstall an extension by name
56 Uninstall {
57 /// Name of the extension to remove
58 name: String,
59 },
60 /// Connect to an ACP agent
61 Acp {
62 /// Agent name (configured in config.toml)
63 name: String,
64 },
65 /// Run in headless mode (no TUI). Use "bg" as first arg for background mode.
66 Run {
67 /// The prompt to send (prefix with "bg" for background mode, omit to read from stdin)
68 prompt: Vec<String>,
69
70 /// Output format: text, json, stream-json
71 #[arg(short = 'o', long = "output", default_value = "text")]
72 output: String,
73
74 /// Print only the final text response (no tool output)
75 #[arg(long = "no-tools", default_value_t = false)]
76 no_tools: bool,
77
78 /// Resume a previous session
79 #[arg(short = 's', long = "session")]
80 session: Option<String>,
81
82 /// Multi-turn interactive mode (read prompts from stdin line by line)
83 #[arg(short = 'i', long = "interactive")]
84 interactive: bool,
85 },
86 /// List background tasks
87 Tasks,
88 /// View a background task's status and output
89 Task {
90 /// Task ID to view
91 id: String,
92 },
93 /// Show version information
94 Version,
95}