mecha10_cli/types/
cli.rs

1//! CLI type definitions
2//!
3//! Root CLI structure and Commands enum.
4//! Individual command Args are defined in the commands/ module.
5
6use clap::{Parser, Subcommand};
7use std::path::PathBuf;
8
9// Import all command Args from commands module
10use crate::commands::{
11    AuthCommand, BuildArgs, DevArgs, DiagnosticsCommand, FormatArgs, InitArgs, LintArgs, LogsArgs, ModelsCommand,
12    NodeArgs, RunArgs, SetupArgs, TopicsCommand, TopologyArgs,
13};
14
15#[derive(Parser)]
16#[command(name = "mecha10")]
17#[command(about = "Mecha10 CLI - Build autonomous robots with RL", long_about = None)]
18#[command(version)]
19pub struct Cli {
20    /// Set log level (debug, info, warn, error)
21    #[arg(short, long, default_value = "info", global = true)]
22    pub log_level: String,
23
24    /// Path to config file
25    #[arg(short, long, global = true)]
26    pub config: Option<PathBuf>,
27
28    #[command(subcommand)]
29    pub command: Commands,
30}
31
32#[derive(Subcommand)]
33pub enum Commands {
34    /// Manage authentication (login, logout, whoami)
35    Auth {
36        #[command(subcommand)]
37        command: AuthCommand,
38    },
39
40    /// Build the project
41    Build(#[command(flatten)] BuildArgs),
42
43    /// Start development mode with hot-reload
44    Dev(#[command(flatten)] DevArgs),
45
46    /// Real-time diagnostics monitoring (streaming, simulation, system resources)
47    Diagnostics {
48        #[command(subcommand)]
49        command: DiagnosticsCommand,
50    },
51
52    /// Format code
53    Format(#[command(flatten)] FormatArgs),
54
55    /// Initialize a new robot project
56    Init(#[command(flatten)] InitArgs),
57
58    /// Run linting and code quality checks
59    Lint(#[command(flatten)] LintArgs),
60
61    /// View logs from nodes
62    Logs(#[command(flatten)] LogsArgs),
63
64    /// AI model management (download, list, remove models from HuggingFace)
65    Models {
66        #[command(subcommand)]
67        command: ModelsCommand,
68    },
69
70    /// Run a single node (internal command used by standalone mode)
71    #[command(hide = true)]
72    Node(#[command(flatten)] NodeArgs),
73
74    /// Run the robot in production mode
75    Run(#[command(flatten)] RunArgs),
76
77    /// Run project setup script (installs dependencies)
78    Setup(#[command(flatten)] SetupArgs),
79
80    /// Show project status
81    Status,
82
83    /// Topic operations - list, watch, monitor, and record topics
84    Topics {
85        #[command(subcommand)]
86        command: TopicsCommand,
87    },
88
89    /// Analyze project topology (nodes, pub/sub topics, ports)
90    Topology(#[command(flatten)] TopologyArgs),
91}