revoke-cli 0.3.0

Command-line interface for managing Revoke microservices infrastructure
pub mod service;
pub mod config;
pub mod gateway;
pub mod trace;
pub mod health;
pub mod init;
pub mod dev;

#[derive(clap::Subcommand)]
pub enum ServiceCommands {
    /// List all services
    List {
        /// Filter by status
        #[arg(short, long)]
        status: Option<String>,
        /// Output format (table, json, yaml)
        #[arg(short, long, default_value = "table")]
        format: String,
    },
    /// Register a new service
    Register {
        /// Service name
        name: String,
        /// Service address
        #[arg(short, long)]
        address: String,
        /// Service port
        #[arg(short, long)]
        port: u16,
        /// Service tags
        #[arg(short, long)]
        tags: Vec<String>,
    },
    /// Deregister a service
    Deregister {
        /// Service ID
        id: String,
    },
    /// Get service details
    Info {
        /// Service name or ID
        name: String,
    },
    /// Check service health
    Check {
        /// Service name or ID
        name: String,
    },
}

#[derive(clap::Subcommand)]
pub enum ConfigCommands {
    /// Get configuration value
    Get {
        /// Configuration key
        key: String,
    },
    /// Set configuration value
    Set {
        /// Configuration key
        key: String,
        /// Configuration value
        value: String,
    },
    /// Delete configuration
    Delete {
        /// Configuration key
        key: String,
    },
    /// List configuration keys
    List {
        /// Key prefix
        #[arg(short, long)]
        prefix: Option<String>,
    },
    /// Watch configuration changes
    Watch {
        /// Configuration key
        key: String,
    },
    /// Export configuration
    Export {
        /// Output file
        #[arg(short, long)]
        output: Option<String>,
        /// Export format (json, yaml, toml)
        #[arg(short, long, default_value = "yaml")]
        format: String,
    },
    /// Import configuration
    Import {
        /// Input file
        file: String,
        /// Import format (json, yaml, toml)
        #[arg(short, long)]
        format: Option<String>,
    },
}

#[derive(clap::Subcommand)]
pub enum GatewayCommands {
    /// List gateway routes
    Routes {
        /// Filter by service
        #[arg(short, long)]
        service: Option<String>,
    },
    /// Add a new route
    AddRoute {
        /// Route path
        path: String,
        /// Target service
        service: String,
        /// HTTP methods
        #[arg(short, long)]
        methods: Vec<String>,
    },
    /// Remove a route
    RemoveRoute {
        /// Route ID or path
        id: String,
    },
    /// Show gateway statistics
    Stats {
        /// Service filter
        #[arg(short, long)]
        service: Option<String>,
    },
    /// Test gateway configuration
    Test {
        /// Configuration file
        #[arg(short, long)]
        config: Option<String>,
    },
}

#[derive(clap::Subcommand)]
pub enum TraceCommands {
    /// List recent traces
    List {
        /// Service filter
        #[arg(short, long)]
        service: Option<String>,
        /// Time range (e.g., "1h", "30m")
        #[arg(short, long, default_value = "1h")]
        range: String,
        /// Maximum number of traces
        #[arg(short, long, default_value = "100")]
        limit: usize,
    },
    /// Get trace details
    Get {
        /// Trace ID
        trace_id: String,
    },
    /// Search traces
    Search {
        /// Search query
        query: String,
        /// Time range
        #[arg(short, long, default_value = "1h")]
        range: String,
    },
    /// Export traces
    Export {
        /// Output file
        output: String,
        /// Export format
        #[arg(short, long, default_value = "json")]
        format: String,
        /// Time range
        #[arg(short, long, default_value = "1h")]
        range: String,
    },
}

#[derive(clap::Subcommand)]
pub enum HealthCommands {
    /// Check overall system health
    Check {
        /// Include detailed information
        #[arg(short, long)]
        detailed: bool,
    },
    /// Check specific service health
    Service {
        /// Service name
        name: String,
    },
    /// Monitor health status
    Monitor {
        /// Update interval in seconds
        #[arg(short, long, default_value = "5")]
        interval: u64,
        /// Services to monitor
        #[arg(short, long)]
        services: Vec<String>,
    },
}