Commit dd05d3d

mo khan <mo@mokhan.ca>
2026-01-12 20:21:51
refactor: rename bash to exec
1 parent 9aa1db1
Changed files (3)
lib/elelem/toolbox.rb
@@ -9,7 +9,7 @@ module Elelem
       full_path.exist? ? { content: full_path.read } : { error: "File not found: #{path}" }
     end
 
-    BASH_TOOL = Tool.build("bash", "Run shell commands. For git: bash({\"cmd\": \"git\", \"args\": [\"log\", \"--oneline\"]}). Returns stdout/stderr/exit_status.", { cmd: { type: "string" }, args: { type: "array", items: { type: "string" } }, env: { type: "object", additionalProperties: { type: "string" } }, cwd: { type: "string", description: "Working directory (defaults to current)" }, stdin: { type: "string" } }, ["cmd"]) do |args|
+    EXEC_TOOL = Tool.build("exec", "Run shell commands. Returns stdout/stderr/exit_status.", { cmd: { type: "string" }, args: { type: "array", items: { type: "string" } }, env: { type: "object", additionalProperties: { type: "string" } }, cwd: { type: "string", description: "Working directory (defaults to current)" }, stdin: { type: "string" } }, ["cmd"]) do |args|
       Elelem.shell.execute(
         args["cmd"],
         args: args["args"] || [],
@@ -38,10 +38,11 @@ module Elelem
     end
 
     TOOL_ALIASES = {
-      "exec" => "bash",
-      "execute" => "bash",
+      "bash" => "exec",
+      "execute" => "exec",
       "open" => "read",
       "search" => "grep",
+      "sh" => "exec",
     }
 
     attr_reader :tools
@@ -50,7 +51,7 @@ module Elelem
       @tools_by_name = {}
       @tools = { read: [], write: [], execute: [] }
       add_tool(eval_tool(binding), :execute)
-      add_tool(BASH_TOOL, :execute)
+      add_tool(EXEC_TOOL, :execute)
       add_tool(GREP_TOOL, :read)
       add_tool(LIST_TOOL, :read)
       add_tool(PATCH_TOOL, :write)
spec/elelem/toolbox_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe Elelem::Toolbox do
 
       tool_names = tools.map { |t| t.dig(:function, :name) }
       expect(tool_names).to include("grep", "list", "read")
-      expect(tool_names).not_to include("write", "patch", "bash")
+      expect(tool_names).not_to include("write", "patch", "exec")
     end
 
     it "returns write tools for write mode" do
@@ -19,7 +19,7 @@ RSpec.describe Elelem::Toolbox do
 
       tool_names = tools.map { |t| t.dig(:function, :name) }
       expect(tool_names).to include("patch", "write")
-      expect(tool_names).not_to include("grep", "bash")
+      expect(tool_names).not_to include("grep", "exec")
     end
 
     it "returns execute tools for execute mode" do
@@ -27,7 +27,7 @@ RSpec.describe Elelem::Toolbox do
       tools = subject.tools_for(mode)
 
       tool_names = tools.map { |t| t.dig(:function, :name) }
-      expect(tool_names).to include("bash")
+      expect(tool_names).to include("exec")
       expect(tool_names).not_to include("grep", "write")
     end
 
@@ -36,7 +36,7 @@ RSpec.describe Elelem::Toolbox do
       tools = subject.tools_for(mode)
 
       tool_names = tools.map { |t| t.dig(:function, :name) }
-      expect(tool_names).to include("grep", "list", "read", "patch", "write", "bash")
+      expect(tool_names).to include("grep", "list", "read", "patch", "write", "exec")
     end
 
     it "returns combined tools for build mode" do
@@ -45,7 +45,7 @@ RSpec.describe Elelem::Toolbox do
 
       tool_names = tools.map { |t| t.dig(:function, :name) }
       expect(tool_names).to include("grep", "read", "write", "patch")
-      expect(tool_names).not_to include("bash")
+      expect(tool_names).not_to include("exec")
     end
   end
 
README.md
@@ -141,7 +141,7 @@ seven tools, each represented by a JSON schema that the LLM can call.
 
 | Tool      | Purpose                              | Parameters                           |
 | ----      | -------                              | ----------                           |
-| `bash`    | Run shell commands                   | `cmd`, `args`, `env`, `cwd`, `stdin` |
+| `exec`    | Run shell commands                   | `cmd`, `args`, `env`, `cwd`, `stdin` |
 | `eval`    | Dynamically create new tools         | `code`                               |
 | `grep`    | Search Git‑tracked files             | `query`                              |
 | `list`    | List tracked files                   | `path` (optional)                    |