From 7c035acc6e282cdbaa3b0060a528660fa0dba0d4 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 22 Nov 2026 18:58:26 +0100 Subject: 0.12.1: accept `command` as an alias for `cmd` in bash A field report showed ~40% of bash calls died on a one-word slip (command vs cmd); the alias removes the failure class instead of improving the error for it. --- src/tools/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/tools/mod.rs') diff --git a/src/tools/mod.rs b/src/tools/mod.rs index 7c6a921..5d6189f 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -75,7 +75,11 @@ pub fn validate(name: &str, args: &Value) -> Result<(), String> { }; match name { - "bash" => required_text("cmd"), + "bash" => match args.get("cmd").or_else(|| args.get("command")) { + Some(value) if !value.as_str().unwrap_or("").trim().is_empty() => Ok(()), + Some(_) => Err("`cmd` is present but empty".into()), + None => Err(missing("cmd")), + }, "read" => required_text("path"), "write" => { required_text("path")?; @@ -177,11 +181,11 @@ pub fn schemas() -> Vec { "type": "function", "function": { "name": "bash", - "description": "Run a shell command. Each call is a fresh shell at the working directory, so `cd` does not persist; pass cwd instead. stdout and stderr are reported in separate labelled sections when both produce output. Times out after timeout_seconds (default 120, maximum 600). Large output is truncated head+tail with an explicit marker; raise max_bytes if the match you need is in the middle.", + "description": "Run a shell command. The command string is the `cmd` parameter (not `command`). Each call is a fresh shell at the working directory, so `cd` does not persist; pass cwd instead. stdout and stderr are reported in separate labelled sections when both produce output. Times out after timeout_seconds (default 120, maximum 600). Large output is truncated head+tail with an explicit marker; raise max_bytes if the match you need is in the middle.", "parameters": { "type": "object", "properties": { - "cmd": { "type": "string" }, + "cmd": { "type": "string", "description": "the shell command to run" }, "cwd": { "type": "string", "description": "working directory (default: project root)" }, "timeout_seconds": { "type": "integer", "description": "1-600, default 120" }, "max_bytes": { "type": "integer", "description": "per-stream output budget, 1024-16777216, default 81920" } -- cgit v1.2.3