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    /// Subcommand to execute
45    #[command(subcommand)]
46    pub command: Option<Commands>,
47}
48
49/// Available CLI subcommands
50#[derive(Subcommand, Debug)]
51pub enum Commands {
52    /// Initialize a new A.R.E.S project with configuration files
53    ///
54    /// Creates ares.toml and the config/ directory structure with
55    /// all necessary files for running an A.R.E.S server.
56    Init {
57        /// Directory to initialize (defaults to current directory)
58        #[arg(default_value = ".")]
59        path: PathBuf,
60
61        /// Overwrite existing files without prompting
62        #[arg(short, long)]
63        force: bool,
64
65        /// Create a minimal configuration (fewer agents and tools)
66        #[arg(short, long)]
67        minimal: bool,
68
69        /// Skip creating example TOON files in config/
70        #[arg(long)]
71        no_examples: bool,
72
73        /// LLM provider to configure (ollama, openai, or both)
74        #[arg(long, default_value = "ollama")]
75        provider: String,
76
77        /// Host address for the server
78        #[arg(long, default_value = "127.0.0.1")]
79        host: String,
80
81        /// Port for the server
82        #[arg(long, default_value = "3000")]
83        port: u16,
84    },
85
86    /// Show configuration information
87    Config {
88        /// Show the full configuration
89        #[arg(short = 'f', long)]
90        full: bool,
91
92        /// Validate the configuration file
93        #[arg(long)]
94        validate: bool,
95    },
96
97    /// Manage agents
98    #[command(subcommand)]
99    Agent(AgentCommands),
100}
101
102/// Agent management subcommands
103#[derive(Subcommand, Debug)]
104pub enum AgentCommands {
105    /// List all configured agents
106    List,
107
108    /// Show details for a specific agent
109    Show {
110        /// Name of the agent
111        name: String,
112    },
113}
114
115impl Cli {
116    /// Parse CLI arguments
117    pub fn parse_args() -> Self {
118        Self::parse()
119    }
120}