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
9use crate::commands::{
10 AddCommand, AuthCommand, BuildCommand, CacheCommand, ConfigCommand, ConfigValidateArgs, DevArgs, DiagnosticsArgs,
11 FormatArgs, InitArgs, LintArgs, LogsCommand, ModelCommand, PsCommand, RunCommand, SchemaCommand, SetupArgs,
12 SimCommand, StopCommand, TopicsCommand, TopologyArgs, TrainArgs, 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 /// Manage local cache (templates, binaries, simulation assets)
53 Cache {
54 #[command(subcommand)]
55 command: CacheCommand,
56 },
57
58 /// Manage robot configurations (push, pull, list)
59 Config {
60 #[command(subcommand)]
61 command: ConfigCommand,
62 },
63
64 /// Start development mode with hot-reload
65 Dev(#[command(flatten)] DevArgs),
66
67 /// Real-time diagnostics monitoring (streaming, simulation, system resources)
68 Diagnostics(#[command(flatten)] DiagnosticsArgs),
69
70 /// Format code
71 Format(#[command(flatten)] FormatArgs),
72
73 /// Initialize a new robot project
74 Init(#[command(flatten)] InitArgs),
75
76 /// Run linting and code quality checks
77 Lint(#[command(flatten)] LintArgs),
78
79 /// View logs from a target (pairs with `mecha10 run <target>`/`mecha10 stop <target>`)
80 Logs {
81 #[command(subcommand)]
82 command: LogsCommand,
83 },
84
85 /// AI model management - the public HuggingFace-backed catalog (list, pull,
86 /// installed, remove, info) and the private per-project model registry (set)
87 Model {
88 #[command(subcommand)]
89 command: ModelCommand,
90 },
91
92 /// List running processes/containers for a target (pairs with `mecha10 run <target>`)
93 Ps {
94 #[command(subcommand)]
95 command: PsCommand,
96 },
97
98 /// Run the robot binary for a specific target
99 Run {
100 #[command(subcommand)]
101 command: RunCommand,
102 },
103
104 /// Export JSON Schema + Markdown reference docs for this repo's config
105 /// kinds (project config, node configs, model catalog) — see
106 /// `docs/schemas/`. Internal: used by `scripts/ci/schema-docs-check.sh` to
107 /// detect drift, not a robot-project command. Hidden from `--help`.
108 #[command(hide = true)]
109 Schema {
110 #[command(subcommand)]
111 command: SchemaCommand,
112 },
113
114 /// Run project setup script (installs dependencies)
115 Setup(#[command(flatten)] SetupArgs),
116
117 /// Generate or run simulation scenes against the MuJoCo backend
118 Sim {
119 #[command(subcommand)]
120 command: SimCommand,
121 },
122
123 /// Stop a running target (pairs with `mecha10 run <target>`)
124 Stop {
125 #[command(subcommand)]
126 command: StopCommand,
127 },
128
129 /// Topic operations - list, watch, monitor, and record topics
130 Topics {
131 #[command(subcommand)]
132 command: TopicsCommand,
133 },
134
135 /// Analyze project topology (nodes, pub/sub topics, ports)
136 Topology(#[command(flatten)] TopologyArgs),
137
138 /// Launch a training job - menu of bundled/project job definitions, local or remote
139 /// (Kestra/SaaS) dispatch
140 Train(#[command(flatten)] TrainArgs),
141
142 /// Upload robot binary to the binary registry (for launcher deployment)
143 Upload(#[command(flatten)] UploadArgs),
144
145 /// Validate mecha10.json and every node config it references (alias for
146 /// `mecha10 config validate`) — see docs/validate-configs.md
147 Validate(#[command(flatten)] ConfigValidateArgs),
148}