mecha10-cli 0.6.3

Mecha10 CLI tool
Documentation
//! Config command arguments
//!
//! Commands for managing robot configurations independently of binary uploads.

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

/// Config subcommands
#[derive(Subcommand)]
pub enum ConfigCommand {
    /// Push local configs to the robot-config service
    Push(#[command(flatten)] ConfigPushArgs),

    /// Pull configs from the robot-config service to local project
    Pull(#[command(flatten)] ConfigPullArgs),

    /// List all configs for a robot
    List(#[command(flatten)] ConfigListArgs),

    /// Show resolved project identity and config paths (project name, robot ID,
    /// control plane URL, login status) — useful for confirming a project's
    /// identity matches its robot's launcher config.
    Show,

    /// Validate mecha10.json and every node config it references (or a single
    /// arbitrary config file with --path). This is the one command hooks/CI/build
    /// all shell out to for config validation — see docs/validate-configs.md.
    Validate(#[command(flatten)] ConfigValidateArgs),
}

/// Arguments for config validate command
#[derive(Args)]
pub struct ConfigValidateArgs {
    /// Validate a single arbitrary config file instead of the whole project.
    /// The kind (project config vs. node config) is auto-detected. Useful for
    /// a git hook validating only the files staged in a commit.
    #[arg(long)]
    pub path: Option<PathBuf>,
}

/// Arguments for config push command
#[derive(Args)]
pub struct ConfigPushArgs {
    /// Path to configs directory (default: dist/configs or configs/)
    #[arg(short, long)]
    pub path: Option<PathBuf>,

    /// Robot ID to push configs for (default: from mecha10.json)
    #[arg(short, long)]
    pub robot_id: Option<String>,

    /// Show what would be pushed without actually pushing
    #[arg(long)]
    pub dry_run: bool,
}

/// Arguments for config pull command
#[derive(Args)]
pub struct ConfigPullArgs {
    /// Output directory for configs (default: configs/)
    #[arg(short, long)]
    pub output: Option<PathBuf>,

    /// Robot ID to pull configs for (default: from mecha10.json)
    #[arg(short, long)]
    pub robot_id: Option<String>,

    /// Overwrite existing config files
    #[arg(long)]
    pub force: bool,
}

/// Arguments for config list command
#[derive(Args)]
pub struct ConfigListArgs {
    /// Robot ID to list configs for (default: from mecha10.json)
    #[arg(short, long)]
    pub robot_id: Option<String>,

    /// Show full config values (not just keys)
    #[arg(short, long)]
    pub verbose: bool,
}