Skip to main content

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, CacheCommand, ConfigCommand, ConfigValidateArgs, DevArgs, DiagnosticsArgs,
12    FormatArgs, InitArgs, LintArgs, LogsArgs, ModelCommand, RemoteCommand, RunCommand, SchemaCommand, SetupArgs,
13    SimCommand, TopicsCommand, TopologyArgs, TrainArgs, UploadArgs,
14};
15
16#[derive(Parser)]
17#[command(name = "mecha10")]
18#[command(about = "Mecha10 CLI - Build autonomous robots with RL", long_about = None)]
19#[command(version)]
20pub struct Cli {
21    /// Set log level (debug, info, warn, error)
22    #[arg(short, long, default_value = "info", global = true)]
23    pub log_level: String,
24
25    /// Path to config file
26    #[arg(short, long, global = true)]
27    pub config: Option<PathBuf>,
28
29    #[command(subcommand)]
30    pub command: Commands,
31}
32
33#[derive(Subcommand)]
34pub enum Commands {
35    /// Add components to the project (nodes, drivers, etc.)
36    Add {
37        #[command(subcommand)]
38        command: AddCommand,
39    },
40
41    /// Manage authentication (login, logout, whoami)
42    Auth {
43        #[command(subcommand)]
44        command: AuthCommand,
45    },
46
47    /// Build the project for a specific target
48    Build {
49        #[command(subcommand)]
50        command: BuildCommand,
51    },
52
53    /// Manage local cache (templates, binaries, simulation assets)
54    Cache {
55        #[command(subcommand)]
56        command: CacheCommand,
57    },
58
59    /// Manage robot configurations (push, pull, list)
60    Config {
61        #[command(subcommand)]
62        command: ConfigCommand,
63    },
64
65    /// Start development mode with hot-reload
66    Dev(#[command(flatten)] DevArgs),
67
68    /// Real-time diagnostics monitoring (streaming, simulation, system resources)
69    Diagnostics(#[command(flatten)] DiagnosticsArgs),
70
71    /// Format code
72    Format(#[command(flatten)] FormatArgs),
73
74    /// Initialize a new robot project
75    Init(#[command(flatten)] InitArgs),
76
77    /// Run linting and code quality checks
78    Lint(#[command(flatten)] LintArgs),
79
80    /// View logs from nodes
81    Logs(#[command(flatten)] LogsArgs),
82
83    /// AI model management - the public HuggingFace-backed catalog (list, pull,
84    /// installed, remove, info) and the private per-project model registry (set)
85    Model {
86        #[command(subcommand)]
87        command: ModelCommand,
88    },
89
90    /// Manage remote AI nodes running in Docker containers
91    Remote {
92        #[command(subcommand)]
93        command: RemoteCommand,
94    },
95
96    /// Run the robot binary for a specific target
97    Run {
98        #[command(subcommand)]
99        command: RunCommand,
100    },
101
102    /// Export JSON Schema + Markdown reference docs for this repo's config
103    /// kinds (project config, node configs, model catalog) — see
104    /// `docs/schemas/`.
105    Schema {
106        #[command(subcommand)]
107        command: SchemaCommand,
108    },
109
110    /// Run project setup script (installs dependencies)
111    Setup(#[command(flatten)] SetupArgs),
112
113    /// Generate or run simulation scenes against the MuJoCo backend
114    Sim {
115        #[command(subcommand)]
116        command: SimCommand,
117    },
118
119    /// Show project status
120    Status,
121
122    /// Topic operations - list, watch, monitor, and record topics
123    Topics {
124        #[command(subcommand)]
125        command: TopicsCommand,
126    },
127
128    /// Analyze project topology (nodes, pub/sub topics, ports)
129    Topology(#[command(flatten)] TopologyArgs),
130
131    /// Launch a training job - menu of bundled/project job definitions, local or remote
132    /// (Kestra/SaaS) dispatch
133    Train(#[command(flatten)] TrainArgs),
134
135    /// Upload robot binary to the binary registry (for launcher deployment)
136    Upload(#[command(flatten)] UploadArgs),
137
138    /// Validate mecha10.json and every node config it references (alias for
139    /// `mecha10 config validate`) — see docs/validate-configs.md
140    Validate(#[command(flatten)] ConfigValidateArgs),
141}