Class: RubynCode::Tools::GitCommit

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

Constant Summary collapse

TOOL_NAME =
'git_commit'
DESCRIPTION =
"Stage files and create a git commit. Specify files to stage or use 'all' to stage everything."
PARAMETERS =
{
  message: { type: :string, required: true, description: 'The commit message' },
  files: { type: :string, required: false, default: 'all',
           description: "Space-separated file paths to stage, or 'all' to stage everything (git add -A)" }
}.freeze
RISK_LEVEL =
:write
REQUIRES_CONFIRMATION =
true

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(message:, files: 'all') ⇒ Object



20
21
22
23
24
25
26
# File 'lib/rubyn_code/tools/git_commit.rb', line 20

def execute(message:, files: 'all')
  validate_git_repo!
  validate_message!(message)

  stage_files(files)
  create_commit(message)
end