Class: AiGitCommit::Generator
- Inherits:
-
Object
- Object
- AiGitCommit::Generator
- Defined in:
- lib/ai_git_commit/generator.rb
Overview
Generator class responsible for creating AI-generated git commit messages
Class Method Summary collapse
-
.commit_message ⇒ String
Generates a commit message using OpenAI based on staged git diff.
Class Method Details
.commit_message ⇒ String
Generates a commit message using OpenAI based on staged git diff
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ai_git_commit/generator.rb', line 11 def return "" if ENV["SKIP_AI"] return "# AI skipped: OPENAI_API_KEY is not set." unless openai_api_key diff = staged_diff return "# No staged changes found." if diff.strip.empty? (diff) rescue StandardError => e "# Error: #{e.}" end |