use clap::{Parser, Subcommand}; #[derive(Parser)] #[command(author, version, about = "DGX Spark Launcher для vLLM и SGLang")] pub struct Cli { #[arg(long, short, default_value = "config.toml")] pub config: String, #[arg(long, short, help = "Показать команды без выполнения")] pub dry_run: bool, #[command(subcommand)] pub command: Commands, } #[derive(Subcommand)] pub enum Commands { /// Запустить кластер Serve { #[arg(long, required = true)] recipe: String, #[arg(long, default_value = "auto")] cluster: String, /// Keep containers after stop (default: auto-remove on stop) #[arg(long, default_value = "false")] keep: bool, }, /// Показать логи контейнеров Logs { #[arg(long, required = true)] recipe: String, #[arg(long, action = clap::ArgAction::SetTrue)] follow: bool, }, /// Остановить кластер Stop { #[arg(long, required = true)] recipe: String, }, /// Проверить здоровье кластера Health { #[arg( long, help = "Имя кластера (например, 4nodes-switch). Если не указано - проверяет все." )] cluster: Option, #[arg( long, help = "Показать хост-ключи узлов (для добавления в config.toml)" )] fingerprint: bool, }, /// Проверить и исправить рецепт (doctor mode) Doctor { #[arg(long, required = true, help = "Имя рецепта для проверки")] recipe: String, #[arg( long, default_value = "auto", help = "Кластер (если не auto — использует recipe.cluster)" )] cluster: String, #[arg( long, help = "Автоматически исправить проблемы (создать Dockerfile + собрать образ)" )] repair: bool, }, /// Управление tmux-сессиями (альтернатива Docker) #[command(subcommand)] Tmux(TmuxCommands), /// Auto-discover host keys and write them into config.toml InitHostKeys { #[arg( long, help = "Имя кластера (например, 4nodes-switch). Если не указано — все." )] cluster: Option, }, } #[derive(Subcommand)] pub enum TmuxCommands { /// Запустить кластер через tmux Serve { #[arg(long, required = true)] recipe: String, #[arg(long, default_value = "auto")] cluster: String, }, /// Остановить tmux-сессии Stop { #[arg(long, required = true)] recipe: String, #[arg(long, default_value = "auto")] cluster: String, }, /// Статус tmux-сессий (подробный) Status { #[arg(long, required = true)] recipe: String, #[arg(long, default_value = "auto")] cluster: String, }, /// Показать логи tmux-сессий Logs { #[arg(long, required = true)] recipe: String, #[arg(long, action = clap::ArgAction::SetTrue)] follow: bool, #[arg(long, default_value = "auto")] cluster: String, }, /// Подключиться к tmux-сессии головного узла Attach { #[arg(long, required = true)] recipe: String, #[arg(long, default_value = "auto")] cluster: String, }, }