git_auto 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ab4962fee719c30fca3c7b4577154fed588495e61b6d95e91bb66ae15f5504e
4
- data.tar.gz: 837bac312ba13254250e8b149c97e823557e4099cf7459e40dc993db86468caf
3
+ metadata.gz: 22c8ad3c04eb8a867d883b2691754ad36929589071ecad9c2fb7e064405ccc3b
4
+ data.tar.gz: 820042feceec36279aa4a1de8fb396d9c30d58257ded1ba0976b8d1c843ce2d6
5
5
  SHA512:
6
- metadata.gz: 2f1aacf6b7c6635baf6f6bbeafabc980f39b6797201bb9eab4602d1845e52b14d7e0afd957047f305260c695830cffb51b92011d445705daea1712d6b62cc732
7
- data.tar.gz: 85948f7190233c795197c49f833c249c55fe6e7f381c601deecc494a9aa1b16c56dfd02cbc268830749196a9a58ba24f69b1eff7adfa692b9d83df76270aecfc
6
+ metadata.gz: 3cc3d42b26dad5d0425201c8e9dfd674fe4ffef4fd89ba26671a2d0bbfb4c2f053ae31a92afdd8279015c3688f9c62c0fb846ad2a8464737b8c5fa6f4f0dd38d
7
+ data.tar.gz: 853b80adf98ed8b3be60f2bf6a84f4c861d564c01bd67981adec30091cfd85136a8f3ab7b3479a0159c5aec797016ea37eef20f872446f163e5256423a454417
data/CHANGELOG.md CHANGED
@@ -1,16 +1,33 @@
1
- ## [0.2.0] - 2024-12-15
1
+ # Changelog
2
2
 
3
- ### Added
4
- - New "Minimal" commit message style option for more concise commits
5
- - Display of AI model used in commit message generation for better transparency
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.1] - 2024-03-21
6
9
 
7
10
  ### Fixed
8
- - Improved Git staged changes detection for more reliable operation
9
- - Improved commit message validation for both minimal and conventional formats
11
+ - Fixed error when displaying repository status with no staged files
12
+ - Improved error handling in repository status display
13
+ - Simplified status output when no changes are staged
14
+
15
+ ## [0.2.0] - 2024-03-20
16
+
17
+ ### Added
18
+ - Support for multiple AI providers (OpenAI and Anthropic)
19
+ - New commit message styles (minimal, conventional, simple)
20
+ - Commit history analysis
21
+ - Pattern detection for commit types and scopes
22
+ - Secure API key storage with encryption
10
23
 
11
24
  ### Changed
12
- - Updated AI service integration to support minimal commit style across OpenAI and Claude
13
- - Improved error handling and user feedback during Git operations
25
+ - Improved error messages and validation
26
+ - Enhanced diff formatting and preview
27
+ - Better handling of commit message generation
28
+
29
+ ### Fixed
30
+ - Various bug fixes and performance improvements
14
31
 
15
32
  ## [0.1.1] - 2024-12-13
16
33
 
@@ -51,8 +51,7 @@ module GitAuto
51
51
  return if status[:has_staged_changes]
52
52
 
53
53
  puts "ℹ️ Status:".blue
54
- puts " Branch: #{status[:branch]}"
55
- puts " Staged files: #{status[:staged_files].join(", ")}"
54
+ puts " No changes staged for commit"
56
55
  puts "\n❌ No changes staged for commit. Use 'git add' to stage changes.".red
57
56
  exit 1
58
57
  end
@@ -156,19 +156,19 @@ module GitAuto
156
156
  "Simple (description only)" => "simple"
157
157
  })
158
158
 
159
- @settings.set(:commit_style, style)
159
+ @settings.save(commit_style: style)
160
160
  puts "✓ Commit style updated to #{style}".green
161
161
  end
162
162
 
163
163
  def configure_preferences
164
164
  show_diff = @prompt.yes?("Show diff before committing?")
165
- @settings.set(:show_diff, show_diff)
165
+ @settings.save(show_diff: show_diff)
166
166
  puts "✓ Show diff preference updated".green
167
167
  end
168
168
 
169
169
  def configure_history_settings
170
170
  save_history = @prompt.yes?("Save commit history for analysis?")
171
- @settings.set(:save_history, save_history)
171
+ @settings.save(save_history: save_history)
172
172
  puts "✓ History settings updated".green
173
173
  end
174
174
  end
@@ -216,16 +216,17 @@ module GitAuto
216
216
  "6. Be descriptive but concise\n" \
217
217
  "7. Do not include a period at the end"
218
218
  when "conventional"
219
- "You are a commit message generator that MUST follow the conventional commit format: <type>(<scope>): <description>\n" \
220
- "Valid types are: #{commit_types}\n" \
221
- "Rules:\n" \
222
- "1. ALWAYS start with a type from the list above\n" \
223
- "2. ALWAYS use the exact format <type>(<scope>): <description>\n" \
224
- "3. Keep the message under 72 characters\n" \
225
- "4. Use lowercase\n" \
226
- "5. Use present tense\n" \
227
- "6. Be descriptive but concise\n" \
228
- "7. Do not include a period at the end"
219
+ "You are a commit message generator that MUST follow these rules EXACTLY:\n" \
220
+ "1. ONLY output a single line containing the commit message\n" \
221
+ "2. Use format: <type>(<scope>): <description>\n" \
222
+ "3. Valid types are: #{commit_types}\n" \
223
+ "4. Keep under 72 characters\n" \
224
+ "5. Use lowercase\n" \
225
+ "6. Use present tense\n" \
226
+ "7. Be descriptive but concise\n" \
227
+ "8. No period at the end\n" \
228
+ "9. NO explanations or additional text\n" \
229
+ "10. NO markdown formatting"
229
230
  else
230
231
  "You are an expert in writing clear and concise git commit messages..."
231
232
  end
@@ -277,16 +278,17 @@ module GitAuto
277
278
  "6. Be descriptive but concise\n" \
278
279
  "7. Do not include a period at the end"
279
280
  when "conventional"
280
- "You are a commit message generator that MUST follow the conventional commit format: <type>(<scope>): <description>\n" \
281
- "Valid types are: #{commit_types}\n" \
282
- "Rules:\n" \
283
- "1. ALWAYS start with a type from the list above\n" \
284
- "2. ALWAYS use the exact format <type>(<scope>): <description>\n" \
285
- "3. Keep the message under 72 characters\n" \
286
- "4. Use lowercase\n" \
287
- "5. Use present tense\n" \
288
- "6. Be descriptive but concise\n" \
289
- "7. Do not include a period at the end"
281
+ "You are a commit message generator that MUST follow these rules EXACTLY:\n" \
282
+ "1. ONLY output a single line containing the commit message\n" \
283
+ "2. Use format: <type>(<scope>): <description>\n" \
284
+ "3. Valid types are: #{commit_types}\n" \
285
+ "4. Keep under 72 characters\n" \
286
+ "5. Use lowercase\n" \
287
+ "6. Use present tense\n" \
288
+ "7. Be descriptive but concise\n" \
289
+ "8. No period at the end\n" \
290
+ "9. NO explanations or additional text\n" \
291
+ "10. NO markdown formatting"
290
292
  else
291
293
  "You are an expert in writing clear and concise git commit messages..."
292
294
  end
@@ -353,33 +355,38 @@ module GitAuto
353
355
  case response.code
354
356
  when 200
355
357
  json = JSON.parse(response.body.to_s)
356
- # puts "Debug - API Response: #{json.inspect}"
358
+ puts "\nDebug - API Response: #{json.inspect}"
359
+
357
360
  case @settings.get(:ai_provider)
358
361
  when "openai"
359
362
  message = json.dig("choices", 0, "message", "content")
360
363
  if message.nil? || message.empty?
361
- # puts "Debug - No content in response: #{json}"
364
+ puts "Debug - No content in response: #{json}"
362
365
  raise Error, "No message content in response"
363
366
  end
364
367
 
368
+ puts "Debug - OpenAI message: #{message}"
365
369
  message.split("\n").first.strip
370
+
366
371
  when "claude"
367
372
  content = json.dig("content", 0, "text")
368
- # puts "Debug - Claude content: #{content.inspect}"
373
+ puts "Debug - Claude content: #{content.inspect}"
369
374
 
370
375
  if content.nil? || content.empty?
371
- # puts "Debug - No content in response: #{json}"
376
+ puts "Debug - No content in response: #{json}"
372
377
  raise Error, "No message content in response"
373
378
  end
374
379
 
375
- lines = content.split("\n").map(&:strip).reject(&:empty?)
376
- # puts "Debug - Lines: #{lines.inspect}"
380
+ # Extract the first actual commit message from the response
381
+ commit_message = content.scan(/(?:feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(?:\([^)]+\))?:.*/)&.first
377
382
 
378
- message = lines.first
379
-
380
- raise Error, "No valid commit message found in response" if message.nil? || !message.match?(/^[a-z]+:/)
383
+ if commit_message.nil?
384
+ puts "Debug - No valid commit message pattern found in content"
385
+ raise Error, "No valid commit message found in response"
386
+ end
381
387
 
382
- message
388
+ puts "Debug - Extracted commit message: #{commit_message}"
389
+ commit_message.strip
383
390
  end
384
391
  when 401
385
392
  raise APIKeyError, "Invalid API key" unless ENV["RACK_ENV"] == "test"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitAuto
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_auto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillermo Diaz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
11
+ date: 2024-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor