Class: RubyLLM::Toolbox::Tools::GitLog
- Includes:
- GitHelpers
- Defined in:
- lib/ruby_llm/toolbox/tools/git_log.rb
Overview
SAFE. Shows recent commit history for the repo at fs_root. Read-only.
Constant Summary collapse
- DEFAULT_COUNT =
20- MAX_COUNT =
200- FORMAT =
"%h %ad %an: %s"
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(count: DEFAULT_COUNT, path: nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ruby_llm/toolbox/tools/git_log.rb', line 27 def execute(count: DEFAULT_COUNT, path: nil) n = count.to_i n = DEFAULT_COUNT if n <= 0 n = MAX_COUNT if n > MAX_COUNT rel = repo_relative(path) args = ["log", "--max-count=#{n}", "--date=short", "--pretty=format:#{FORMAT}"] args += ["--", rel] if rel out, err, status = run_git(*args) result = git_result(out, err, status) return result if result.is_a?(Hash) truncate(result.strip.empty? ? "no commits" : result) rescue Safety::PathJail::Jailbreak => e error(e., code: :path_denied) end |