opencommit 2.0.19 → 2.1.1
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/README.md +18 -17
- package/out/cli.cjs +36 -6
- package/out/github-action.cjs +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -37,6 +37,7 @@ on:
|
|
|
37
37
|
|
|
38
38
|
jobs:
|
|
39
39
|
opencommit:
|
|
40
|
+
timeout-minutes: 10
|
|
40
41
|
name: OpenCommit
|
|
41
42
|
runs-on: ubuntu-latest
|
|
42
43
|
permissions: write-all
|
|
@@ -75,7 +76,7 @@ Interactive rebase (`rebase -i`) changes commit SHA, so commit history in remote
|
|
|
75
76
|
|
|
76
77
|
## Setup OpenCommit as a CLI
|
|
77
78
|
|
|
78
|
-
You can use OpenCommit by simply running it via CLI like this `
|
|
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.
|
|
79
80
|
|
|
80
81
|
1. Install OpenCommit globally to use in any repository:
|
|
81
82
|
|
|
@@ -102,7 +103,7 @@ git add <files...>
|
|
|
102
103
|
opencommit
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
You can also use the `
|
|
106
|
+
You can also use the `oco` shortcut:
|
|
106
107
|
|
|
107
108
|
```sh
|
|
108
109
|
git add <files...>
|
|
@@ -132,19 +133,19 @@ Local config still has more priority as Global config, but you may set `OCO_MODE
|
|
|
132
133
|
Simply run any of the variable above like this:
|
|
133
134
|
|
|
134
135
|
```sh
|
|
135
|
-
|
|
136
|
+
oco config set OCO_OPENAI_API_KEY=gpt-4
|
|
136
137
|
```
|
|
137
138
|
|
|
138
139
|
Configure [GitMoji](https://gitmoji.dev/) to preface a message.
|
|
139
140
|
|
|
140
141
|
```sh
|
|
141
|
-
|
|
142
|
+
oco config set OCO_EMOJI=true
|
|
142
143
|
```
|
|
143
144
|
|
|
144
145
|
To remove preface emoji:
|
|
145
146
|
|
|
146
147
|
```sh
|
|
147
|
-
|
|
148
|
+
oco config set OCO_EMOJI=false
|
|
148
149
|
```
|
|
149
150
|
|
|
150
151
|
### Switch to GPT-4
|
|
@@ -154,7 +155,7 @@ By default OpenCommit uses GPT-3.5-turbo (ChatGPT).
|
|
|
154
155
|
You may switch to GPT-4 which performs better, but costs ~x15 times more 🤠
|
|
155
156
|
|
|
156
157
|
```sh
|
|
157
|
-
|
|
158
|
+
oco config set OCO_MODEL=gpt-4
|
|
158
159
|
```
|
|
159
160
|
|
|
160
161
|
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.
|
|
@@ -165,25 +166,25 @@ To globally specify the language used to generate commit messages:
|
|
|
165
166
|
|
|
166
167
|
```sh
|
|
167
168
|
# de, German ,Deutsch
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
oco config set OCO_LANGUAGE=de
|
|
170
|
+
oco config set OCO_LANGUAGE=German
|
|
171
|
+
oco config set OCO_LANGUAGE=Deutsch
|
|
171
172
|
|
|
172
173
|
# fr, French, française
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
oco config set OCO_LANGUAGE=fr
|
|
175
|
+
oco config set OCO_LANGUAGE=French
|
|
176
|
+
oco config set OCO_LANGUAGE=française
|
|
176
177
|
```
|
|
177
178
|
|
|
178
|
-
The default language set is **English**
|
|
179
|
+
The default language set is **English**
|
|
179
180
|
All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder
|
|
180
181
|
|
|
181
182
|
### Git flags
|
|
182
183
|
|
|
183
|
-
The `opencommit` or `
|
|
184
|
+
The `opencommit` or `oco` commands can be used in place of the `git commit -m "${generatedMessage}"` command. This means that any regular flags that are used with the `git commit` command will also be applied when using `opencommit` or `oco`.
|
|
184
185
|
|
|
185
186
|
```sh
|
|
186
|
-
|
|
187
|
+
oco --no-verify
|
|
187
188
|
```
|
|
188
189
|
|
|
189
190
|
is translated to :
|
|
@@ -212,13 +213,13 @@ You can set OpenCommit as Git [`prepare-commit-msg`](https://git-scm.com/docs/gi
|
|
|
212
213
|
To set the hook:
|
|
213
214
|
|
|
214
215
|
```sh
|
|
215
|
-
|
|
216
|
+
oco hook set
|
|
216
217
|
```
|
|
217
218
|
|
|
218
219
|
To unset the hook:
|
|
219
220
|
|
|
220
221
|
```sh
|
|
221
|
-
|
|
222
|
+
oco hook unset
|
|
222
223
|
```
|
|
223
224
|
|
|
224
225
|
To use the hook:
|
package/out/cli.cjs
CHANGED
|
@@ -16272,7 +16272,7 @@ function G3(t, e2) {
|
|
|
16272
16272
|
// package.json
|
|
16273
16273
|
var package_default = {
|
|
16274
16274
|
name: "opencommit",
|
|
16275
|
-
version: "2.0
|
|
16275
|
+
version: "2.1.0",
|
|
16276
16276
|
description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
|
16277
16277
|
keywords: [
|
|
16278
16278
|
"git",
|
|
@@ -16289,7 +16289,6 @@ var package_default = {
|
|
|
16289
16289
|
main: "cli.js",
|
|
16290
16290
|
bin: {
|
|
16291
16291
|
opencommit: "./out/cli.cjs",
|
|
16292
|
-
oc: "./out/cli.cjs",
|
|
16293
16292
|
oco: "./out/cli.cjs"
|
|
16294
16293
|
},
|
|
16295
16294
|
repository: {
|
|
@@ -16314,7 +16313,7 @@ var package_default = {
|
|
|
16314
16313
|
start: "node ./out/cli.cjs",
|
|
16315
16314
|
dev: "ts-node ./src/cli.ts",
|
|
16316
16315
|
build: "rimraf out && node esbuild.config.js",
|
|
16317
|
-
deploy: "npm run build && npm version patch && npm publish --tag latest",
|
|
16316
|
+
deploy: "npm run build:push && npm version patch && git push origin --tags && npm publish --tag latest",
|
|
16318
16317
|
"build:push": "npm run build && git add . && git commit -m 'build' && git push",
|
|
16319
16318
|
lint: "eslint src --ext ts && tsc --noEmit",
|
|
16320
16319
|
format: "prettier --write src"
|
|
@@ -21686,7 +21685,7 @@ var [command, mode] = process.argv.slice(2);
|
|
|
21686
21685
|
if (!apiKey && command !== "config" && mode !== "set" /* set */) {
|
|
21687
21686
|
ae("opencommit");
|
|
21688
21687
|
ce(
|
|
21689
|
-
"OCO_OPENAI_API_KEY is not set, please run `
|
|
21688
|
+
"OCO_OPENAI_API_KEY is not set, please run `oco config set OCO_OPENAI_API_KEY=<your token>. Make sure you add payment details, so API works.`"
|
|
21690
21689
|
);
|
|
21691
21690
|
ce(
|
|
21692
21691
|
"For help look into README https://github.com/di-sukharev/opencommit#setup"
|
|
@@ -21733,6 +21732,17 @@ var OpenAi = class {
|
|
|
21733
21732
|
}
|
|
21734
21733
|
};
|
|
21735
21734
|
};
|
|
21735
|
+
var getOpenCommitLatestVersion = async () => {
|
|
21736
|
+
try {
|
|
21737
|
+
const { data } = await axios_default.get(
|
|
21738
|
+
"https://unpkg.com/opencommit/package.json"
|
|
21739
|
+
);
|
|
21740
|
+
return data.version;
|
|
21741
|
+
} catch (_6) {
|
|
21742
|
+
ce("Error while getting the latest version of opencommit");
|
|
21743
|
+
return void 0;
|
|
21744
|
+
}
|
|
21745
|
+
};
|
|
21736
21746
|
var api = new OpenAi();
|
|
21737
21747
|
|
|
21738
21748
|
// src/utils/tokenCount.ts
|
|
@@ -21903,7 +21913,7 @@ var prepareCommitMessageHook = async (isStageAllFlag = false) => {
|
|
|
21903
21913
|
if (changedFiles)
|
|
21904
21914
|
await gitAdd({ files: changedFiles });
|
|
21905
21915
|
else {
|
|
21906
|
-
ce("No changes detected, write some code and run `
|
|
21916
|
+
ce("No changes detected, write some code and run `oco` again");
|
|
21907
21917
|
process.exit(1);
|
|
21908
21918
|
}
|
|
21909
21919
|
}
|
|
@@ -22037,7 +22047,7 @@ async function commit(extraArgs2 = [], isStageAllFlag = false) {
|
|
|
22037
22047
|
if (changedFiles2)
|
|
22038
22048
|
await gitAdd({ files: changedFiles2 });
|
|
22039
22049
|
else {
|
|
22040
|
-
ce("No changes detected, write some code and run `
|
|
22050
|
+
ce("No changes detected, write some code and run `oco` again");
|
|
22041
22051
|
process.exit(1);
|
|
22042
22052
|
}
|
|
22043
22053
|
}
|
|
@@ -22095,6 +22105,25 @@ ${stagedFiles.map((file) => ` ${file}`).join("\n")}`
|
|
|
22095
22105
|
process.exit(0);
|
|
22096
22106
|
}
|
|
22097
22107
|
|
|
22108
|
+
// src/utils/checkIsLatestVersion.ts
|
|
22109
|
+
var checkIsLatestVersion = async () => {
|
|
22110
|
+
const latestVersion = await getOpenCommitLatestVersion();
|
|
22111
|
+
if (latestVersion) {
|
|
22112
|
+
const currentVersion = package_default.version;
|
|
22113
|
+
if (currentVersion !== latestVersion) {
|
|
22114
|
+
console.warn(
|
|
22115
|
+
source_default.yellow(
|
|
22116
|
+
`
|
|
22117
|
+
You are not using the latest stable version of OpenCommit with new features and bug fixes.
|
|
22118
|
+
Current version: ${currentVersion}. Latest version: ${latestVersion}.
|
|
22119
|
+
\u{1F680} To update run: npm i -g opencommit@latest.
|
|
22120
|
+
`
|
|
22121
|
+
)
|
|
22122
|
+
);
|
|
22123
|
+
}
|
|
22124
|
+
}
|
|
22125
|
+
};
|
|
22126
|
+
|
|
22098
22127
|
// src/cli.ts
|
|
22099
22128
|
var extraArgs = process.argv.slice(2);
|
|
22100
22129
|
Z2(
|
|
@@ -22107,6 +22136,7 @@ Z2(
|
|
|
22107
22136
|
help: { description: package_default.description }
|
|
22108
22137
|
},
|
|
22109
22138
|
async () => {
|
|
22139
|
+
await checkIsLatestVersion();
|
|
22110
22140
|
if (await isHookCalled()) {
|
|
22111
22141
|
prepareCommitMessageHook();
|
|
22112
22142
|
} else {
|
package/out/github-action.cjs
CHANGED
|
@@ -26973,7 +26973,7 @@ var [command, mode] = process.argv.slice(2);
|
|
|
26973
26973
|
if (!apiKey && command !== "config" && mode !== "set" /* set */) {
|
|
26974
26974
|
ae("opencommit");
|
|
26975
26975
|
ce(
|
|
26976
|
-
"OCO_OPENAI_API_KEY is not set, please run `
|
|
26976
|
+
"OCO_OPENAI_API_KEY is not set, please run `oco config set OCO_OPENAI_API_KEY=<your token>. Make sure you add payment details, so API works.`"
|
|
26977
26977
|
);
|
|
26978
26978
|
ce(
|
|
26979
26979
|
"For help look into README https://github.com/di-sukharev/opencommit#setup"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencommit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"main": "cli.js",
|
|
18
18
|
"bin": {
|
|
19
19
|
"opencommit": "./out/cli.cjs",
|
|
20
|
-
"oc": "./out/cli.cjs",
|
|
21
20
|
"oco": "./out/cli.cjs"
|
|
22
21
|
},
|
|
23
22
|
"repository": {
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
"start": "node ./out/cli.cjs",
|
|
43
42
|
"dev": "ts-node ./src/cli.ts",
|
|
44
43
|
"build": "rimraf out && node esbuild.config.js",
|
|
45
|
-
"deploy": "npm run build && npm version patch && npm publish --tag latest",
|
|
44
|
+
"deploy": "npm run build:push && npm version patch && git push origin --tags && npm publish --tag latest",
|
|
46
45
|
"build:push": "npm run build && git add . && git commit -m 'build' && git push",
|
|
47
46
|
"lint": "eslint src --ext ts && tsc --noEmit",
|
|
48
47
|
"format": "prettier --write src"
|