Class: RubyLLM::Toolbox::Tools::GitStatus

Inherits:
Base
  • Object
show all
Includes:
GitHelpers
Defined in:
lib/ruby_llm/toolbox/tools/git_status.rb

Overview

SAFE. Shows the working-tree status of the repo at fs_root (branch plus staged/unstaged/untracked changes). Read-only; requires git on the host.

Constant Summary

Constants included from GitHelpers

RubyLLM::Toolbox::Tools::GitHelpers::GIT_ENV, RubyLLM::Toolbox::Tools::GitHelpers::REF_RE

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods included from GitHelpers

#git_result, #repo_relative, #run_git, #valid_ref?

Methods inherited from Base

#call, exec_tool!, exec_tool?, #initialize, #name

Constructor Details

This class inherits a constructor from RubyLLM::Toolbox::Base

Instance Method Details

#executeObject



17
18
19
20
21
22
23
# File 'lib/ruby_llm/toolbox/tools/git_status.rb', line 17

def execute
  out, err, status = run_git("status", "--short", "--branch")
  result = git_result(out, err, status)
  return result if result.is_a?(Hash)

  truncate(result.strip.empty? ? "working tree clean" : result)
end