Skip to content

Commit 2dded4c

Browse files
authored
v 3.1.0 (#397)
1 parent 1b29f3a commit 2dded4c

33 files changed

+71729
-71660
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ uncaughtExceptions.log
1010
.vscode
1111
src/*.json
1212
.idea
13-
test.ts
13+
test.ts
14+
notes.md

README.md

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<img src=".github/logo-grad.svg" alt="OpenCommit logo"/>
44
<h1 align="center">OpenCommit</h1>
5-
<h4 align="center">Follow the bird <a href="https://twitter.com/_sukharev_"><img src="https://img.shields.io/twitter/follow/_sukharev_?style=flat&label=_sukharev_&logo=twitter&color=0bf&logoColor=fff" align="center"></a>
5+
<h4 align="center">Author <a href="https://twitter.com/_sukharev_"><img src="https://img.shields.io/twitter/follow/_sukharev_?style=flat&label=_sukharev_&logo=twitter&color=0bf&logoColor=fff" align="center"></a>
66
</div>
77
<h2>Auto-generate meaningful commits in a second</h2>
88
<p>Killing lame commits with AI 🤯🔫</p>
@@ -16,7 +16,7 @@
1616
<img src=".github/opencommit-example.png" alt="OpenCommit example"/>
1717
</div>
1818

19-
All the commits in this repo are authored by OpenCommit — look at [the commits](https://github.com/di-sukharev/opencommit/commit/eae7618d575ee8d2e9fff5de56da79d40c4bc5fc) to see how OpenCommit works. Emojis and long commit descriptions are configurable.
19+
All the commits in this repo are authored by OpenCommit — look at [the commits](https://github.com/di-sukharev/opencommit/commit/eae7618d575ee8d2e9fff5de56da79d40c4bc5fc) to see how OpenCommit works. Emojis and long commit descriptions are configurable, basically everything is.
2020

2121
## Setup OpenCommit as a CLI tool
2222

@@ -58,6 +58,8 @@ git add <files...>
5858
oco
5959
```
6060

61+
Running `git add` is optional, `oco` will do it for you.
62+
6163
### Running locally with Ollama
6264

6365
You can also run it with local model through ollama:
@@ -68,20 +70,21 @@ You can also run it with local model through ollama:
6870

6971
```sh
7072
git add <files...>
71-
OCO_AI_PROVIDER='ollama' opencommit
73+
oco config set OCO_AI_PROVIDER='ollama'
7274
```
7375

74-
If you want to use a model other than mistral, you can do so by setting the `OCO_AI_PROVIDER` environment variable as follows:
76+
If you want to use a model other than mistral (default), you can do so by setting the `OCO_AI_PROVIDER` environment variable as follows:
7577

7678
```sh
77-
OCO_AI_PROVIDER='ollama/llama3:8b' opencommit
79+
oco config set OCO_AI_PROVIDER='ollama/llama3:8b'
7880
```
7981

80-
if you have ollama that is set up in docker/ on another machine with GPUs (not locally), you can change the default endpoint url.
82+
If you have ollama that is set up in docker/ on another machine with GPUs (not locally), you can change the default endpoint url.
83+
8184
You can do so by setting the `OCO_OLLAMA_API_URL` environment variable as follows:
8285

8386
```sh
84-
OCO_OLLAMA_API_URL='http://192.168.1.10:11434/api/chat' opencommit
87+
oco config set OCO_OLLAMA_API_URL='http://192.168.1.10:11434/api/chat'
8588
```
8689

8790
where 192.168.1.10 is example of endpoint URL, where you have ollama set up.
@@ -95,6 +98,7 @@ There are multiple optional flags that can be used with the `oco` command:
9598
Link to the GitMoji specification: https://gitmoji.dev/
9699

97100
This flag can only be used if the `OCO_EMOJI` configuration item is set to `true`. This flag allows users to use all emojis in the GitMoji specification, By default, the GitMoji full specification is set to `false`, which only includes 10 emojis (🐛✨📝🚀✅♻️⬆️🔧🌐💡).
101+
98102
This is due to limit the number of tokens sent in each request. However, if you would like to use the full GitMoji specification, you can use the `--fgm` flag.
99103

100104
```
@@ -116,28 +120,32 @@ oco --yes
116120
Create a `.env` file and add OpenCommit config variables there like this:
117121

118122
```env
123+
...
119124
OCO_OPENAI_API_KEY=<your OpenAI API token>
120125
OCO_TOKENS_MAX_INPUT=<max model token limit (default: 4096)>
121126
OCO_TOKENS_MAX_OUTPUT=<max response tokens (default: 500)>
122127
OCO_OPENAI_BASE_PATH=<may be used to set proxy path to OpenAI api>
123128
OCO_DESCRIPTION=<postface a message with ~3 sentences description of the changes>
124129
OCO_EMOJI=<boolean, add GitMoji>
125-
OCO_MODEL=<either 'gpt-4o', 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'>
130+
OCO_MODEL=<either 'gpt-4o', 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview' or any string basically, but it should be a valid model name>
126131
OCO_LANGUAGE=<locale, scroll to the bottom to see options>
127132
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=<message template placeholder, default: '$msg'>
128133
OCO_PROMPT_MODULE=<either conventional-commit or @commitlint, default: conventional-commit>
129134
OCO_ONE_LINE_COMMIT=<one line commit message, default: false>
130-
OCO_AI_PROVIDER=<anthropic, azure, ollama or ollama/model default ollama model: mistral>
135+
OCO_AI_PROVIDER=<openai (default), anthropic, azure, ollama or ollama/model>
136+
...
131137
```
132138

139+
This are not all the config options, but you get the point.
140+
133141
### Global config for all repos
134142

135143
Local config still has more priority than Global config, but you may set `OCO_MODEL` and `OCO_LOCALE` globally and set local configs for `OCO_EMOJI` and `OCO_DESCRIPTION` per repo which is more convenient.
136144

137145
Simply set any of the variables above like this:
138146

139147
```sh
140-
oco config set OCO_MODEL=gpt-4o
148+
oco config set OCO_MODEL=gpt-4o-mini
141149
```
142150

143151
Configure [GitMoji](https://gitmoji.dev/) to preface a message.
@@ -152,20 +160,32 @@ To remove preface emojis:
152160
oco config set OCO_EMOJI=false
153161
```
154162

163+
Other config options are behaving the same.
164+
165+
### Output WHY the changes were done (WIP)
166+
167+
You can set the `OCO_WHY` config to `true` to have OpenCommit output a short description of WHY the changes were done after the commit message. Default is `false`.
168+
169+
To make this perform accurate we must store 'what files do' in some kind of an index or embedding and perform a lookup (kinda RAG) for the accurate git commit message. If you feel like building this comment on this ticket https://github.com/di-sukharev/opencommit/issues/398 and let's go from there together.
170+
171+
```sh
172+
oco config set OCO_WHY=true
173+
```
174+
155175
### Switch to GPT-4 or other models
156176

157-
By default, OpenCommit uses `gpt-4o` model.
177+
By default, OpenCommit uses `gpt-4o-mini` model.
158178

159-
You may switch to GPT-4 which performs better, but costs ~x15 times more 🤠
179+
You may switch to gpt-4o which performs better, but costs more 🤠
160180

161181
```sh
162-
oco config set OCO_MODEL=gpt-4
182+
oco config set OCO_MODEL=gpt-4o
163183
```
164184

165185
or for as a cheaper option:
166186

167187
```sh
168-
oco config set OCO_MODEL=gpt-4o-mini
188+
oco config set OCO_MODEL=gpt-3.5-turbo
169189
```
170190

171191
### Switch to Azure OpenAI
@@ -178,7 +198,7 @@ You could switch to [Azure OpenAI Service](https://learn.microsoft.com/azure/cog
178198
opencommit config set OCO_AI_PROVIDER=azure
179199
```
180200

181-
Of course need to set 'OPENAI_API_KEY'. And also need to set the
201+
Of course need to set 'OCO_OPENAI_API_KEY'. And also need to set the
182202
'OPENAI_BASE_PATH' for the endpoint and set the deployment name to
183203
'model'.
184204

@@ -201,9 +221,9 @@ oco config set OCO_LANGUAGE=française
201221
The default language setting is **English**
202222
All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder
203223

204-
### Push to git
224+
### Push to git (gonna be deprecated)
205225

206-
Pushing to git is on by default but if you would like to turn it off just use:
226+
A prompt to ushing to git is on by default but if you would like to turn it off just use:
207227

208228
```sh
209229
oco config set OCO_GITPUSH=false
@@ -291,7 +311,7 @@ In our codebase, the implementation of this feature can be found in the followin
291311
292312
```javascript
293313
commitMessage = messageTemplate.replace(
294-
config?.OCO_MESSAGE_TEMPLATE_PLACEHOLDER,
314+
config.OCO_MESSAGE_TEMPLATE_PLACEHOLDER,
295315
commitMessage
296316
);
297317
```
@@ -348,7 +368,7 @@ Or follow the process of your IDE Source Control feature, when it calls `git com
348368
349369
OpenCommit is now available as a GitHub Action which automatically improves all new commits messages when you push to remote!
350370
351-
This is great if you want to make sure all of the commits in all of your repository branches are meaningful and not lame like `fix1` or `done2`.
371+
This is great if you want to make sure all commits in all of your repository branches are meaningful and not lame like `fix1` or `done2`.
352372
353373
Create a file `.github/workflows/opencommit.yml` with the contents below:
354374

example.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)