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    BuildArgs, DevArgs, DiagnosticsCommand, FormatArgs, InitArgs, LintArgs, LogsArgs, ModelsCommand, RunArgs,
12    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    /// Build the project
35    Build(#[command(flatten)] BuildArgs),
36
37    /// Start development mode with hot-reload
38    Dev(#[command(flatten)] DevArgs),
39
40    /// Real-time diagnostics monitoring (streaming, simulation, system resources)
41    Diagnostics {
42        #[command(subcommand)]
43        command: DiagnosticsCommand,
44    },
45
46    /// Format code
47    Format(#[command(flatten)] FormatArgs),
48
49    /// Initialize a new robot project
50    Init(#[command(flatten)] InitArgs),
51
52    /// Run linting and code quality checks
53    Lint(#[command(flatten)] LintArgs),
54
55    /// View logs from nodes
56    Logs(#[command(flatten)] LogsArgs),
57
58    /// AI model management (download, list, remove models from HuggingFace)
59    Models {
60        #[command(subcommand)]
61        command: ModelsCommand,
62    },
63
64    /// Run the robot in production mode
65    Run(#[command(flatten)] RunArgs),
66
67    /// Run project setup script (installs dependencies)
68    Setup(#[command(flatten)] SetupArgs),
69
70    /// Show project status
71    Status,
72
73    /// Topic operations - list, watch, monitor, and record topics
74    Topics {
75        #[command(subcommand)]
76        command: TopicsCommand,
77    },
78
79    /// Analyze project topology (nodes, pub/sub topics, ports)
80    Topology(#[command(flatten)] TopologyArgs),
81}