robotrt-cli 0.1.0-beta.2

RobotRT modular robotics runtime and middleware components.
use crate::constants::{
    DEFAULT_BAG_PATH, DEFAULT_LOAD_REPORT_PATH, DEFAULT_ORCHESTRATION_CONFIG_PATH,
    DEFAULT_RESOURCE_REPORT_PATH, DEFAULT_RUNTIME_REPORT_PATH, DEFAULT_STATUS_REPORT_PATH,
};

pub fn print_usage(scope: Option<&str>) {
    match scope {
        Some("node") => {
            println!("node commands:");
            println!("  node list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!(
                "  node info <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
        }
        Some("topic") => {
            println!("topic commands:");
            println!("  topic list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!(
                "  topic info <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!("  topic hz <name> [--endpoint <addr>] [--mode <embedded|daemon>] [--timeout-ms <ms>] [--iterations <n>] [--interval-ms <ms>] [--max-items <n>] [--json]");
            println!("  topic echo <name> [--endpoint <addr>] [--mode <embedded|daemon>] [--timeout-ms <ms>] [--limit <n>] [--iterations <n>] [--interval-ms <ms>] [--max-items <n>] [--json]");
        }
        Some("gateway") => {
            println!("gateway commands:");
            println!(
                "  gateway serve [--bind <addr>] [--source <live|demo|file>] [--report <path>] [--runtime-report <path>] [--middleware-report <path>] [--resource-report <path>] [--once] [--json]"
            );
            println!(
                "  gateway observe [--endpoint <addr>] [--timeout-ms <ms>] [--audit-limit <n>] [--json]"
            );
            println!(
                "  gateway policy-get [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  gateway policy-set [--endpoint <addr>] [--timeout-ms <ms>] [--policy <path>] [--route-preference <local_first|network_first|adaptive>] [--rate-limit <n>] [--namespace-isolation <name>] [--rollback-enabled <bool>] [--topic-max-retry <n>] [--topic-retry-timeout-ms <ms>] [--service-retry-timeout-ms <ms>] [--action-retry-timeout-ms <ms>] [--mission-retry-timeout-ms <ms>] [--topic-max-inflight <n>] [--topic-replay-window <n|none>] [--topic-dedupe-window <n|none>] [--topic-replay-strategy <block_publisher|drop_oldest>] [--json]"
            );
            println!(
                "  gateway audit [--endpoint <addr>] [--timeout-ms <ms>] [--limit <n>] [--category <name>] [--json]"
            );
            println!(
                "  gateway shutdown [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  note: commands with --endpoint also support [--sidecar-registry <path>] for sidecar runtime auto-discovery"
            );
        }
        Some("snapshot") => {
            println!("snapshot commands:");
            println!(
                "  snapshot config [list|fields] [--list|--list-fields] [--field <key>] [--file <path>] [--endpoint <addr>] [--timeout-ms <ms>] [--enable|--disable] [--enabled <bool>] [--interval-ms <ms>] [--rate-max <n>] [--rate-burst <n>] [--atomic-write <bool>] [--include <status,runtime,middleware,resource|all>] [--status-report <path>] [--runtime-report <path>] [--middleware-report <path>] [--resource-report <path>] [--no-save] [--json]"
            );
        }
        Some("mission") => {
            println!("mission commands:");
            println!("  mission list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!(
                "  mission request <name> --message <payload> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  mission reply <name> --message <payload> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  mission stream <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--max-items <n>] [--iterations <n>] [--interval-ms <ms>] [--json]"
            );
            println!(
                "  mission watch [name] [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--iterations <n>] [--interval-ms <ms>] [--json]"
            );
        }
        Some("action") => {
            println!("action commands:");
            println!("  action list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!(
                "  action info <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  action send <name> --goal <payload> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  action cancel <name> --goal-id <id> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  action watch [name] [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--iterations <n>] [--interval-ms <ms>] [--json]"
            );
        }
        Some("service") => {
            println!("service commands:");
            println!("  service list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!("  service call <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--request <payload>] [--timeout-ms <ms>] [--json]");
        }
        Some("plugin") => {
            println!("plugin commands:");
            println!(
                "  plugin list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--loaded] [--json]"
            );
        }
        Some("health") => {
            println!("health command:");
            println!(
                "  health [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
        }
        Some("graph") => {
            println!("graph command:");
            println!(
                "  graph [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
        }
        Some("obs") => {
            println!("obs commands:");
            println!(
                "  obs export [--endpoint <addr>] [--timeout-ms <ms>] [--format <prometheus|otel>] [--alert-template <none|basic>] [--json]"
            );
        }
        Some("orchestrate") => {
            println!("orchestrate commands:");
            println!("  orchestrate init [--output <path>] [--json]");
            println!(
                "  orchestrate validate [--file <path>] [--profile <name>] [--overlay <file1,file2>] [--json]"
            );
            println!(
                "  orchestrate plan [--file <path>] [--profile <name>] [--overlay <file1,file2>] [--task <name>] [--group <name>] [--json]"
            );
            println!(
                "  orchestrate run [--file <path>] [--profile <name>] [--overlay <file1,file2>] [--task <name>] [--group <name>] [--max-parallel <n>] [--dry-run] [--continue-on-error] [--json]"
            );
            println!(
                "  orchestrate up [--file <path>] [--profile <name>] [--overlay <file1,file2>] [--task <name>] [--group <name>] [--state-file <path>] [--json]"
            );
            println!(
                "  orchestrate down [--task <name>] [--group <name>] [--state-file <path>] [--json]"
            );
            println!("  orchestrate status [--state-file <path>] [--prune] [--json]");
        }
        Some("ops") => {
            println!("ops commands:");
            println!(
                "  ops snapshot [--endpoint <addr>] [--timeout-ms <ms>] [--report <path>] [--refresh-demo] [--policy <path>] [--topic-warn-utilization <pct>] [--topic-critical-utilization <pct>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  ops console [--endpoint <addr>] [--timeout-ms <ms>] [--report <path>] [--refresh-demo] [--output <path>] [--policy <path>] [--topic-warn-utilization <pct>] [--topic-critical-utilization <pct>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  ops diff [--endpoint <addr>] [--timeout-ms <ms>] [--report <path>] [--baseline-endpoint <addr>] [--baseline-timeout-ms <ms>] [--baseline-report <path>] [--output <path>] [--policy <path>] [--topic-warn-utilization <pct>] [--topic-critical-utilization <pct>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  ops fleet [--endpoints <e1,e2,...>] [--baseline-endpoints <e1,e2,...>] [--timeout-ms <ms>] [--baseline-timeout-ms <ms>] [--output <path>] [--policy <path>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  ops profile [--endpoints <e1,e2,...>] [--baseline-endpoints <e1,e2,...>] [--input-bag <bag-path>] [--obs-format <prometheus|otel|both>] [--profile-template <perf-regression|task-stall|plugin-anomaly|queue-backlog>] [--output <path>] [--policy <path>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  note: ops fleet can auto-discover local and peer endpoints from [--sidecar-registry <path>] when --endpoints is omitted"
            );
            println!("  ops replay [--input <bag-path>] [--output <path>] [--json]");
        }
        Some("sdk") => {
            println!("sdk commands:");
            println!(
                "  sdk init <project-name> [--template <local|network|mission|service|action>] [--output <dir>] [--json]"
            );
            println!(
                "  sdk migrate-batch [--projects <dir1,dir2,...>] [--projects-file <path>] [--scan-root <dir>] [--filter-schema <n>] [--filter-template <name>] [--precheck-only] [--target-schema <n>] [--severity-map <path>] [--dry-run] [--fail-fast] [--output <path>] [--json]"
            );
            println!(
                "  sdk migrate-report [--batch-report <path>] [--severity-map <path>] [--json]"
            );
            println!(
                "  sdk retry-failed --batch-report <path> [--target-schema <n>] [--dry-run] [--fail-fast] [--output <path>] [--json]"
            );
            println!(
                "  sdk migrate <project-dir> [--project <dir>] [--target-schema <n>] [--dry-run] [--json]"
            );
            println!("  sdk rollback <project-dir> [--project <dir>] [--backup <path>] [--json]");
            println!(
                "  sdk rollback-batch [--projects <dir1,dir2,...>] [--projects-file <path>] [--scan-root <dir>] [--batch-report <path>] [--fail-fast] [--output <path>] [--json]"
            );
        }
        Some("bag") => {
            println!("bag commands:");
            println!(
                "  bag record [--output <path>] [--count <n>] [--topic <name>] [--endpoint <addr>] [--timeout-ms <ms>] [--max-items <n>] [--interval-ms <ms>] [--domain <local|network>]"
            );
            println!("  bag play [--input <path>] [--endpoint <addr>] [--timeout-ms <ms>] [--topic <name>] [--speed <instant|realtime|<factor>>] [--json]");
        }
        _ => {
            println!("robotrt-cli commands:");
            println!("  help [command]");
            println!("  middleware load [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!("  runtime load [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!("  node list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!(
                "  node info <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!("  topic list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!(
                "  topic info <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!("  topic hz <name> [--endpoint <addr>] [--mode <embedded|daemon>] [--timeout-ms <ms>] [--iterations <n>] [--interval-ms <ms>] [--max-items <n>] [--json]");
            println!("  topic echo <name> [--endpoint <addr>] [--mode <embedded|daemon>] [--timeout-ms <ms>] [--limit <n>] [--iterations <n>] [--interval-ms <ms>] [--max-items <n>] [--json]");
            println!("  service list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!("  service call <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--request <payload>] [--timeout-ms <ms>] [--json]");
            println!("  action list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!(
                "  action info <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  action send <name> --goal <payload> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  action cancel <name> --goal-id <id> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  action watch [name] [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--iterations <n>] [--interval-ms <ms>] [--json]"
            );
            println!("  mission list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]");
            println!(
                "  mission request <name> --message <payload> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  mission reply <name> --message <payload> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  mission stream <name> [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--max-items <n>] [--iterations <n>] [--interval-ms <ms>] [--json]"
            );
            println!(
                "  mission watch [name] [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--iterations <n>] [--interval-ms <ms>] [--json]"
            );
            println!(
                "  gateway serve [--bind <addr>] [--source <live|demo|file>] [--report <path>] [--runtime-report <path>] [--middleware-report <path>] [--resource-report <path>] [--once] [--json]"
            );
            println!(
                "  gateway observe [--endpoint <addr>] [--timeout-ms <ms>] [--audit-limit <n>] [--json]"
            );
            println!(
                "  gateway policy-get [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  gateway policy-set [--endpoint <addr>] [--timeout-ms <ms>] [--policy <path>] [--route-preference <local_first|network_first|adaptive>] [--rate-limit <n>] [--namespace-isolation <name>] [--rollback-enabled <bool>] [--topic-max-retry <n>] [--topic-retry-timeout-ms <ms>] [--service-retry-timeout-ms <ms>] [--action-retry-timeout-ms <ms>] [--mission-retry-timeout-ms <ms>] [--topic-max-inflight <n>] [--topic-replay-window <n|none>] [--topic-dedupe-window <n|none>] [--topic-replay-strategy <block_publisher|drop_oldest>] [--json]"
            );
            println!(
                "  gateway audit [--endpoint <addr>] [--timeout-ms <ms>] [--limit <n>] [--category <name>] [--json]"
            );
            println!(
                "  gateway shutdown [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  snapshot config [list|fields] [--list|--list-fields] [--field <key>] [--file <path>] [--endpoint <addr>] [--timeout-ms <ms>] [--enable|--disable] [--enabled <bool>] [--interval-ms <ms>] [--rate-max <n>] [--rate-burst <n>] [--atomic-write <bool>] [--include <status,runtime,middleware,resource|all>] [--status-report <path>] [--runtime-report <path>] [--middleware-report <path>] [--resource-report <path>] [--no-save] [--json]"
            );
            println!(
                "  health [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  graph [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--json]"
            );
            println!(
                "  plugin list [--mode <embedded|daemon>] [--endpoint <addr>] [--timeout-ms <ms>] [--loaded] [--json]"
            );
            println!(
                "  obs export [--endpoint <addr>] [--timeout-ms <ms>] [--format <prometheus|otel>] [--alert-template <none|basic>] [--json]"
            );
            println!("  orchestrate init [--output <path>] [--json]");
            println!(
                "  orchestrate validate [--file <path>] [--profile <name>] [--overlay <file1,file2>] [--json]"
            );
            println!(
                "  orchestrate plan [--file <path>] [--profile <name>] [--overlay <file1,file2>] [--task <name>] [--group <name>] [--json]"
            );
            println!(
                "  orchestrate run [--file <path>] [--profile <name>] [--overlay <file1,file2>] [--task <name>] [--group <name>] [--max-parallel <n>] [--dry-run] [--continue-on-error] [--json]"
            );
            println!(
                "  orchestrate up [--file <path>] [--profile <name>] [--overlay <file1,file2>] [--task <name>] [--group <name>] [--state-file <path>] [--json]"
            );
            println!(
                "  orchestrate down [--task <name>] [--group <name>] [--state-file <path>] [--json]"
            );
            println!("  orchestrate status [--state-file <path>] [--prune] [--json]");
            println!(
                "  ops snapshot [--endpoint <addr>] [--timeout-ms <ms>] [--report <path>] [--refresh-demo] [--policy <path>] [--topic-warn-utilization <pct>] [--topic-critical-utilization <pct>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  ops console [--endpoint <addr>] [--timeout-ms <ms>] [--report <path>] [--refresh-demo] [--output <path>] [--policy <path>] [--topic-warn-utilization <pct>] [--topic-critical-utilization <pct>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  ops diff [--endpoint <addr>] [--timeout-ms <ms>] [--report <path>] [--baseline-endpoint <addr>] [--baseline-timeout-ms <ms>] [--baseline-report <path>] [--output <path>] [--policy <path>] [--topic-warn-utilization <pct>] [--topic-critical-utilization <pct>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  ops fleet [--endpoints <e1,e2,...>] [--baseline-endpoints <e1,e2,...>] [--timeout-ms <ms>] [--baseline-timeout-ms <ms>] [--output <path>] [--policy <path>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!(
                "  ops profile [--endpoints <e1,e2,...>] [--baseline-endpoints <e1,e2,...>] [--input-bag <bag-path>] [--obs-format <prometheus|otel|both>] [--profile-template <perf-regression|task-stall|plugin-anomaly|queue-backlog>] [--output <path>] [--policy <path>] [--ack-warn-coverage <pct>] [--ack-critical-coverage <pct>] [--json]"
            );
            println!("  ops replay [--input <bag-path>] [--output <path>] [--json]");
            println!(
                "  sdk init <project-name> [--template <local|network|mission|service|action>] [--output <dir>] [--json]"
            );
            println!(
                "  sdk migrate-batch [--projects <dir1,dir2,...>] [--projects-file <path>] [--scan-root <dir>] [--filter-schema <n>] [--filter-template <name>] [--precheck-only] [--target-schema <n>] [--severity-map <path>] [--dry-run] [--fail-fast] [--output <path>] [--json]"
            );
            println!(
                "  sdk migrate-report [--batch-report <path>] [--severity-map <path>] [--json]"
            );
            println!(
                "  sdk retry-failed --batch-report <path> [--target-schema <n>] [--dry-run] [--fail-fast] [--output <path>] [--json]"
            );
            println!(
                "  sdk migrate <project-dir> [--project <dir>] [--target-schema <n>] [--dry-run] [--json]"
            );
            println!("  sdk rollback <project-dir> [--project <dir>] [--backup <path>] [--json]");
            println!(
                "  sdk rollback-batch [--projects <dir1,dir2,...>] [--projects-file <path>] [--scan-root <dir>] [--batch-report <path>] [--fail-fast] [--output <path>] [--json]"
            );
            println!(
                "  bag record [--output <path>] [--count <n>] [--topic <name>] [--endpoint <addr>] [--timeout-ms <ms>] [--max-items <n>] [--interval-ms <ms>] [--domain <local|network>]"
            );
            println!("  bag play [--input <path>] [--endpoint <addr>] [--timeout-ms <ms>] [--topic <name>] [--speed <instant|realtime|<factor>>] [--json]");
            println!(
                "note: endpoint commands also support [--sidecar-registry <path>] for runtime auto-discovery"
            );
            println!();
            println!("default load report path: {DEFAULT_LOAD_REPORT_PATH}");
            println!("default resource report path: {DEFAULT_RESOURCE_REPORT_PATH}");
            println!("default runtime report path: {DEFAULT_RUNTIME_REPORT_PATH}");
            println!("default status report path: {DEFAULT_STATUS_REPORT_PATH}");
            println!("default bag path: {DEFAULT_BAG_PATH}");
            println!("default orchestration config path: {DEFAULT_ORCHESTRATION_CONFIG_PATH}");
        }
    }
}