ai_git_commit 0.1.2 → 0.1.4

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: b14c761a09946ac7dccecc9a2b30c3926d4b8607de3cc030faefaf3c39341abf
4
- data.tar.gz: 389310ce83fe9f84928c8fe6cfd25e89cd79f84b73825fadca71f3f39c800ba0
3
+ metadata.gz: 7dd13bd5c9ac0972dcf3b5b6b8892dba49d735e93e1d7cbd2e4e946dc45d0f5b
4
+ data.tar.gz: 73a892b8dc8d54cfb2a119e353011cc6068ae9ecdd5cb2d2934930fde8df5ae3
5
5
  SHA512:
6
- metadata.gz: 6ec4e82fd7e052996c45d1f9066cef2f7d3f0e54c8d8809bd0e89841026acc34e7b622cc6d11315aea333c61976da8a3f6f804634787ce03abeac58717ac6745
7
- data.tar.gz: f24abb2d10dd6453c921d86de3b802de709e77cb01f66a51220db80d8d6c11ba86783cf4e2f1053f9d0e9cf7e4ad359c0615930b1c8e430635db77272d5d6b57
6
+ metadata.gz: a15357618d44474a8641880592abe4b63184a61a4af15cf28129e3b1ccb87eb696d40ec27b59f5bb4f2124116e2a7e165181ddfa0882cb1a19cd2393e4f1a152
7
+ data.tar.gz: a90d9cc112a98bad9748d33779127de745491196e9be0dcc49b1e5412dafc9cce00e5a2c4657c1c0f24cf9d0a6c515b2dd7e40d4e2fc1310b63abe87cc46382f
data/.rubocop.yml CHANGED
@@ -1,7 +1,10 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3.1
2
+ TargetRubyVersion: 3.2
3
+ NewCops: enable
3
4
  Exclude:
4
5
  - 'exe/**/*'
6
+ - 'vendor/**/*'
7
+ - 'bin/*'
5
8
 
6
9
  Style/Documentation:
7
10
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.3] - 2025-09-15
4
+ ### Added
5
+ - SKIP_AI environment variable to skip AI generation for specific commits.
6
+
3
7
  ## [0.1.0] - 2025-09-04
4
8
 
5
9
  - Initial release
data/README.md CHANGED
@@ -33,6 +33,11 @@ git commit
33
33
  ```
34
34
  That's it! Your commit message will be generated by AI.
35
35
 
36
+ If you would like to skip the AI generation for a specific commit, you can use:
37
+ ```bash
38
+ SKIP_AI=true git commit
39
+ ```
40
+
36
41
  ## Contributing
37
42
 
38
43
  Bug reports and pull requests are welcome on GitHub at https://github.com/drkmen/ai_git_commit.
@@ -8,7 +8,7 @@ module AiGitCommit
8
8
 
9
9
  # Initializes configuration with default values
10
10
  def initialize
11
- @openai_api_key = ENV["OPENAI_API_KEY"]
11
+ @openai_api_key = ENV.fetch("OPENAI_API_KEY", nil)
12
12
  @model = "gpt-3.5-turbo"
13
13
  @program_language = "Ruby"
14
14
  @max_tokens = 300
@@ -9,6 +9,7 @@ module AiGitCommit
9
9
  # Generates a commit message using OpenAI based on staged git diff
10
10
  # @return [String] the generated commit message or an error message
11
11
  def commit_message
12
+ return "" if ENV["SKIP_AI"]
12
13
  return "# AI skipped: OPENAI_API_KEY is not set." unless openai_api_key
13
14
 
14
15
  diff = staged_diff
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AiGitCommit
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  AiGitCommit.configure do |config|
4
4
  # OpenAI API key
5
- config.api_key = ENV["OPENAI_API_KEY"]
5
+ config.api_key = ENV.fetch("OPENAI_API_KEY", nil)
6
6
 
7
7
  # Specifies the OpenAI model to use for generating commit messages.
8
8
  config.model = "gpt-3.5-turbo"
@@ -0,0 +1,14 @@
1
+ module AiGitCommit
2
+ class CLI < Thor
3
+ HOOK_PATH: String
4
+
5
+ def install: () -> void
6
+
7
+ private
8
+
9
+ def create_hook: () -> void
10
+ def copy_initializer: () -> void
11
+ def script: () -> ::String
12
+ def hook_file_exists?: () -> bool
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module AiGitCommit
2
+ class Config
3
+ attr_accessor openai_api_key: String
4
+ attr_accessor model: String
5
+ attr_accessor program_language: String
6
+ attr_accessor max_tokens: Integer
7
+ attr_accessor temperature: Float
8
+ attr_accessor system_role_message: String
9
+
10
+ def initialize: () -> void
11
+ end
12
+
13
+ def self.config: () -> Config
14
+ def self.configure: () { (Config) -> void } -> void
15
+ end
@@ -0,0 +1,33 @@
1
+ module AiGitCommit
2
+ class Generator
3
+ self.@openai: OpenAI::Client
4
+ self.@config: Config
5
+
6
+ def self.commit_message: () -> String
7
+
8
+ private
9
+
10
+ def self.fetch_message: (String diff) -> String
11
+ def self.completion_payload: (String diff) -> {
12
+ model: String,
13
+ messages: ::Array[
14
+ {
15
+ role: String,
16
+ content: String
17
+ } | {
18
+ role: String,
19
+ content: String
20
+ }
21
+ ],
22
+ max_tokens: Integer,
23
+ temperature: Float
24
+ }
25
+
26
+ def self.user_role_message: (String diff) -> String
27
+ def self.openai: () -> OpenAI::Client
28
+ def self.config: () -> Config
29
+ def self.openai_api_key: () -> String?
30
+ def self.staged_diff: () -> String
31
+ end
32
+ end
33
+
@@ -1,4 +1,3 @@
1
1
  module AiGitCommit
2
2
  VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai_git_commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Belyaev
@@ -75,6 +75,9 @@ files:
75
75
  - lib/ai_git_commit/version.rb
76
76
  - lib/templates/ai_git_commit.rb
77
77
  - sig/ai_git_commit.rbs
78
+ - sig/ai_git_commit/cli.rbs
79
+ - sig/ai_git_commit/config.rbs
80
+ - sig/ai_git_commit/generator.rbs
78
81
  homepage: https://github.com/drkmen/ai_git_commit
79
82
  licenses:
80
83
  - MIT
@@ -83,6 +86,7 @@ metadata:
83
86
  homepage_uri: https://github.com/drkmen/ai_git_commit
84
87
  source_code_uri: https://github.com/drkmen/ai_git_commit
85
88
  changelog_uri: https://github.com/drkmen/ai_git_commit/blob/main/CHANGELOG.md
89
+ rubygems_mfa_required: 'true'
86
90
  rdoc_options: []
87
91
  require_paths:
88
92
  - lib
@@ -90,14 +94,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
94
  requirements:
91
95
  - - ">="
92
96
  - !ruby/object:Gem::Version
93
- version: 3.1.0
97
+ version: 3.2.0
94
98
  required_rubygems_version: !ruby/object:Gem::Requirement
95
99
  requirements:
96
100
  - - ">="
97
101
  - !ruby/object:Gem::Version
98
102
  version: '0'
99
103
  requirements: []
100
- rubygems_version: 3.6.9
104
+ rubygems_version: 3.7.2
101
105
  specification_version: 4
102
106
  summary: AI Git Commit generates Git commit messages using OpenAI.
103
107
  test_files: []