opencommit 1.0.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.
- package/LICENSE +15 -0
- package/README.md +113 -0
- package/out/cli.cjs +17603 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Dima Sukharev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
6
|
+
copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included
|
|
9
|
+
in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
12
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
14
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
15
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<div>
|
|
3
|
+
<img src=".github/logo-grad.svg" alt="OpenCommit logo"/>
|
|
4
|
+
<h1 align="center">OpenCommit</h1>
|
|
5
|
+
<h4 align="center">Author <a href="https://github.com/di-sukharev">@di-sukharev</a> <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>
|
|
7
|
+
</div>
|
|
8
|
+
<p>AI generates conventional commits with mind-blowing accuracy</p>
|
|
9
|
+
<a href="https://www.npmjs.com/package/opencommit"><img src="https://img.shields.io/npm/v/opencommit" alt="Current version"></a>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
## Setup
|
|
19
|
+
|
|
20
|
+
> The minimum supported version of Node.js is the latest v14. Check your Node.js version with `node --version`.
|
|
21
|
+
|
|
22
|
+
1. Install opencommit globally to use in any repository:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install -g opencommit
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. Get your API key from [OpenAI](https://platform.openai.com/account/api-keys)
|
|
29
|
+
|
|
30
|
+
3. Set the key to opencommit config:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
opencommit config set OPENAI_API_KEY=<your token>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Your token isn't sent to anyone, it's saved in `~/.opencommit` config file.
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
You can call `opencommit` directly to generate a commit message for your staged changes:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
git add <files...>
|
|
44
|
+
opencommit
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
You can also use the `oc` shortcut:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
git add <files...>
|
|
51
|
+
oc
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
### Preface commits with emoji ðŸ¤
|
|
57
|
+
|
|
58
|
+
[GitMoji](https://gitmoji.dev/) convention is used.
|
|
59
|
+
|
|
60
|
+
To add emoji:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
oc config set emoji=true
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
To remove emoji:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
oc config set emoji=false
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Postface commits with descriptions of changes
|
|
73
|
+
|
|
74
|
+
To add descriptions:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
oc config set description=true
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
To remove description:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
oc config set description=false
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Git hook
|
|
87
|
+
|
|
88
|
+
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.
|
|
89
|
+
|
|
90
|
+
To set the hook:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
oc hook set
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
To unset the hook:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
oc hook unset
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
To use the hook:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
git add <files...>
|
|
106
|
+
git commit
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Or follow the process of your IDE Source Control feature, when it calls `git commit` command — OpenCommit will integrate into the flow.
|
|
110
|
+
|
|
111
|
+
## Payments
|
|
112
|
+
|
|
113
|
+
You pay for your own requests to OpenAI API. OpenCommit uses ChatGPT official model, that is ~10x times cheaper than GPT-3.
|