mecha10-cli 0.1.47

Mecha10 CLI tool
Documentation
//! Remote command arguments
//!
//! Commands for managing the mecha10-remote container which runs AI/ML nodes
//! in Docker containers with platform-specific dependencies.

use super::build::TargetArch;
use clap::{Args, Subcommand};

/// Remote node management subcommands
#[derive(Subcommand)]
pub enum RemoteCommand {
    /// Start the remote node container
    ///
    /// Automatically detects whether to use the pre-built image or build locally:
    /// - Uses pre-built if only @mecha10/* nodes and Dockerfile.remote is unmodified
    /// - Builds locally if custom @local/* nodes or modified Dockerfile.remote
    Up(#[command(flatten)] RemoteUpArgs),

    /// Stop the remote node container
    Down,

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

    /// List running remote nodes
    Ps,

    /// Build the remote container (even if pre-built is available)
    Build,
}

/// Arguments for the `remote up` command
#[derive(Args)]
pub struct RemoteUpArgs {
    /// Force rebuild even if pre-built image is available
    #[arg(long)]
    pub build: bool,

    /// Detach and run in background
    #[arg(short, long)]
    pub detach: bool,

    /// Target architecture (x86-64 or aarch64)
    #[arg(short, long, value_enum, default_value_t = TargetArch::X86_64)]
    pub arch: TargetArch,
}

/// Arguments for the `remote logs` command
#[derive(Args)]
pub struct RemoteLogsArgs {
    /// Specific node to view logs for (e.g., object-detector)
    /// If not specified, shows logs from all remote nodes
    pub node: Option<String>,

    /// Follow log output (like tail -f)
    #[arg(short, long)]
    pub follow: bool,

    /// Number of lines to show from the end
    #[arg(short = 'n', long, default_value = "100")]
    pub tail: u32,
}