#[cfg(feature = "wake-claude")]
pub mod claude_channel;
pub mod ensure_agent_webhooks;
#[cfg(feature = "wake-grok")]
pub mod grok_listen;
pub mod inbox;
pub mod mail;
#[cfg(feature = "wake-grok")]
pub mod node_client;
pub mod send;
pub mod web_client;
pub const COMMANDS: &[&str] = &["web-client", "node-client", "grok-listen", "claude-channel", "inbox", "send", "mail", "ensure-agent-webhooks"];
pub fn dispatch(command: &str, args: Vec<String>) -> Result<(), String> {
match command {
"web-client" => web_client::run(args),
#[cfg(feature = "wake-grok")]
"node-client" => node_client::run(args),
#[cfg(feature = "wake-grok")]
"grok-listen" => grok_listen::run(args),
#[cfg(not(feature = "wake-grok"))]
"node-client" | "grok-listen" => return Err("this build was made without feature wake-grok".to_string()),
#[cfg(feature = "wake-claude")]
"claude-channel" => claude_channel::run(args),
"inbox" => inbox::run(args),
"send" => send::run(args),
"mail" => mail::run(args),
"ensure-agent-webhooks" => ensure_agent_webhooks::run(args),
other => return Err(format!("unknown command {other:?}; commands: {}", COMMANDS.join(", "))),
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn an_unknown_command_is_named_not_run() {
let e = dispatch("nope", vec![]).unwrap_err();
assert!(e.contains("nope") && e.contains("web-client") && e.contains("mail"));
}
}