Skip to content

Commit 42a34ca

Browse files
committed
✨ Merge from upstream 'di-sukharev/master'
Upgrade to 2.4.2 from upstream 🐛fix(api.ts, checkIsLatestVersion.ts): fix npm command to get the latest version of opencommit Fixed the npm command to get the latest version of opencommit. Previously, it was using `npm view opencommit version`, but it has been updated to `npm view github:takuya-o/opencommit version` to specify the correct package name. 🐛修正(api.ts, checkIsLatestVersion.ts): opencommitの最新バージョンを取得するためのnpmコマンドを修正しました opencommitの最新バージョンを取得するためのnpmコマンドを修正しました。以前は`npm view opencommit version`を使用していましたが、正しいパッケージ名を指定するために`npm view github:takuya-o/opencommit version`に変更しました。 ⬆️ Update(package.json): Add script to upgrade packages using npm-check-updates and run npm update and npm dedup To make it easier to upgrade packages and manage dependencies, a new script called "upgrade" has been added. This script uses npm-check-updates to upgrade packages to their latest versions, runs npm update to update dependencies, and runs npm dedup to remove duplicate packages. ⬆️ アップデート(package.json): npm-check-updatesを使用してパッケージをアップグレードし、npm updateとnpm dedupを実行するスクリプトを追加しました パッケージのアップグレードと依存関係の整理を簡単にするために、新しいスクリプト"upgrade"を追加しました。このスクリプトは、npm-check-updatesを使用してパッケージを最新バージョンにアップグレードし、npm updateを実行して依存関係を更新し、npm dedupを実行して重複したパッケージを削除します。 Merge branch 'revert-async-prefix' into 'azure' Revert "Merge remote-tracking branch 'amyu98/allowForCommitPrefix' into try-commit-prefix" 非同期化したprefix付加機能を巻き戻した
1 parent 3796ae0 commit 42a34ca

16 files changed

Lines changed: 896 additions & 954 deletions

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Thanks for considering contributing to the project.
99
3. Create a new branch for your changes.
1010
4. Make your changes and commit them with descriptive commit messages.
1111
5. Push your changes to your forked repository.
12-
6. Create a pull request from your branch to the `dev` branch.
12+
6. Create a pull request from your branch to the `dev` branch. Not `master` branch, PR to `dev` branch, please.
1313

1414
## Getting started
1515

.github/github-mark-white.png

4.72 KB
Loading

README.md

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
<img src=".github/logo-grad.svg" alt="OpenCommit logo"/>
44
<h1 align="center">OpenCommit</h1>
55
<h4 align="center">Follow the bird <a href="https://twitter.com/io_Y_oi"><img src="https://img.shields.io/twitter/follow/io_Y_oi?style=flat&label=io_Y_oi&logo=twitter&color=0bf&logoColor=fff" align="center"></a>
6-
</h4>
76
</div>
87
<h2>Auto-generate meaningful commits in 1 second</h2>
98
<p>Killing lame commits with AI 🤯🔫</p>
109
<a href="https://www.npmjs.com/package/opencommit"><img src="https://img.shields.io/npm/v/opencommit" alt="Current version"></a>
10+
<h4 align="center">🪩 Winner of GitHub 2023 HACKATHON <a href="https://twitter.com/io_Y_oi"><img style="width:18px; height:18px;" src=".github/github-mark-white.png" align="center"></a>
11+
</h4>
1112
</div>
1213

1314
---
@@ -16,15 +17,35 @@
1617
<img src=".github/opencommit-example.png" alt="OpenCommit example"/>
1718
</div>
1819

19-
All the commits in this repo are done with OpenCommit — look into [the commits](https://github.com/di-sukharev/opencommit/commit/eae7618d575ee8d2e9fff5de56da79d40c4bc5fc) to see how OpenCommit works. Emoji and long commit description text is configurable.
20+
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.
2021

21-
## Setup OpenCommit as a Github Action 🔥
22+
## Setup OpenCommit as a CLI tool
23+
24+
You can use OpenCommit by simply running it via the CLI like this `oco`. 2 seconds and your staged changes are committed with a meaningful message.
25+
26+
1. Install OpenCommit globally to use in any repository:
27+
28+
```sh
29+
npm install -g opencommit
30+
```
31+
32+
2. Get your API key from [OpenAI](https://platform.openai.com/account/api-keys). Make sure that you add your payment details, so the API works.
33+
34+
3. Set the key to OpenCommit config:
35+
36+
```sh
37+
opencommit config set OCO_OPENAI_API_KEY=<your_api_key>
38+
```
39+
40+
Your API key is stored locally in the `~/.opencommit` config file.
41+
42+
## Setup OpenCommit as a GitHub Action 🔥
2243

2344
OpenCommit is now available as a GitHub Action which automatically improves all new commits messages when you push to remote!
2445

25-
This is great if you want to make sure all of the commits in all of repository branches are meaningful and not lame like `fix1` or `done2`.
46+
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`.
2647

27-
Create a file `.github/workflows/opencommit.yml` with contents below:
48+
Create a file `.github/workflows/opencommit.yml` with the contents below:
2849

2950
```yml
3051
name: 'OpenCommit Action'
@@ -68,31 +89,11 @@ jobs:
6889
OCO_LANGUAGE: en
6990
```
7091
71-
That is it. Now when you push to any branch in your repo — all NEW commits are being improved by never-tired-AI.
92+
That is it. Now when you push to any branch in your repo — all NEW commits are being improved by your never-tired AI.
7293
73-
Make sure you exclude public collaboration branches (`main`, `dev`, `etc`) in `branches-ignore`, so OpenCommit does not rebase commits there when improving the messages.
94+
Make sure you exclude public collaboration branches (`main`, `dev`, `etc`) in `branches-ignore`, so OpenCommit does not rebase commits there while improving the messages.
7495

75-
Interactive rebase (`rebase -i`) changes commit SHA, so commit history in remote becomes different with your local branch history. It's ok when you work on the branch alone, but may be inconvenient for other collaborators.
76-
77-
## Setup OpenCommit as a CLI
78-
79-
You can use OpenCommit by simply running it via CLI like this `oco`. 2 seconds and your staged changes are committed with a meaningful message.
80-
81-
1. Install OpenCommit globally to use in any repository:
82-
83-
```sh
84-
npm install -g opencommit
85-
```
86-
87-
2. Get your API key from [OpenAI](https://platform.openai.com/account/api-keys). Make sure you add payment details, so API works.
88-
89-
3. Set the key to OpenCommit config:
90-
91-
```sh
92-
opencommit config set OCO_OPENAI_API_KEY=<your_api_key>
93-
```
94-
95-
Your api key is stored locally in `~/.opencommit` config file.
96+
Interactive rebase (`rebase -i`) changes commits' SHA, so the commit history in remote becomes different from your local branch history. This is okay if you work on the branch alone, but may be inconvenient for other collaborators.
9697

9798
## Usage
9899

@@ -107,30 +108,31 @@ You can also use the `oco` shortcut:
107108

108109
```sh
109110
git add <files...>
110-
oc
111+
oco
111112
```
112113

113114
## Configuration
114115

115116
### Local per repo configuration
116117

117-
Create an `.env` file and add OpenCommit config variables there like this:
118+
Create a `.env` file and add OpenCommit config variables there like this:
118119

119120
```env
120-
OCO_OPENAI_API_KEY=<your openAI API token>
121-
OCO_OPENAI_MAX_TOKENS=<max response tokens from openAI API>
122-
OCO_OPENAI_BASE_PATH=<may be used to set proxy path to openAI api>
121+
OCO_OPENAI_API_KEY=<your OpenAI API token>
122+
OCO_OPENAI_MAX_TOKENS=<max response tokens from OpenAI API>
123+
OCO_OPENAI_BASE_PATH=<may be used to set proxy path to OpenAI api>
123124
OCO_DESCRIPTION=<postface a message with ~3 sentences description>
124125
OCO_EMOJI=<add GitMoji>
125126
OCO_MODEL=<either gpt-3.5-turbo or gpt-4>
126127
OCO_LANGUAGE=<locale, scroll to the bottom to see options>
128+
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=<message template placeholder, example: '$msg'>
127129
```
128130

129131
### Global config for all repos
130132

131-
Local config still has more priority as 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.
133+
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.
132134

133-
Simply run any of the variable above like this:
135+
Simply set any of the variables above like this:
134136

135137
```sh
136138
oco config set OCO_OPENAI_API_KEY=gpt-4
@@ -142,7 +144,7 @@ Configure [GitMoji](https://gitmoji.dev/) to preface a message.
142144
oco config set OCO_EMOJI=true
143145
```
144146

145-
To remove preface emoji:
147+
To remove preface emojis:
146148

147149
```sh
148150
oco config set OCO_EMOJI=false
@@ -162,17 +164,23 @@ Of course need to set 'OCO_OPENAI_API_KEY'. And also need to set the
162164
'OCO_OPENAI_BASE_PATH' for the endpoint and set the deployment name to
163165
'model'.
164166

165-
### Switch to GPT-4
167+
### Switch to GPT-4 or other models
166168

167-
By default OpenCommit uses GPT-3.5-turbo (ChatGPT).
169+
By default, OpenCommit uses `gpt-3.5-turbo-16k` model.
168170

169171
You may switch to GPT-4 which performs better, but costs ~x15 times more 🤠
170172

171173
```sh
172174
oco config set OCO_MODEL=gpt-4
173175
```
174176

175-
Make sure you do lowercase `gpt-4` and you have API access to the 4th model. Even if you have ChatGPT+ it doesn't necessarily mean that you have API access to GPT-4.
177+
or for as a cheaper option:
178+
179+
```sh
180+
oco config set OCO_MODEL=gpt-3.5-turbo
181+
```
182+
183+
Make sure that you spell it `gpt-4` (lowercase) and that you have API access to the 4th model. Even if you have ChatGPT+, that doesn't necessarily mean that you have API access to GPT-4.
176184

177185
## Locale configuration
178186

@@ -190,7 +198,7 @@ oco config set OCO_LANGUAGE=French
190198
oco config set OCO_LANGUAGE=française
191199
```
192200

193-
The default language set is **English**
201+
The default language setting is **English**
194202
All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder
195203

196204
### Push to git
@@ -214,22 +222,30 @@ is translated to :
214222
git commit -m "${generatedMessage}" --no-verify
215223
```
216224

225+
To include a message in the generated message, you can utilize the template function! For instance:
226+
227+
```sh
228+
oco '$msg #205’
229+
```
230+
231+
> opencommit examines placeholders in the parameters, allowing you to append additional information before and after the placeholders, such as the relevant Issue or Pull Request. Similarly, you have the option to customize the OCO_MESSAGE_TEMPLATE_PLACEHOLDER configuration item, for example, simplifying it to $m!"
232+
217233
### Ignore files
218234

219-
You can ignore files from submission to OpenAI by creating a `.opencommitignore` file. For example:
235+
You can remove files from being sent to OpenAI by creating a `.opencommitignore` file. For example:
220236

221237
```ignorelang
222238
path/to/large-asset.zip
223239
**/*.jpg
224240
```
225241

226-
This is useful for preventing opencommit from uploading artifacts and large files.
242+
This helps prevent opencommit from uploading artifacts and large files.
227243

228244
By default, opencommit ignores files matching: `*-lock.*` and `*.lock`
229245

230246
## Git hook (KILLER FEATURE)
231247

232-
You can set OpenCommit as Git [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. Hook integrates with you IDE Source Control and allows you edit the message before commit.
248+
You can set OpenCommit as Git [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. Hook integrates with your IDE Source Control and allows you to edit the message before committing.
233249

234250
To set the hook:
235251

@@ -254,4 +270,4 @@ Or follow the process of your IDE Source Control feature, when it calls `git com
254270

255271
## Payments
256272

257-
You pay for your own requests to OpenAI API. OpenCommit uses ChatGPT (3.5-turbo) official model, that is ~15x times cheaper than GPT-4.
273+
You pay for your requests to OpenAI API. OpenCommit uses ChatGPT (3.5-turbo) official model, which is ~15x times cheaper than GPT-4.

0 commit comments

Comments
 (0)