Class: Girb::Tools::RunDebugCommand

Inherits:
Base
  • Object
show all
Defined in:
lib/girb/tools/run_debug_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

to_gemini_tool, tool_name

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/girb/tools/run_debug_command.rb', line 34

def available?
  defined?(DEBUGGER__)
end

.descriptionObject



9
10
11
12
# File 'lib/girb/tools/run_debug_command.rb', line 9

def description
  "Execute a debugger command. Use this tool whenever the user asks to step, continue, set breakpoints, or perform any debugger action. " \
  "For conditional breakpoints, use 'if:' (with colon): e.g., 'break sample.rb:14 if: x == 1'."
end

.parametersObject



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

def parameters
  {
    type: "object",
    properties: {
      command: {
        type: "string",
        description: "The debugger command to execute. Examples: 'n', 's', 'c', 'finish', 'up', 'down', " \
                     "'break sample.rb:14', 'break sample.rb:14 if: x == 1', 'info locals', 'bt'"
      },
      auto_continue: {
        type: "boolean",
        description: "Set to true if you want to be re-invoked after the command executes " \
                     "to see the new state. Use this when you need to check variables or " \
                     "decide the next action after stepping/continuing."
      }
    },
    required: ["command"]
  }
end

Instance Method Details

#execute(binding, command:, auto_continue: false) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/girb/tools/run_debug_command.rb', line 39

def execute(binding, command:, auto_continue: false)
  Girb::DebugIntegration.add_pending_debug_command(command)
  Girb::DebugIntegration.auto_continue = true if auto_continue
  { success: true, command: command, auto_continue: auto_continue,
    message: auto_continue ?
      "Command '#{command}' will be executed. You will be re-invoked with updated context." :
      "Command '#{command}' will be executed after this response." }
end