git-gpt 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -21
- data/git-gpt.gemspec +2 -2
- data/lib/git/gpt/version.rb +1 -1
- data/lib/git/gpt.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 361917c413bdd904805df016c8b3574bc5fe27d5ac69b50e0bbbc6bd2eadfe37
|
4
|
+
data.tar.gz: e993f778f75d42f858dfd614fb758f920d08dbd75ab65e8db852ea6450dd1014
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d09b73de08fa50e61feb3280b2e4178882b1da97bdcdeda0ac7b04b9257d28478b8468c9683b7e73e1af10e8c564e831b8f8d83a7a2e5f0984f505e797c8df98
|
7
|
+
data.tar.gz: 62a5a8e076e111351ff5261d5b31b93e3028894c97a7f35898fa764d7876af75f7833b9bb8bf586332beb84068d7663318c7d3cc022034b977e88eb74b4e1999
|
data/README.md
CHANGED
@@ -1,43 +1,77 @@
|
|
1
1
|
# Git::Gpt
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
git-gpt is a ruby gem that adds an additional git subcommand, git gpt. It assists you in creating commit messages for your git changes. It uses the powerful capabilities of ChatGPT to generate commit messages based on the current git status and git diff. Additionally, you can specify a list of files to narrow down the context for the commit message.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
7
|
+
First, you need to install the gem. You can do this globally or in your specific Ruby environment.
|
10
8
|
|
11
|
-
```
|
12
|
-
gem
|
9
|
+
```sh
|
10
|
+
gem install git-gpt
|
13
11
|
```
|
14
12
|
|
15
|
-
|
13
|
+
Once installed, it will be accessible as a git subcommand.
|
16
14
|
|
17
|
-
|
15
|
+
## Usage
|
18
16
|
|
19
|
-
|
17
|
+
You can invoke the `git gpt` command in your terminal anywhere in your git repository:
|
20
18
|
|
21
|
-
$ gem install git-gpt
|
22
19
|
|
23
|
-
|
20
|
+
```sh
|
21
|
+
git gpt
|
22
|
+
```
|
23
|
+
|
24
|
+
This will return a commit message generated by ChatGPT based on the changes detected by `git status` and `git diff`.
|
24
25
|
|
25
|
-
|
26
|
+
If you wish to narrow down the context to a specific list of files, you can do so by passing them as arguments:
|
26
27
|
|
27
|
-
|
28
|
+
```sh
|
29
|
+
git gpt file1 file2 file3
|
30
|
+
```
|
28
31
|
|
29
|
-
|
32
|
+
In the above example, `file1`, `file2`, and `file3` are placeholders for the file names you want to focus on. This will generate a commit message based on the changes in those files only.
|
30
33
|
|
31
|
-
|
34
|
+
### USAGE NOTE
|
32
35
|
|
33
|
-
|
36
|
+
`git gpt` does not actually commit your code, it simply prints a commit message that you can choose to use or not. If you run it multiple times, you will likely get different results.
|
34
37
|
|
35
|
-
|
38
|
+
By default it asks ChatGPT to create short messages. If you like longer or multiline messages, you can adjust your prompt (see Advanced Configuration below).
|
36
39
|
|
37
|
-
##
|
40
|
+
## Basic Configuration
|
41
|
+
|
42
|
+
Best practice is to set the `OPENAI_API_KEY` environment veriable. Optionally, you can set `OPENAI_ORGANIZATION_ID`.
|
43
|
+
|
44
|
+
## Advanced Configuration
|
38
45
|
|
39
|
-
|
46
|
+
By default `git gpt` uses `gpt-3.5-turbo` with a temperature of `0.7`. You can find the default prompt [here](https://github.com/assaydepot/git-gpt/blob/main/lib/git/gpt.rb#L12-L26). If you'd like to change the default settings, you can add a `.git-gpt-config.yml` file in your git repository. `git-gpt` will look for that file in the current directory, any parent directory (all the way to `/`) and your `HOME` directory. It will look in that order and use the first one it finds. The structure of the YAML file is as follows, all keys are optional.
|
40
47
|
|
41
|
-
|
48
|
+
```yaml
|
49
|
+
model: gpt-4
|
50
|
+
temperature: 0.8
|
51
|
+
openai_api_key: sk-acb1234567890xyz
|
52
|
+
openai_organization_id: org-abc1234567890xyz
|
53
|
+
prompt: >
|
54
|
+
You are a software engineer working on a project. You write diligent and detailed commit messages. You are working on a new feature and you are ready to commit your changes.
|
55
|
+
|
56
|
+
The current git status is:
|
57
|
+
\```
|
58
|
+
$GIT_STATUS
|
59
|
+
\```
|
60
|
+
|
61
|
+
The current git diff is:
|
62
|
+
\```
|
63
|
+
$GIT_DIFF
|
64
|
+
\```
|
65
|
+
|
66
|
+
Please write a commit message for this change. Format the commit message using markdown. You may use bullet points. Please comment specifically on any files with significant changes.
|
67
|
+
```
|
68
|
+
|
69
|
+
See a real example [here](https://github.com/assaydepot/git-gpt/blob/main/.git-gpt-config.yml).
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/your-github-username/git-gpt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
|
74
|
+
|
75
|
+
## License
|
42
76
|
|
43
|
-
|
77
|
+
The gem is available as open source under the terms of the MIT License.
|
data/git-gpt.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Chris Petersen"]
|
9
9
|
spec.email = ["chris@petersen.io"]
|
10
10
|
|
11
|
-
spec.summary = "Use
|
12
|
-
spec.description = "Use
|
11
|
+
spec.summary = "Use ChatGPT to write your commit messages"
|
12
|
+
spec.description = "Use ChatGPT to write your commit messages"
|
13
13
|
spec.homepage = "https://github.com/assaydepot/git-gpt"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = ">= 2.6.0"
|
data/lib/git/gpt/version.rb
CHANGED
data/lib/git/gpt.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-gpt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Petersen
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.0'
|
27
|
-
description: Use
|
27
|
+
description: Use ChatGPT to write your commit messages
|
28
28
|
email:
|
29
29
|
- chris@petersen.io
|
30
30
|
executables:
|
@@ -71,5 +71,5 @@ requirements: []
|
|
71
71
|
rubygems_version: 3.3.7
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
|
-
summary: Use
|
74
|
+
summary: Use ChatGPT to write your commit messages
|
75
75
|
test_files: []
|