Class: RubynCode::Tools::GitStatus

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyn_code/tools/git_status.rb

Constant Summary collapse

TOOL_NAME =
'git_status'
DESCRIPTION =
'Show the current git status — modified, staged, and untracked files.'
PARAMETERS =
{}.freeze
RISK_LEVEL =
:read
REQUIRES_CONFIRMATION =
false

Instance Attribute Summary

Attributes inherited from Base

#project_root

Instance Method Summary collapse

Methods inherited from Base

description, #initialize, parameters, requires_confirmation?, risk_level, #safe_path, summarize, to_schema, tool_name, #truncate

Constructor Details

This class inherits a constructor from RubynCode::Tools::Base

Instance Method Details

#execute(**_params) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rubyn_code/tools/git_status.rb', line 16

def execute(**_params)
  validate_git_repo!

  branch = current_branch
  status_output = git_status

  lines = ["Branch: #{branch}\n"]

  lines << if status_output.strip.empty?
             'Working tree is clean — nothing to commit.'
           else
             status_output
           end

  lines.join("\n")
end