pub mod hook;
pub mod init;
use clap::{Parser, Subcommand, ValueEnum};
#[derive(Parser)]
#[command(
name = "symforge",
about = "SymForge MCP server and hook system",
version
)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Init {
#[arg(long, value_enum, default_value_t = InitClient::All)]
client: InitClient,
},
Daemon,
Hook {
#[command(subcommand)]
subcommand: Option<HookSubcommand>,
},
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)]
pub enum InitClient {
Claude,
Codex,
Gemini,
#[value(name = "kilo-code", alias = "kilo")]
KiloCode,
All,
}
#[derive(Subcommand, Debug, Clone)]
pub enum HookSubcommand {
Read,
Edit,
Write,
Grep,
#[command(name = "session-start")]
SessionStart,
#[command(name = "prompt-submit")]
PromptSubmit,
#[command(name = "pre-tool")]
PreTool,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_init_defaults_to_all_clients() {
let cli = Cli::parse_from(["symforge", "init"]);
match cli.command {
Some(Commands::Init { client }) => assert_eq!(client, InitClient::All),
_ => panic!("expected init command"),
}
}
#[test]
fn test_init_accepts_codex_client() {
let cli = Cli::parse_from(["symforge", "init", "--client", "codex"]);
match cli.command {
Some(Commands::Init { client }) => assert_eq!(client, InitClient::Codex),
_ => panic!("expected init command"),
}
}
#[test]
fn test_init_accepts_gemini_client() {
let cli = Cli::parse_from(["symforge", "init", "--client", "gemini"]);
match cli.command {
Some(Commands::Init { client }) => assert_eq!(client, InitClient::Gemini),
_ => panic!("expected init command"),
}
}
#[test]
fn test_init_accepts_kilo_code_client() {
let cli = Cli::parse_from(["symforge", "init", "--client", "kilo-code"]);
match cli.command {
Some(Commands::Init { client }) => assert_eq!(client, InitClient::KiloCode),
_ => panic!("expected init command"),
}
}
#[test]
fn test_init_accepts_kilo_alias() {
let cli = Cli::parse_from(["symforge", "init", "--client", "kilo"]);
match cli.command {
Some(Commands::Init { client }) => assert_eq!(client, InitClient::KiloCode),
_ => panic!("expected init command"),
}
}
#[test]
fn test_daemon_command_parses() {
let cli = Cli::parse_from(["symforge", "daemon"]);
match cli.command {
Some(Commands::Daemon) => {}
_ => panic!("expected daemon command"),
}
}
#[test]
fn test_hook_prompt_submit_command_parses() {
let cli = Cli::parse_from(["symforge", "hook", "prompt-submit"]);
match cli.command {
Some(Commands::Hook {
subcommand: Some(HookSubcommand::PromptSubmit),
}) => {}
_ => panic!("expected prompt-submit hook command"),
}
}
#[test]
fn test_hook_pre_tool_command_parses() {
let cli = Cli::parse_from(["symforge", "hook", "pre-tool"]);
match cli.command {
Some(Commands::Hook {
subcommand: Some(HookSubcommand::PreTool),
}) => {}
_ => panic!("expected pre-tool hook command"),
}
}
}