mermaid_cli/cli/args.rs
1use clap::{Parser, Subcommand, ValueEnum};
2use std::path::PathBuf;
3
4#[derive(Parser, Debug)]
5#[command(name = "mermaid")]
6#[command(version)]
7#[command(about = "An open-source, model-agnostic AI pair programmer", long_about = None)]
8pub struct Cli {
9 /// Model to use (e.g., qwen3-coder:30b, ollama/llama3)
10 #[arg(short, long)]
11 pub model: Option<String>,
12
13 /// Project directory (defaults to current directory)
14 #[arg(short, long)]
15 pub path: Option<PathBuf>,
16
17 /// Verbose output
18 #[arg(short, long)]
19 pub verbose: bool,
20
21 /// Show session picker to choose a previous conversation
22 #[arg(long, conflicts_with = "continue_session")]
23 pub sessions: bool,
24
25 /// Resume the last conversation instead of starting fresh
26 #[arg(long = "continue", conflicts_with = "sessions")]
27 pub continue_session: bool,
28
29 #[command(subcommand)]
30 pub command: Option<Commands>,
31}
32
33#[derive(Subcommand, Debug)]
34pub enum Commands {
35 /// Initialize configuration
36 Init,
37 /// List available models
38 List,
39 /// Start a chat session (default)
40 Chat,
41 /// Show version information
42 Version,
43 /// Check status of dependencies and backends
44 Status,
45 /// Add an MCP server (e.g., mermaid add context7)
46 Add {
47 /// MCP server name (e.g., context7, github, filesystem)
48 name: String,
49 },
50 /// Remove a configured MCP server
51 Remove {
52 /// MCP server name to remove
53 name: String,
54 },
55 /// List configured MCP servers
56 Mcp,
57 /// Run a single prompt non-interactively
58 Run {
59 /// The prompt to execute
60 prompt: String,
61
62 /// Output format (text, json, markdown)
63 #[arg(short, long, value_enum, default_value_t = OutputFormat::Text)]
64 format: OutputFormat,
65
66 /// Maximum tokens to generate
67 #[arg(long)]
68 max_tokens: Option<usize>,
69
70 /// Don't execute agent actions (dry run)
71 #[arg(long)]
72 no_execute: bool,
73 },
74}
75
76#[derive(Debug, Clone, Copy, ValueEnum)]
77pub enum OutputFormat {
78 /// Plain text output
79 Text,
80 /// JSON structured output
81 Json,
82 /// Markdown formatted output
83 Markdown,
84}