brokecrew/src/cli.rs

98 lines
2.8 KiB
Rust

use clap::{Args, Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser, Debug)]
#[command(
name = "brokecrew",
version,
about = "A Rust-native multi-model AI team CLI with resilient OpenRouter fallback routing",
long_about = "BrokeCrew lets you interact with a coordinated team of AI personas backed by OpenRouter models.\nFeatures two-stage routing, automatic candidate fallbacks, budget tracking, and multi-agent handoff pipelines."
)]
pub struct Cli {
#[arg(long, global = true, help = "Path to config.toml file")]
pub config_file: Option<PathBuf>,
#[arg(long, global = true, help = "Path to personas.toml file")]
pub personas_file: Option<PathBuf>,
#[arg(
long,
global = true,
env = "OPENROUTER_API_KEY",
help = "OpenRouter API Key (overrides keyring & env)"
)]
pub api_key: Option<String>,
#[arg(
long,
global = true,
help = "Output structured logs in JSON format to stderr"
)]
pub json_logs: bool,
#[arg(long, short, global = true, help = "Enable verbose debug logs")]
pub verbose: bool,
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
#[command(about = "Chat with a persona or multi-agent pipeline")]
Chat(ChatArgs),
#[command(about = "Manage configuration and credentials")]
Config(ConfigArgs),
#[command(about = "List and inspect personas and pipelines")]
Personas(PersonasArgs),
#[command(about = "Display live model registry and rate-limit budget status")]
Status,
}
#[derive(Args, Debug, Default)]
pub struct ChatArgs {
#[arg(help = "The message or prompt to send. If omitted, starts interactive chat REPL.")]
pub prompt: Option<String>,
#[arg(short, long, help = "Directly specify target persona (skips router)")]
pub persona: Option<String>,
#[arg(long, help = "Run a multi-agent pipeline (e.g. build-and-review)")]
pub pipeline: Option<String>,
#[arg(long, help = "Allow experimental stealth model candidates")]
pub allow_stealth: bool,
#[arg(long, help = "Force escalation to paid model candidates")]
pub escalate: bool,
}
#[derive(Args, Debug)]
pub struct ConfigArgs {
#[command(subcommand)]
pub action: ConfigSubcommand,
}
#[derive(Subcommand, Debug)]
pub enum ConfigSubcommand {
#[command(about = "Securely set and save OpenRouter API key to OS credential store")]
SetKey {
#[arg(help = "Optional key directly passed; if omitted, securely prompted")]
key: Option<String>,
},
}
#[derive(Args, Debug)]
pub struct PersonasArgs {
#[command(subcommand)]
pub action: PersonasSubcommand,
}
#[derive(Subcommand, Debug)]
pub enum PersonasSubcommand {
#[command(about = "List all configured personas, candidates, triggers, and pipelines")]
List,
}