Class: RubyLLM::Toolbox::Tools::GitBranch
- Includes:
- GitHelpers
- Defined in:
- lib/ruby_llm/toolbox/tools/git_branch.rb
Overview
SAFE. Lists the branches of the repo at fs_root, with the current branch marked and each branch’s latest commit. Read-only; does not create, switch, or delete branches (git_checkout handles switching/creating).
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
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
#execute(all: false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ruby_llm/toolbox/tools/git_branch.rb', line 22 def execute(all: false) args = ["branch", "--no-color", "-vv"] args << "-a" if all out, err, status = run_git(*args) result = git_result(out, err, status) return result if result.is_a?(Hash) truncate(result.strip.empty? ? "no branches yet (no commits?)" : result) end |