ares/cli/mod.rs
1//! CLI module for A.R.E.S
2//!
3//! Provides command-line interface parsing and handling for the ares-server binary.
4//! Uses clap for argument parsing and owo-colors for colored terminal output.
5
6pub mod init;
7pub mod output;
8
9use clap::{Parser, Subcommand};
10use std::path::PathBuf;
11
12/// A.R.E.S - Agentic Retrieval Enhanced Server
13///
14/// A production-grade agentic chatbot server with multi-provider LLM support,
15/// tool calling, RAG, and MCP integration.
16#[derive(Parser, Debug)]
17#[command(
18 name = "ares-server",
19 author = "Dirmacs <build@dirmacs.com>",
20 version,
21 about = "A.R.E.S - Agentic Retrieval Enhanced Server",
22 long_about = "A production-grade agentic chatbot server with multi-provider LLM support,\n\
23 tool calling, RAG (Retrieval Augmented Generation), and MCP integration.\n\n\
24 Run without arguments to start the server, or use 'init' to scaffold a new project.",
25 after_help = "EXAMPLES:\n \
26 ares-server init # Scaffold a new A.R.E.S project\n \
27 ares-server init --minimal # Scaffold with minimal configuration\n \
28 ares-server # Start the server (requires ares.toml)\n \
29 ares-server --config my.toml # Use a custom config file"
30)]
31pub struct Cli {
32 /// Path to the configuration file
33 #[arg(short, long, default_value = "ares.toml", global = true)]
34 pub config: PathBuf,
35
36 /// Enable verbose output
37 #[arg(short, long, global = true)]
38 pub verbose: bool,
39
40 /// Disable colored output
41 #[arg(long, global = true)]
42 pub no_color: bool,
43
44 /// Start in MCP server mode (stdio transport for Claude Desktop, Cursor, etc.)
45 #[arg(long, global = true)]
46 pub mcp: bool,
47
48 /// Subcommand to execute
49 #[command(subcommand)]
50 pub command: Option<Commands>,
51}
52
53/// Available CLI subcommands
54#[derive(Subcommand, Debug)]
55pub enum Commands {
56 /// Initialize a new A.R.E.S project with configuration files
57 ///
58 /// Creates ares.toml and the config/ directory structure with
59 /// all necessary files for running an A.R.E.S server.
60 Init {
61 /// Directory to initialize (defaults to current directory)
62 #[arg(default_value = ".")]
63 path: PathBuf,
64
65 /// Overwrite existing files without prompting
66 #[arg(short, long)]
67 force: bool,
68
69 /// Create a minimal configuration (fewer agents and tools)
70 #[arg(short, long)]
71 minimal: bool,
72
73 /// Skip creating example TOON files in config/
74 #[arg(long)]
75 no_examples: bool,
76
77 /// LLM provider to configure (ollama, openai, or both)
78 #[arg(long, default_value = "ollama")]
79 provider: String,
80
81 /// Host address for the server
82 #[arg(long, default_value = "127.0.0.1")]
83 host: String,
84
85 /// Port for the server
86 #[arg(long, default_value = "3000")]
87 port: u16,
88 },
89
90 /// Show configuration information
91 Config {
92 /// Show the full configuration
93 #[arg(short = 'f', long)]
94 full: bool,
95
96 /// Validate the configuration file
97 #[arg(long)]
98 validate: bool,
99 },
100
101 /// Manage agents
102 #[command(subcommand)]
103 Agent(AgentCommands),
104}
105
106/// Agent management subcommands
107#[derive(Subcommand, Debug)]
108pub enum AgentCommands {
109 /// List all configured agents
110 List,
111
112 /// Show details for a specific agent
113 Show {
114 /// Name of the agent
115 name: String,
116 },
117}
118
119impl Cli {
120 /// Parse CLI arguments
121 pub fn parse_args() -> Self {
122 Self::parse()
123 }
124}