mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Signed-off-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <wpfleger@block.xyz> Signed-off-by: Will Pfleger <wpfleger@squareup.com> Signed-off-by: Will Pfleger <wpfleger96@gmail.com> Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub16v54tttfqacx9ycvc3k0ut0npj564ahcuajzy6qjvh57ntmsf4uq4806j2 <d32955ad69077062930cc46cfe2df30ca9aaf6f8e76422681265e9e9af704d78@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Will Pfleger <wpfleger96@gmail.com>
54 lines
1.9 KiB
Rust
54 lines
1.9 KiB
Rust
fn main() {
|
|
if let Err(e) = dispatch() {
|
|
eprintln!("{e}");
|
|
std::process::exit(1);
|
|
}
|
|
}
|
|
|
|
fn dispatch() -> Result<(), String> {
|
|
let argv0 = std::env::args().next().unwrap_or_default();
|
|
let cmd = std::path::Path::new(&argv0)
|
|
.file_name()
|
|
.and_then(|n| n.to_str())
|
|
.unwrap_or("")
|
|
.to_ascii_lowercase();
|
|
|
|
match cmd.as_str() {
|
|
"buzz-acp" => buzz_acp::run().map_err(|e| e.to_string()),
|
|
"buzz-agent" => buzz_agent::run().map_err(|e| e.to_string()),
|
|
"sprig" => match std::env::args().nth(1).as_deref() {
|
|
Some("-V") | Some("--version") => {
|
|
println!("sprig {}", env!("CARGO_PKG_VERSION"));
|
|
Ok(())
|
|
}
|
|
Some("-h") | Some("--help") | None => {
|
|
print_usage();
|
|
if std::env::args().len() <= 1 {
|
|
Err("error: invoke Sprig via a personality symlink".into())
|
|
} else {
|
|
Ok(())
|
|
}
|
|
}
|
|
Some(other) => {
|
|
print_usage();
|
|
Err(format!(
|
|
"error: unknown Sprig option or personality: {other}"
|
|
))
|
|
}
|
|
},
|
|
// buzz-dev-mcp also handles its own multicall names: rg, tree,
|
|
// buzz, git-credential-nostr, and git-sign-nostr.
|
|
_ => buzz_dev_mcp::run().map_err(|e| e.to_string()),
|
|
}
|
|
}
|
|
|
|
fn print_usage() {
|
|
println!(
|
|
"Sprig — all-in-one Buzz ACP harness, agent, and developer MCP\n\n\
|
|
Sprig is a multicall binary. Invoke it through one of the personality names:\n\n\
|
|
buzz-acp ACP harness\n buzz-agent ACP-compliant agent\n buzz-dev-mcp Developer MCP server\n\n\
|
|
Developer MCP helper names are also supported: rg, tree, buzz, git-credential-nostr, git-sign-nostr.\n\n\
|
|
Installers can create links with:\n ln -s sprig buzz-acp\n ln -s sprig buzz-agent\n ln -s sprig buzz-dev-mcp"
|
|
);
|
|
}
|