pub fn print_usage() {
eprintln!("collet — Relentless agentic coding orchestrator with zero-drop agent loops");
eprintln!("\x1b[2m Orchestrates any LLM, any CLI agent, across TUI, web, and IDE.\x1b[0m");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet Interactive TUI");
eprintln!(" collet \"fix the bug in main.rs\" Headless (run & exit)");
eprintln!(" collet \"lint this\" --watch --ext rs --cwd ./src --agent code Watch mode");
eprintln!();
eprintln!("FLAGS:");
eprintln!(" -m, --model <name> Override model (e.g. glm-5)");
eprintln!(" -d, --dir <path> Set working directory (project path)");
eprintln!(" -y, --yolo Auto-commit, skip confirmations");
eprintln!(" -c, --continue Resume last incomplete session");
eprintln!(" -r, --resume Pick from recent sessions");
eprintln!(" -w, --watch Re-run on file changes");
eprintln!(" -e, --ext <exts> Watch extensions (comma-separated)");
eprintln!(" -D, --debounce <ms> Watch debounce (default: 2000)");
eprintln!(" --json-metrics Print JSON metrics to stderr on exit (headless)");
eprintln!();
eprintln!("WATCH MODE OPTIONS:");
eprintln!(" --cwd <path> Directory to watch (default: current dir)");
eprintln!(" -a, --agent <name> Use custom agent from config");
eprintln!();
eprintln!("COMMANDS:");
eprintln!(" collet setup Create ~/.config/collet/config.toml");
eprintln!(" collet secure Encrypt & save API key (--web for web credentials)");
eprintln!(" collet unsecure Remove encrypted credentials (--web for web)");
eprintln!(" collet status Show resolved config");
eprintln!(" collet web Start web server (requires `web` feature)");
eprintln!(" collet remote Manage remote gateway (add|rm|ls|start|stop|enable|logs)");
eprintln!(" collet acp serve Start ACP server on stdio (for IDE integration)");
eprintln!();
eprintln!("WEB OPTIONS (collet web ...):");
eprintln!(" -h, --host <addr> Bind host (default: 127.0.0.1)");
eprintln!(" -p, --port <n> Bind port (default: 3080)");
eprintln!(" -u, --username <name> Login username (default: collet)");
eprintln!(" -P, --password <pw> Require password for API access");
eprintln!(" --cors <origins> Additional CORS origins (comma-separated)");
eprintln!();
eprintln!("PROVIDERS:");
eprintln!(" collet provider add [name] Register a provider");
eprintln!(" collet provider remove Remove a registered provider");
eprintln!(" collet provider list Show registered providers");
eprintln!(" collet provider use [name] Switch active provider");
eprintln!();
eprintln!("CLI AGENTS:");
eprintln!(" collet clis Show registered CLI agents");
eprintln!(" collet clis add [name] Register a CLI coding agent");
eprintln!(" collet clis remove [name] Remove a registered CLI agent");
eprintln!(" collet clis auto Auto-detect and sync CLI agents");
eprintln!();
eprintln!("MCP SERVERS:");
eprintln!(" collet mcp Show MCP server configuration");
eprintln!(" collet mcp add <name> ... Add an MCP server");
eprintln!(" collet mcp remove <name> Remove an MCP server");
eprintln!(" collet mcp enable <name> Enable an MCP server");
eprintln!(" collet mcp disable <name> Disable an MCP server");
eprintln!();
eprintln!("MAINTENANCE:");
eprintln!(" collet update, -U Check for updates");
eprintln!(" collet version, -V Show version");
eprintln!();
eprintln!("ENV VARS (override config file):");
eprintln!(" COLLET_BASE_URL API endpoint");
eprintln!(" COLLET_MODEL Model override (defaults to provider's first model)");
eprintln!();
eprintln!("Config: {}", crate::config::config_file_path().display());
}
pub fn print_setup_usage() {
eprintln!("collet setup — Interactive configuration wizard");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet setup Quick setup (provider + auto model assignment)");
eprintln!(" collet setup --advanced Full setup (all options, 15 steps)");
eprintln!();
eprintln!("DESCRIPTION:");
eprintln!(" Creates or updates ~/.collet/config.toml through an interactive wizard.");
eprintln!();
eprintln!(" Default (quick) mode:");
eprintln!(" 1. Select an API provider");
eprintln!(" 2. Enter API key — models are fetched and auto-assigned by role");
eprintln!(" (architect → best model, code → balanced, ask → fastest)");
eprintln!(" 3. Detect installed CLI agents (claude, codex, cursor, etc.)");
eprintln!(" 4. Telemetry consent");
eprintln!(" 5. Summary of what was configured");
eprintln!();
eprintln!(" Advanced mode (--advanced):");
eprintln!(" Full 15-step wizard: collaboration, worktree isolation, RAG,");
eprintln!(" remote gateway, per-agent model assignment, and more.");
eprintln!();
eprintln!(" If a config file already exists, the wizard pre-fills current values.");
eprintln!(" Agent models can always be changed later in .collet/agents/*.md");
}
pub fn print_secure_usage() {
eprintln!("collet secure — Encrypt and save credentials");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet secure Encrypt and save API key");
eprintln!(" collet secure --web Encrypt and save web credentials (username + password)");
eprintln!();
eprintln!("DESCRIPTION:");
eprintln!(" Prompts for an API key (or web credentials with --web) and saves it");
eprintln!(" encrypted in config.toml. The key is encrypted using a machine-specific");
eprintln!(" secret derived from the OS keychain.");
}
pub fn print_unsecure_usage() {
eprintln!("collet unsecure — Remove encrypted credentials");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet unsecure Remove saved API key");
eprintln!(" collet unsecure --web Remove saved web credentials");
eprintln!();
eprintln!("DESCRIPTION:");
eprintln!(" Removes the encrypted API key or web credentials from config.toml.");
}
pub fn print_status_usage() {
eprintln!("collet status — Show resolved configuration");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet status");
eprintln!();
eprintln!("DESCRIPTION:");
eprintln!(" Displays the currently resolved configuration including API provider,");
eprintln!(" model, registered providers, MCP servers, agent definitions, and");
eprintln!(" feature flags. Useful for debugging configuration issues.");
}
pub fn print_web_usage() {
eprintln!("collet web — Start the web server UI");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet web [OPTIONS]");
eprintln!();
eprintln!("OPTIONS:");
eprintln!(" -h, --host <addr> Bind host (default: 127.0.0.1)");
eprintln!(" -p, --port <n> Bind port (default: 3080)");
eprintln!(" -u, --username <name> Login username (default: collet)");
eprintln!(" -P, --password <pw> Require password for API access");
eprintln!(" --cors <origins> Additional CORS origins (comma-separated)");
eprintln!();
eprintln!("DESCRIPTION:");
eprintln!(" Starts a web-based UI for interacting with collet. Requires the");
eprintln!(" `web` feature to be enabled at build time.");
eprintln!();
eprintln!("EXAMPLES:");
eprintln!(" collet web");
eprintln!(" collet web -p 8080 --password secret");
eprintln!(" collet web --cors https://example.com");
}
pub fn print_remote_usage() {
eprintln!("USAGE: collet remote <command>");
eprintln!();
eprintln!("COMMANDS:");
eprintln!(" add [platform] Add a platform adapter (telegram, slack, discord)");
eprintln!(" rm <platform> Remove a platform adapter");
eprintln!(" ls List configured adapters and status");
eprintln!(" start Start gateway as daemon (--fg for foreground)");
eprintln!(" restart Restart the gateway daemon");
eprintln!(" stop Stop a running gateway");
eprintln!(" enable Register as login item (auto-start)");
eprintln!(" disable Unregister login item");
eprintln!(" logs [-f] Show gateway logs (-f for follow)");
eprintln!(" status Show current gateway status");
}
pub fn print_acp_usage() {
eprintln!("collet acp — Agent Client Protocol server");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet acp serve");
eprintln!();
eprintln!("DESCRIPTION:");
eprintln!(" Starts an ACP (Agent Client Protocol) server on stdio.");
eprintln!(" Used by JetBrains IDEs, Zed, and VSCode extensions for");
eprintln!(" IDE-integrated AI coding assistance.");
}
pub fn print_update_usage() {
eprintln!("collet update — Check for updates");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet update");
eprintln!();
eprintln!("DESCRIPTION:");
eprintln!(" Checks crates.io for a newer version of collet and displays");
eprintln!(" the install command if an update is available.");
}
pub fn print_mcp_usage() {
eprintln!("collet mcp — Manage MCP server configuration");
eprintln!();
eprintln!("USAGE:");
eprintln!(" collet mcp Show current MCP config");
eprintln!(" collet mcp add <name> <source> [-g|--global] [flags] Add an MCP server");
eprintln!(" collet mcp remove|rm <name> [-g|--global] Remove an MCP server");
eprintln!(" collet mcp enable <name> Enable a disabled server");
eprintln!(" collet mcp disable <name> Disable a server");
eprintln!();
eprintln!("FLAGS:");
eprintln!(
" -g, --global Save to ~/.collet/mcp.json (default: project .collet/mcp.json)"
);
eprintln!(" -a, --args <val> Extra argument appended to args array (repeatable)");
eprintln!(" -e, --env K=V Environment variable (repeatable)");
eprintln!(" -h, --headers K=V HTTP header (repeatable)");
eprintln!(" -d, --description Description text");
eprintln!();
eprintln!("SOURCES:");
eprintln!(" npm:@playwright/mcp npm package (runs via npx -y)");
eprintln!(" local:alcove Local binary");
eprintln!(" https://example.com/mcp HTTP endpoint (auto-detected)");
eprintln!(" github:owner/repo@tag GitHub repository (runs via npx)");
eprintln!(" bare-name Treated as npm package");
eprintln!();
eprintln!("EXAMPLES:");
eprintln!(" collet mcp add playwright npm:@playwright/mcp -g");
eprintln!(" collet mcp add alcove local:alcove -g -e DOC_ROOT=/path");
eprintln!(
" collet mcp add context7 https://mcp.context7.com/mcp -h Authorization=\"Bearer $KEY\""
);
eprintln!(" collet mcp rm context7 -g");
eprintln!();
eprintln!("Config locations:");
eprintln!(" Project: .collet/mcp.json");
eprintln!(" Global: ~/.collet/mcp.json");
}