opencommit 1.1.18 → 1.1.20
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 -0
- package/out/cli.cjs +133 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,6 +84,24 @@ To remove description:
|
|
|
84
84
|
oc config set description=false
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
### Internationalization support
|
|
88
|
+
|
|
89
|
+
To specify the language used to generate commit messages:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
# de, German ,Deutsch
|
|
93
|
+
oc config set language=de
|
|
94
|
+
oc config set language=German
|
|
95
|
+
oc config set language=Deutsch
|
|
96
|
+
|
|
97
|
+
# fr, French, française
|
|
98
|
+
oc config set language=fr
|
|
99
|
+
oc config set language=French
|
|
100
|
+
oc config set language=française
|
|
101
|
+
```
|
|
102
|
+
The default language set is **English**
|
|
103
|
+
All available languages are currently listed in the [i18n](https://github.com/di-sukharev/opencommit/tree/master/src/i18n) folder
|
|
104
|
+
|
|
87
105
|
### Git flags
|
|
88
106
|
|
|
89
107
|
The `opencommit` or `oc` 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 `oc`.
|
package/out/cli.cjs
CHANGED
|
@@ -15763,7 +15763,7 @@ function G3(t, e2) {
|
|
|
15763
15763
|
// package.json
|
|
15764
15764
|
var package_default = {
|
|
15765
15765
|
name: "opencommit",
|
|
15766
|
-
version: "1.1.
|
|
15766
|
+
version: "1.1.19",
|
|
15767
15767
|
description: "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
|
15768
15768
|
keywords: [
|
|
15769
15769
|
"git",
|
|
@@ -16196,6 +16196,29 @@ var iD2 = class extends h2 {
|
|
|
16196
16196
|
this.value = u2 ? this.value.filter((F4) => F4 !== this._value) : [...this.value, this._value];
|
|
16197
16197
|
}
|
|
16198
16198
|
};
|
|
16199
|
+
var ED2 = class extends h2 {
|
|
16200
|
+
constructor(u2) {
|
|
16201
|
+
super(u2, false), this.cursor = 0, this.options = u2.options, this.cursor = this.options.findIndex(({ value: F4 }) => F4 === u2.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F4) => {
|
|
16202
|
+
switch (F4) {
|
|
16203
|
+
case "left":
|
|
16204
|
+
case "up":
|
|
16205
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
16206
|
+
break;
|
|
16207
|
+
case "down":
|
|
16208
|
+
case "right":
|
|
16209
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
16210
|
+
break;
|
|
16211
|
+
}
|
|
16212
|
+
this.changeValue();
|
|
16213
|
+
});
|
|
16214
|
+
}
|
|
16215
|
+
get _value() {
|
|
16216
|
+
return this.options[this.cursor];
|
|
16217
|
+
}
|
|
16218
|
+
changeValue() {
|
|
16219
|
+
this.value = this._value.value;
|
|
16220
|
+
}
|
|
16221
|
+
};
|
|
16199
16222
|
function aD2({ input: t = import_node_process.stdin, output: u2 = import_node_process.stdout, overwrite: F4 = true, hideCursor: e2 = true } = {}) {
|
|
16200
16223
|
const s = f.createInterface({ input: t, output: u2, prompt: "", tabSize: 1 });
|
|
16201
16224
|
f.emitKeypressEvents(t, s), t.isTTY && t.setRawMode(true);
|
|
@@ -16276,6 +16299,29 @@ ${import_picocolors.default.cyan(o)}
|
|
|
16276
16299
|
}
|
|
16277
16300
|
} }).prompt();
|
|
16278
16301
|
};
|
|
16302
|
+
var ee = (r2) => {
|
|
16303
|
+
const n = (s, t) => {
|
|
16304
|
+
const i2 = s.label ?? String(s.value);
|
|
16305
|
+
return t === "active" ? `${import_picocolors.default.green(w5)} ${i2} ${s.hint ? import_picocolors.default.dim(`(${s.hint})`) : ""}` : t === "selected" ? `${import_picocolors.default.dim(i2)}` : t === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(i2))}` : `${import_picocolors.default.dim(S4)} ${import_picocolors.default.dim(i2)}`;
|
|
16306
|
+
};
|
|
16307
|
+
return new ED2({ options: r2.options, initialValue: r2.initialValue, render() {
|
|
16308
|
+
const s = `${import_picocolors.default.gray(a)}
|
|
16309
|
+
${h3(this.state)} ${r2.message}
|
|
16310
|
+
`;
|
|
16311
|
+
switch (this.state) {
|
|
16312
|
+
case "submit":
|
|
16313
|
+
return `${s}${import_picocolors.default.gray(a)} ${n(this.options[this.cursor], "selected")}`;
|
|
16314
|
+
case "cancel":
|
|
16315
|
+
return `${s}${import_picocolors.default.gray(a)} ${n(this.options[this.cursor], "cancelled")}
|
|
16316
|
+
${import_picocolors.default.gray(a)}`;
|
|
16317
|
+
default:
|
|
16318
|
+
return `${s}${import_picocolors.default.cyan(a)} ${this.options.map((t, i2) => n(t, i2 === this.cursor ? "active" : "inactive")).join(`
|
|
16319
|
+
${import_picocolors.default.cyan(a)} `)}
|
|
16320
|
+
${import_picocolors.default.cyan(o)}
|
|
16321
|
+
`;
|
|
16322
|
+
}
|
|
16323
|
+
} }).prompt();
|
|
16324
|
+
};
|
|
16279
16325
|
var re = (r2) => {
|
|
16280
16326
|
const n = (s, t) => {
|
|
16281
16327
|
const i2 = s.label ?? String(s.value);
|
|
@@ -16895,6 +16941,14 @@ var ja_default = {
|
|
|
16895
16941
|
commitDescription: "\u30DD\u30FC\u30C8\u5909\u6570\u306F\u73FE\u5728PORT\u3068\u3044\u3046\u540D\u524D\u306B\u306A\u3063\u3066\u304A\u308A\u3001PORT\u306F\u5B9A\u6570\u3067\u3042\u308B\u305F\u3081\u547D\u540D\u898F\u5247\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u74B0\u5883\u5909\u6570\u306E\u30B5\u30DD\u30FC\u30C8\u306B\u3088\u308A\u3001\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306F\u3088\u308A\u67D4\u8EDF\u306B\u306A\u308A\u3001process.env.PORT\u74B0\u5883\u5909\u6570\u3067\u6307\u5B9A\u3055\u308C\u305F\u4EFB\u610F\u306E\u5229\u7528\u53EF\u80FD\u306A\u30DD\u30FC\u30C8\u3067\u5B9F\u884C\u3067\u304D\u308B\u3088\u3046\u306B\u306A\u308A\u307E\u3057"
|
|
16896
16942
|
};
|
|
16897
16943
|
|
|
16944
|
+
// src/i18n/pt_br.json
|
|
16945
|
+
var pt_br_default = {
|
|
16946
|
+
localLanguage: "portugu\xEAs",
|
|
16947
|
+
commitFix: "fix(server.ts): altera o caso da vari\xE1vel de porta de port min\xFAscula para PORT mai\xFAscula",
|
|
16948
|
+
commitFeat: "feat(server.ts): adiciona suporte para a vari\xE1vel de ambiente process.env.PORT",
|
|
16949
|
+
commitDescription: "A vari\xE1vel de porta agora \xE9 denominada PORT, o que melhora a consist\xEAncia com as conven\xE7\xF5es de nomenclatura, pois PORT \xE9 uma constante. O suporte para uma vari\xE1vel de ambiente permite que o aplicativo seja mais flex\xEDvel, pois agora pode ser executado em qualquer porta dispon\xEDvel especificada por meio da vari\xE1vel de ambiente process.env.PORT."
|
|
16950
|
+
};
|
|
16951
|
+
|
|
16898
16952
|
// src/i18n/index.ts
|
|
16899
16953
|
var i18n = {
|
|
16900
16954
|
en: en_default,
|
|
@@ -16904,7 +16958,8 @@ var i18n = {
|
|
|
16904
16958
|
de: de_default,
|
|
16905
16959
|
fr: fr_default,
|
|
16906
16960
|
it: it_default,
|
|
16907
|
-
ko: ko_default
|
|
16961
|
+
ko: ko_default,
|
|
16962
|
+
pt_br: pt_br_default
|
|
16908
16963
|
};
|
|
16909
16964
|
var I18N_CONFIG_ALIAS = {
|
|
16910
16965
|
zh_CN: ["zh_CN", "\u7B80\u4F53\u4E2D\u6587", "\u4E2D\u6587", "\u7B80\u4F53"],
|
|
@@ -16913,7 +16968,9 @@ var I18N_CONFIG_ALIAS = {
|
|
|
16913
16968
|
ko: ["ko", "Korean", "\uD55C\uAD6D\uC5B4"],
|
|
16914
16969
|
de: ["de", "German", "Deutsch"],
|
|
16915
16970
|
fr: ["fr", "French", "fran\xE7aise"],
|
|
16916
|
-
it: ["it", "Italian", "italiano"]
|
|
16971
|
+
it: ["it", "Italian", "italiano"],
|
|
16972
|
+
pt_br: ["pt_br", "Portuguese", "portugu\xEAs"],
|
|
16973
|
+
en: ["en", "English", "english"]
|
|
16917
16974
|
};
|
|
16918
16975
|
function getI18nLocal(value) {
|
|
16919
16976
|
for (const key in I18N_CONFIG_ALIAS) {
|
|
@@ -17974,7 +18031,8 @@ var getStagedFiles = async () => {
|
|
|
17974
18031
|
const { stdout: files } = await execa("git", [
|
|
17975
18032
|
"diff",
|
|
17976
18033
|
"--name-only",
|
|
17977
|
-
"--cached"
|
|
18034
|
+
"--cached",
|
|
18035
|
+
"--relative"
|
|
17978
18036
|
]);
|
|
17979
18037
|
if (!files)
|
|
17980
18038
|
return [];
|
|
@@ -20961,6 +21019,17 @@ var OpenAi = class {
|
|
|
20961
21019
|
};
|
|
20962
21020
|
}
|
|
20963
21021
|
};
|
|
21022
|
+
var getOpenCommitLatestVersion = async () => {
|
|
21023
|
+
try {
|
|
21024
|
+
const { data } = await axios_default.get(
|
|
21025
|
+
"https://unpkg.com/opencommit/package.json"
|
|
21026
|
+
);
|
|
21027
|
+
return data.version;
|
|
21028
|
+
} catch (_6) {
|
|
21029
|
+
ce("Error while getting the latest version of opencommit");
|
|
21030
|
+
return void 0;
|
|
21031
|
+
}
|
|
21032
|
+
};
|
|
20964
21033
|
var api = new OpenAi();
|
|
20965
21034
|
|
|
20966
21035
|
// src/utils/mergeStrings.ts
|
|
@@ -21140,6 +21209,10 @@ var trytm = async (promise) => {
|
|
|
21140
21209
|
};
|
|
21141
21210
|
|
|
21142
21211
|
// src/commands/commit.ts
|
|
21212
|
+
var getGitRemotes = async () => {
|
|
21213
|
+
const { stdout } = await execa("git", ["remote"]);
|
|
21214
|
+
return stdout.split("\n").filter((remote) => remote.trim() !== "");
|
|
21215
|
+
};
|
|
21143
21216
|
var generateCommitMessageFromGitDiff = async (diff, extraArgs2) => {
|
|
21144
21217
|
await assertGitRepo();
|
|
21145
21218
|
const commitSpinner = le();
|
|
@@ -21173,19 +21246,41 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
|
|
|
21173
21246
|
]);
|
|
21174
21247
|
ce(`${source_default.green("\u2714")} successfully committed`);
|
|
21175
21248
|
ce(stdout);
|
|
21176
|
-
const
|
|
21177
|
-
|
|
21178
|
-
|
|
21179
|
-
|
|
21180
|
-
|
|
21181
|
-
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
|
|
21185
|
-
|
|
21186
|
-
|
|
21187
|
-
|
|
21188
|
-
|
|
21249
|
+
const remotes = await getGitRemotes();
|
|
21250
|
+
if (remotes.length === 1) {
|
|
21251
|
+
const isPushConfirmedByUser = await Q3({
|
|
21252
|
+
message: "Do you want to run `git push`?"
|
|
21253
|
+
});
|
|
21254
|
+
if (isPushConfirmedByUser && !eD2(isPushConfirmedByUser)) {
|
|
21255
|
+
const pushSpinner = le();
|
|
21256
|
+
pushSpinner.start(`Running \`git push ${remotes[0]}\``);
|
|
21257
|
+
const { stdout: stdout2 } = await execa("git", ["push", remotes[0]]);
|
|
21258
|
+
pushSpinner.stop(
|
|
21259
|
+
`${source_default.green("\u2714")} successfully pushed all commits to ${remotes[0]}`
|
|
21260
|
+
);
|
|
21261
|
+
if (stdout2)
|
|
21262
|
+
ce(stdout2);
|
|
21263
|
+
}
|
|
21264
|
+
} else {
|
|
21265
|
+
const selectedRemote = await ee({
|
|
21266
|
+
message: "Choose a remote to push to",
|
|
21267
|
+
options: remotes.map((remote) => ({ value: remote, label: remote }))
|
|
21268
|
+
});
|
|
21269
|
+
if (!eD2(selectedRemote)) {
|
|
21270
|
+
const pushSpinner = le();
|
|
21271
|
+
pushSpinner.start(`Running \`git push ${selectedRemote}\``);
|
|
21272
|
+
const { stdout: stdout2 } = await execa("git", ["push", selectedRemote]);
|
|
21273
|
+
pushSpinner.stop(
|
|
21274
|
+
`${source_default.green(
|
|
21275
|
+
"\u2714"
|
|
21276
|
+
)} successfully pushed all commits to ${selectedRemote}`
|
|
21277
|
+
);
|
|
21278
|
+
if (stdout2)
|
|
21279
|
+
ce(stdout2);
|
|
21280
|
+
} else
|
|
21281
|
+
ce(`${source_default.gray("\u2716")} process cancelled`);
|
|
21282
|
+
}
|
|
21283
|
+
}
|
|
21189
21284
|
};
|
|
21190
21285
|
async function commit(extraArgs2 = [], isStageAllFlag = false) {
|
|
21191
21286
|
if (isStageAllFlag) {
|
|
@@ -21251,6 +21346,25 @@ ${stagedFiles.map((file) => ` ${file}`).join("\n")}`
|
|
|
21251
21346
|
process.exit(0);
|
|
21252
21347
|
}
|
|
21253
21348
|
|
|
21349
|
+
// src/utils/checkIsLatestVersion.ts
|
|
21350
|
+
var checkIsLatestVersion = async () => {
|
|
21351
|
+
const latestVersion = await getOpenCommitLatestVersion();
|
|
21352
|
+
if (latestVersion) {
|
|
21353
|
+
const currentVersion = package_default.version;
|
|
21354
|
+
if (currentVersion !== latestVersion) {
|
|
21355
|
+
console.warn(
|
|
21356
|
+
source_default.yellow(
|
|
21357
|
+
`
|
|
21358
|
+
You are not using the latest stable version of OpenCommit with new features and bug fixes.
|
|
21359
|
+
Current version: ${currentVersion}. Latest version: ${latestVersion}.
|
|
21360
|
+
\u{1F680} To update run: npm i -g opencommit@latest.
|
|
21361
|
+
`
|
|
21362
|
+
)
|
|
21363
|
+
);
|
|
21364
|
+
}
|
|
21365
|
+
}
|
|
21366
|
+
};
|
|
21367
|
+
|
|
21254
21368
|
// src/cli.ts
|
|
21255
21369
|
var extraArgs = process.argv.slice(2);
|
|
21256
21370
|
Z2(
|
|
@@ -21262,7 +21376,8 @@ Z2(
|
|
|
21262
21376
|
ignoreArgv: (type) => type === "unknown-flag" || type === "argument",
|
|
21263
21377
|
help: { description: package_default.description }
|
|
21264
21378
|
},
|
|
21265
|
-
() => {
|
|
21379
|
+
async () => {
|
|
21380
|
+
await checkIsLatestVersion();
|
|
21266
21381
|
if (isHookCalled) {
|
|
21267
21382
|
prepareCommitMessageHook();
|
|
21268
21383
|
} else {
|