Class: OllamaAgent::Tools::GitLog
- Defined in:
- lib/ollama_agent/tools/git_tools.rb
Overview
Git log — read-only
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#description, #input_schema, #name, #output_schema, #requires_approval, #risk_level
Instance Method Summary collapse
Methods inherited from Base
#initialize, #to_anthropic_schema, #to_ollama_schema, #to_s, tool_description, tool_name, tool_output_schema, tool_requires_approval, tool_risk, tool_schema
Constructor Details
This class inherits a constructor from OllamaAgent::Tools::Base
Instance Method Details
#call(args, context: {}) ⇒ Object
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ollama_agent/tools/git_tools.rb', line 92 def call(args, context: {}) root = context[:root] || Dir.pwd n = [args["n"]&.to_i || 10, 100].min format = args["oneline"] ? "--oneline" : "--pretty=format:%h %s (%an, %ar)" = args["author"] ? "--author=#{Shellwords.shellescape(args["author"])}" : "" path = args["path"] cmd_parts = ["git log", "-n #{n}", format, , "--", path].compact.reject(&:empty?) git_run(cmd_parts.join(" "), cwd: root) end |