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, BuildCommand, DevArgs, DiagnosticsArgs, FormatArgs, InitArgs, LintArgs, LogsArgs,
12    ModelsCommand, NodeArgs, RemoteCommand, RunCommand, SetupArgs, TopicsCommand, TopologyArgs, UploadArgs,
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 for a specific target
47    Build {
48        #[command(subcommand)]
49        command: BuildCommand,
50    },
51
52    /// Start development mode with hot-reload
53    Dev(#[command(flatten)] DevArgs),
54
55    /// Real-time diagnostics monitoring (streaming, simulation, system resources)
56    Diagnostics(#[command(flatten)] DiagnosticsArgs),
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    /// Manage remote AI nodes running in Docker containers
81    Remote {
82        #[command(subcommand)]
83        command: RemoteCommand,
84    },
85
86    /// Run the robot binary for a specific target
87    Run {
88        #[command(subcommand)]
89        command: RunCommand,
90    },
91
92    /// Run project setup script (installs dependencies)
93    Setup(#[command(flatten)] SetupArgs),
94
95    /// Show project status
96    Status,
97
98    /// Topic operations - list, watch, monitor, and record topics
99    Topics {
100        #[command(subcommand)]
101        command: TopicsCommand,
102    },
103
104    /// Analyze project topology (nodes, pub/sub topics, ports)
105    Topology(#[command(flatten)] TopologyArgs),
106
107    /// Upload robot binary to the binary registry (for launcher deployment)
108    Upload(#[command(flatten)] UploadArgs),
109}