mecha10-cli 0.1.47

Mecha10 CLI tool
Documentation
//! CLI type definitions
//!
//! Root CLI structure and Commands enum.
//! Individual command Args are defined in the commands/ module.

use clap::{Parser, Subcommand};
use std::path::PathBuf;

// Import all command Args from commands module
use crate::commands::{
    AddCommand, AuthCommand, BuildCommand, ConfigCommand, DevArgs, DiagnosticsArgs, FormatArgs, InitArgs, LintArgs,
    LogsArgs, ModelsCommand, NodeArgs, RemoteCommand, RunCommand, SetupArgs, TopicsCommand, TopologyArgs, UploadArgs,
};

#[derive(Parser)]
#[command(name = "mecha10")]
#[command(about = "Mecha10 CLI - Build autonomous robots with RL", long_about = None)]
#[command(version)]
pub struct Cli {
    /// Set log level (debug, info, warn, error)
    #[arg(short, long, default_value = "info", global = true)]
    pub log_level: String,

    /// Path to config file
    #[arg(short, long, global = true)]
    pub config: Option<PathBuf>,

    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand)]
pub enum Commands {
    /// Add components to the project (nodes, drivers, etc.)
    Add {
        #[command(subcommand)]
        command: AddCommand,
    },

    /// Manage authentication (login, logout, whoami)
    Auth {
        #[command(subcommand)]
        command: AuthCommand,
    },

    /// Build the project for a specific target
    Build {
        #[command(subcommand)]
        command: BuildCommand,
    },

    /// Manage robot configurations (push, pull, list)
    Config {
        #[command(subcommand)]
        command: ConfigCommand,
    },

    /// Start development mode with hot-reload
    Dev(#[command(flatten)] DevArgs),

    /// Real-time diagnostics monitoring (streaming, simulation, system resources)
    Diagnostics(#[command(flatten)] DiagnosticsArgs),

    /// Format code
    Format(#[command(flatten)] FormatArgs),

    /// Initialize a new robot project
    Init(#[command(flatten)] InitArgs),

    /// Run linting and code quality checks
    Lint(#[command(flatten)] LintArgs),

    /// View logs from nodes
    Logs(#[command(flatten)] LogsArgs),

    /// AI model management (download, list, remove models from HuggingFace)
    Models {
        #[command(subcommand)]
        command: ModelsCommand,
    },

    /// Run a single node (internal command used by standalone mode)
    #[command(hide = true)]
    Node(#[command(flatten)] NodeArgs),

    /// Manage remote AI nodes running in Docker containers
    Remote {
        #[command(subcommand)]
        command: RemoteCommand,
    },

    /// Run the robot binary for a specific target
    Run {
        #[command(subcommand)]
        command: RunCommand,
    },

    /// Run project setup script (installs dependencies)
    Setup(#[command(flatten)] SetupArgs),

    /// Show project status
    Status,

    /// Topic operations - list, watch, monitor, and record topics
    Topics {
        #[command(subcommand)]
        command: TopicsCommand,
    },

    /// Analyze project topology (nodes, pub/sub topics, ports)
    Topology(#[command(flatten)] TopologyArgs),

    /// Upload robot binary to the binary registry (for launcher deployment)
    Upload(#[command(flatten)] UploadArgs),
}