class Jeeves::CLI

def run

def run
  parse_options
  
  if @options[:all]
    system('git add -A')
  end
  # Get git diff of staged changes
  diff = `git diff --staged`
  
  if diff.empty?
    puts "No changes staged for commit."
    exit 1
  end
  # Get AI-generated commit message
  commit_message = generate_commit_message(diff)
  
  # Write commit message to temp file for git to use
  temp_file = File.join(Dir.tmpdir, 'jeeves_commit_message')
  File.write(temp_file, commit_message)
  
  # Commit with the generated message
  system("git commit -F #{temp_file}")
  
  # Clean up temp file
  File.unlink(temp_file) if File.exist?(temp_file)
  
  # Push if requested
  if @options[:push]
    puts "Pushing changes..."
    system('git push')
  end
end