opencommit 3.0.20 β†’ 3.1.2

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.
Files changed (3) hide show
  1. package/README.md +39 -19
  2. package/out/cli.cjs +42979 -37830
  3. package/package.json +3 -6
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
  <img src=".github/logo-grad.svg" alt="OpenCommit logo"/>
4
4
  <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>
6
6
  </div>
7
7
  <h2>Auto-generate meaningful commits in a second</h2>
8
8
  <p>Killing lame commits with AI πŸ€―πŸ”«</p>
@@ -16,7 +16,7 @@
16
16
  <img src=".github/opencommit-example.png" alt="OpenCommit example"/>
17
17
  </div>
18
18
 
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.
20
20
 
21
21
  ## Setup OpenCommit as a CLI tool
22
22
 
@@ -58,6 +58,8 @@ git add <files...>
58
58
  oco
59
59
  ```
60
60
 
61
+ Running `git add` is optional, `oco` will do it for you.
62
+
61
63
  ### Running locally with Ollama
62
64
 
63
65
  You can also run it with local model through ollama:
@@ -68,20 +70,21 @@ You can also run it with local model through ollama:
68
70
 
69
71
  ```sh
70
72
  git add <files...>
71
- OCO_AI_PROVIDER='ollama' opencommit
73
+ oco config set OCO_AI_PROVIDER='ollama'
72
74
  ```
73
75
 
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:
75
77
 
76
78
  ```sh
77
- OCO_AI_PROVIDER='ollama/llama3:8b' opencommit
79
+ oco config set OCO_AI_PROVIDER='ollama/llama3:8b'
78
80
  ```
79
81
 
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
+
81
84
  You can do so by setting the `OCO_OLLAMA_API_URL` environment variable as follows:
82
85
 
83
86
  ```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'
85
88
  ```
86
89
 
87
90
  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:
95
98
  Link to the GitMoji specification: https://gitmoji.dev/
96
99
 
97
100
  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
+
98
102
  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.
99
103
 
100
104
  ```
@@ -116,20 +120,24 @@ oco --yes
116
120
  Create a `.env` file and add OpenCommit config variables there like this:
117
121
 
118
122
  ```env
123
+ ...
119
124
  OCO_OPENAI_API_KEY=<your OpenAI API token>
120
125
  OCO_TOKENS_MAX_INPUT=<max model token limit (default: 4096)>
121
126
  OCO_TOKENS_MAX_OUTPUT=<max response tokens (default: 500)>
122
127
  OCO_OPENAI_BASE_PATH=<may be used to set proxy path to OpenAI api>
123
128
  OCO_DESCRIPTION=<postface a message with ~3 sentences description of the changes>
124
129
  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>
126
131
  OCO_LANGUAGE=<locale, scroll to the bottom to see options>
127
132
  OCO_MESSAGE_TEMPLATE_PLACEHOLDER=<message template placeholder, default: '$msg'>
128
133
  OCO_PROMPT_MODULE=<either conventional-commit or @commitlint, default: conventional-commit>
129
134
  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
+ ...
131
137
  ```
132
138
 
139
+ This are not all the config options, but you get the point.
140
+
133
141
  ### Global config for all repos
134
142
 
135
143
  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.
@@ -137,7 +145,7 @@ Local config still has more priority than Global config, but you may set `OCO_MO
137
145
  Simply set any of the variables above like this:
138
146
 
139
147
  ```sh
140
- oco config set OCO_MODEL=gpt-4o
148
+ oco config set OCO_MODEL=gpt-4o-mini
141
149
  ```
142
150
 
143
151
  Configure [GitMoji](https://gitmoji.dev/) to preface a message.
@@ -152,20 +160,32 @@ To remove preface emojis:
152
160
  oco config set OCO_EMOJI=false
153
161
  ```
154
162
 
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
+
155
175
  ### Switch to GPT-4 or other models
156
176
 
157
- By default, OpenCommit uses `gpt-4o` model.
177
+ By default, OpenCommit uses `gpt-4o-mini` model.
158
178
 
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 🀠
160
180
 
161
181
  ```sh
162
- oco config set OCO_MODEL=gpt-4
182
+ oco config set OCO_MODEL=gpt-4o
163
183
  ```
164
184
 
165
185
  or for as a cheaper option:
166
186
 
167
187
  ```sh
168
- oco config set OCO_MODEL=gpt-4o-mini
188
+ oco config set OCO_MODEL=gpt-3.5-turbo
169
189
  ```
170
190
 
171
191
  ### Switch to Azure OpenAI
@@ -178,7 +198,7 @@ You could switch to [Azure OpenAI Service](https://learn.microsoft.com/azure/cog
178
198
  opencommit config set OCO_AI_PROVIDER=azure
179
199
  ```
180
200
 
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
182
202
  'OPENAI_BASE_PATH' for the endpoint and set the deployment name to
183
203
  'model'.
184
204
 
@@ -201,9 +221,9 @@ oco config set OCO_LANGUAGE=franΓ§aise
201
221
  The default language setting is **English**
202
222
  All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder
203
223
 
204
- ### Push to git
224
+ ### Push to git (gonna be deprecated)
205
225
 
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:
207
227
 
208
228
  ```sh
209
229
  oco config set OCO_GITPUSH=false
@@ -291,7 +311,7 @@ In our codebase, the implementation of this feature can be found in the followin
291
311
 
292
312
  ```javascript
293
313
  commitMessage = messageTemplate.replace(
294
- config?.OCO_MESSAGE_TEMPLATE_PLACEHOLDER,
314
+ config.OCO_MESSAGE_TEMPLATE_PLACEHOLDER,
295
315
  commitMessage
296
316
  );
297
317
  ```
@@ -348,7 +368,7 @@ Or follow the process of your IDE Source Control feature, when it calls `git com
348
368
 
349
369
  OpenCommit is now available as a GitHub Action which automatically improves all new commits messages when you push to remote!
350
370
 
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`.
352
372
 
353
373
  Create a file `.github/workflows/opencommit.yml` with the contents below:
354
374