jeeves-git-commit 1.8.0 → 2.0.0

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: e70cd86c876f117a7dde5f8c20cf1b17d88acd395de3d3319a2024bce4bddb4d
4
- data.tar.gz: b70b5f9046ca8c63c3fb2fe879ba03d632589ad0ecc51a786e2ba257d255468c
3
+ metadata.gz: 0a1a7767238f6e2e9c145da2abeca84fd27034afdf9b54c7a69d714e9107e3c1
4
+ data.tar.gz: 61798a06d9d3e026d3bc9abc7cc2313bfeb56343f92e00823f30ff9643132bf0
5
5
  SHA512:
6
- metadata.gz: 723a61992be83e6ae6e98c8deb59d538a4a693782ba78b50e64eec882e8fc814e87a2f16876cc11e88d31a359fc89e27bd4411145132fcc2d12bef1b3db464cd
7
- data.tar.gz: 3d6cfb8fc295801847b020947002c7a411e589e896123d121d8f073305be4576007a16ad6eaae0c2deb675069768c8fb5c72d39547e1b043b997af64950e987c
6
+ metadata.gz: 4d738930e7924e1f3cfc7281c8d84009b6823b15080c9a3493fb1cbecff47b6727da3b3bdb4046f488d12c123f34e147647d8facaf24e0f825decad0aa5cc12c
7
+ data.tar.gz: 728cd8648020b71b3f97a9d9635760173831fc1a78cdd983973702f9b67a759e49f951c6bc11699ffb0d75bf8c6573934e1457926e1d3a91614da5cea9f81226
data/README.md CHANGED
@@ -8,10 +8,11 @@ Jeeves is a command-line tool that helps you create AI-powered Git commit messag
8
8
 
9
9
  ## Features
10
10
 
11
- - Generate intelligent commit messages based on your staged changes
11
+ - Generate intelligent [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) messages with [gitmoji](https://gitmoji.dev) based on your staged changes.
12
12
  - Option to automatically stage all changes before committing
13
13
  - Option to push changes after committing
14
14
  - Customizable AI prompts for tailored commit message generation
15
+ - Choose any AI model (chat-gpt 4.1-mini by default)
15
16
 
16
17
  ## Installation
17
18
 
@@ -108,9 +109,22 @@ The default model is `openai/gpt-4.1-mini` if not specified.
108
109
 
109
110
  ### Prompt Configuration
110
111
 
111
- Jeeves stores its configuration in `~/.config/jeeves/`. You can customize the AI prompt by editing the `prompt` file in this directory.
112
+ Jeeves supports two levels of prompt configuration with the following priority order:
112
113
 
113
- When you run Jeeves for the first time, if there's no prompt file in the config directory, it will copy `config/prompt` to the config directory automatically.
114
+ 1. **Repository-Specific Prompt (Highest Priority)**: Create a `.jeeves_prompt` file in the root of your Git repository to customize the prompt for that specific project.
115
+ 2. **Global Prompt (Fallback)**: Stored in `~/.config/jeeves/prompt`. This is used when no repository-specific prompt is found.
116
+
117
+ When you run Jeeves, it will:
118
+ 1. **First** look for a `.jeeves_prompt` file in the root of the current Git repository
119
+ 2. **If not found**, fall back to the global prompt at `~/.config/jeeves/prompt`
120
+
121
+ This allows you to have a default prompt for all your projects while still being able to customize the prompt for specific repositories that may have different requirements or coding standards.
122
+
123
+ **Example Repository-Specific Prompt**: See `example.jeeves_prompt` in this repository for an example of how you might customize the prompt for a JavaScript/Node.js project with specific requirements.
124
+
125
+ When you run Jeeves for the first time, if there's no global prompt file in the config directory, it will copy `config/prompt` to the config directory automatically.
126
+
127
+ The special string: `{{DIFF}}`, in your prompt will be replaced with the current git diff.
114
128
 
115
129
  ## Usage
116
130
 
@@ -146,6 +160,30 @@ MIT
146
160
 
147
161
  ## Development
148
162
 
163
+ ### Project Structure
164
+
165
+ Jeeves follows a specific project structure where all gemspec files and built gem files (.gem) are placed in the `gemspec/` folder rather than the root directory. This keeps the root directory clean and organized.
166
+
167
+ ### Rake Tasks
168
+
169
+ Jeeves provides several rake tasks to streamline development:
170
+
171
+ ```bash
172
+ # Run the test suite
173
+ rake test
174
+
175
+ # Build the gem and place it in the gemspec/ folder
176
+ rake build
177
+
178
+ # Build, install and test the gem
179
+ rake install
180
+
181
+ # Build and push the gem to RubyGems
182
+ rake push
183
+ ```
184
+
185
+ The default task is `rake test`.
186
+
149
187
  ### Testing
150
188
 
151
189
  Jeeves uses Minitest for testing. To run the tests:
data/config/prompt CHANGED
@@ -4,6 +4,7 @@ The commit message should:
4
4
  - Start with an appropriate gitmoji based on the nature of the changes
5
5
  - Follow the Conventional Commits format (https://www.conventionalcommits.org/en/v1.0.0/)
6
6
  - Explain WHAT changed, WHY it changed, and HOW it improves or fixes the current state
7
+ - Use present tense ("add" not "added")
7
8
  - Assume the audience is educated software engineers
8
9
 
9
10
  Example format:
@@ -14,4 +15,4 @@ Detailed explanation of the changes, why they were necessary, and their impact.
14
15
  Additional context or technical details when relevant.
15
16
 
16
17
  DIFF:
17
- {{DIFF}}
18
+ {{DIFF}}
@@ -1,3 +1,3 @@
1
1
  module Jeeves
2
- VERSION = '1.8.0'
2
+ VERSION = '2.0.0'
3
3
  end
data/lib/jeeves.rb CHANGED
@@ -77,6 +77,20 @@ module Jeeves
77
77
 
78
78
  private
79
79
 
80
+ def git_root_dir
81
+ output = `git rev-parse --show-toplevel 2>/dev/null`.strip
82
+ output.empty? ? nil : output
83
+ end
84
+
85
+ def get_prompt_file_path
86
+ git_root = git_root_dir
87
+ if git_root
88
+ local_prompt = File.join(git_root, '.jeeves_prompt')
89
+ return local_prompt if File.exist?(local_prompt)
90
+ end
91
+ PROMPT_FILE
92
+ end
93
+
80
94
  def setup_config_dir
81
95
  unless Dir.exist?(CONFIG_DIR)
82
96
  FileUtils.mkdir_p(CONFIG_DIR)
@@ -108,7 +122,7 @@ module Jeeves
108
122
 
109
123
  model = ENV['GIT_COMMIT_MODEL'] || 'openai/gpt-4.1-mini'
110
124
 
111
- prompt = File.read(PROMPT_FILE).gsub('{{DIFF}}', diff)
125
+ prompt = File.read(get_prompt_file_path).gsub('{{DIFF}}', diff)
112
126
 
113
127
  uri = URI.parse('https://openrouter.ai/api/v1/chat/completions')
114
128
  http = Net::HTTP.new(uri.host, uri.port)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeeves-git-commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Bishop
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-20 00:00:00.000000000 Z
10
+ date: 2025-05-30 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: json
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '3.0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: mocha
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.0'
68
82
  description: Jeeves is a command-line tool that helps you create AI-powered Git commit
69
83
  messages
70
84
  email: