Class: Rubino::Tools::GitTool

Inherits:
Base
  • Object
show all
Defined in:
lib/rubino/tools/git_tool.rb

Overview

Tool for git operations: status, diff, log, branch info.

Instance Attribute Summary

Attributes inherited from Base

#cancel_token, #read_tracker, #stream_chunk

Instance Method Summary collapse

Methods inherited from Base

#cancellation_requested?, #config_key, #emit_chunk, #risky?, #to_tool_definition, workspace_root, workspace_roots

Instance Method Details

#call(arguments) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rubino/tools/git_tool.rb', line 38

def call(arguments)
  command = arguments["command"] || arguments[:command]
  args = arguments["args"] || arguments[:args] || ""

  case command
  when "status"
    execute_git("status", args)
  when "diff"
    execute_git("diff", args)
  when "log"
    execute_git("log --oneline -20", args)
  when "branch"
    execute_git("branch", args)
  when "show"
    execute_git("show", args)
  else
    "Unknown git command: #{command}"
  end
end

#descriptionObject



11
12
13
14
# File 'lib/rubino/tools/git_tool.rb', line 11

def description
  "Execute git commands to inspect repository state. " \
    "Supports status, diff, log, branch, and show operations."
end

#input_schemaObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rubino/tools/git_tool.rb', line 16

def input_schema
  {
    type: "object",
    properties: {
      command: {
        type: "string",
        enum: %w[status diff log branch show],
        description: "The git command to execute"
      },
      args: {
        type: "string",
        description: "Additional arguments for the command"
      }
    },
    required: %w[command]
  }
end

#nameObject



7
8
9
# File 'lib/rubino/tools/git_tool.rb', line 7

def name
  "git"
end

#risk_levelObject



34
35
36
# File 'lib/rubino/tools/git_tool.rb', line 34

def risk_level
  :low # Read-only git operations
end