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    AddCommand, AuthCommand, BuildArgs, DevArgs, DiagnosticsCommand, FormatArgs, InitArgs, LintArgs, LogsArgs,
12    ModelsCommand, 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    /// Add components to the project (nodes, drivers, etc.)
35    Add {
36        #[command(subcommand)]
37        command: AddCommand,
38    },
39
40    /// Manage authentication (login, logout, whoami)
41    Auth {
42        #[command(subcommand)]
43        command: AuthCommand,
44    },
45
46    /// Build the project
47    Build(#[command(flatten)] BuildArgs),
48
49    /// Start development mode with hot-reload
50    Dev(#[command(flatten)] DevArgs),
51
52    /// Real-time diagnostics monitoring (streaming, simulation, system resources)
53    Diagnostics {
54        #[command(subcommand)]
55        command: DiagnosticsCommand,
56    },
57
58    /// Format code
59    Format(#[command(flatten)] FormatArgs),
60
61    /// Initialize a new robot project
62    Init(#[command(flatten)] InitArgs),
63
64    /// Run linting and code quality checks
65    Lint(#[command(flatten)] LintArgs),
66
67    /// View logs from nodes
68    Logs(#[command(flatten)] LogsArgs),
69
70    /// AI model management (download, list, remove models from HuggingFace)
71    Models {
72        #[command(subcommand)]
73        command: ModelsCommand,
74    },
75
76    /// Run a single node (internal command used by standalone mode)
77    #[command(hide = true)]
78    Node(#[command(flatten)] NodeArgs),
79
80    /// Run the robot in production mode
81    Run(#[command(flatten)] RunArgs),
82
83    /// Run project setup script (installs dependencies)
84    Setup(#[command(flatten)] SetupArgs),
85
86    /// Show project status
87    Status,
88
89    /// Topic operations - list, watch, monitor, and record topics
90    Topics {
91        #[command(subcommand)]
92        command: TopicsCommand,
93    },
94
95    /// Analyze project topology (nodes, pub/sub topics, ports)
96    Topology(#[command(flatten)] TopologyArgs),
97}