opencommit 2.0.17 → 2.0.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Dima Sukharev
3
+ Copyright (c) Dima Sukharev, https://github.com/di-sukharev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a
6
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:
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <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
6
  </h4>
7
7
  </div>
8
- <h2>GPT CLI to auto-generate impressive commits in 1 second</h2>
8
+ <h2>Auto-generate meaningful commits in 1 second</h2>
9
9
  <p>Killing lame commits with AI 🤯🔫</p>
10
10
  <a href="https://www.npmjs.com/package/opencommit"><img src="https://img.shields.io/npm/v/opencommit" alt="Current version"></a>
11
11
  </div>
@@ -18,22 +18,16 @@
18
18
 
19
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
20
 
21
- ## Setup OpenCommit as a Github Action
21
+ ## Setup OpenCommit as a Github Action 🔥
22
22
 
23
23
  OpenCommit is now available as a GitHub Action which automatically improves all new commits messages when you push to remote!
24
24
 
25
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`.
26
26
 
27
- ### Automatic 1 click setup
28
-
29
- You can simply [setup the action automatically via the GitHub Marketplace](TODO).
30
-
31
- ### Manual 3 clicks setup
32
-
33
27
  Create a file `.github/workflows/opencommit.yml` with contents below:
34
28
 
35
29
  ```yml
36
- name: 'OpenCommit'
30
+ name: 'OpenCommit Action'
37
31
 
38
32
  on:
39
33
  push:
@@ -54,7 +48,7 @@ jobs:
54
48
  - uses: actions/checkout@v3
55
49
  with:
56
50
  fetch-depth: 0
57
- - uses: di-sukharev/opencommit@github-action
51
+ - uses: di-sukharev/opencommit@github-action-v1.0.4
58
52
  with:
59
53
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60
54
 
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.16",
16275
+ version: "2.0.18",
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",
@@ -16315,6 +16315,7 @@ var package_default = {
16315
16315
  dev: "ts-node ./src/cli.ts",
16316
16316
  build: "rimraf out && node esbuild.config.js",
16317
16317
  deploy: "npm run build && npm version patch && npm publish --tag latest",
16318
+ "build:push": "npm run build && git add . && git commit -m 'build' && git push",
16318
16319
  lint: "eslint src --ext ts && tsc --noEmit",
16319
16320
  format: "prettier --write src"
16320
16321
  },
@@ -17643,7 +17644,7 @@ var configValidators = {
17643
17644
  }
17644
17645
  validateConfig(
17645
17646
  "OCO_OPENAI_MAX_TOKENS" /* OCO_OPENAI_MAX_TOKENS */,
17646
- typeof value === "number",
17647
+ value ? typeof value === "number" : void 0,
17647
17648
  "Must be a number"
17648
17649
  );
17649
17650
  return value;
@@ -17674,8 +17675,8 @@ var configValidators = {
17674
17675
  },
17675
17676
  ["OCO_MODEL" /* OCO_MODEL */](value) {
17676
17677
  validateConfig(
17677
- "OCO_OPENAI_BASE_PATH" /* OCO_OPENAI_BASE_PATH */,
17678
- value === "gpt-3.5-turbo" || value === "gpt-4",
17678
+ "OCO_MODEL" /* OCO_MODEL */,
17679
+ ["gpt-3.5-turbo", "gpt-4"].includes(value),
17679
17680
  `${value} is not supported yet, use 'gpt-4' or 'gpt-3.5-turbo' (default)`
17680
17681
  );
17681
17682
  return value;
@@ -17685,12 +17686,12 @@ var configPath = (0, import_path.join)((0, import_os.homedir)(), ".opencommit");
17685
17686
  var getConfig = () => {
17686
17687
  const configFromEnv = {
17687
17688
  OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY,
17688
- OCO_OPENAI_MAX_TOKENS: Number(process.env.OCO_OPENAI_MAX_TOKENS),
17689
+ OCO_OPENAI_MAX_TOKENS: process.env.OCO_OPENAI_MAX_TOKENS ? Number(process.env.OCO_OPENAI_MAX_TOKENS) : void 0,
17689
17690
  OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH,
17690
17691
  OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === "true" ? true : false,
17691
17692
  OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false,
17692
- OCO_MODEL: process.env.OCO_MODEL,
17693
- OCO_LANGUAGE: process.env.OCO_LANGUAGE
17693
+ OCO_MODEL: process.env.OCO_MODEL || "gpt-3.5-turbo",
17694
+ OCO_LANGUAGE: process.env.OCO_LANGUAGE || "en"
17694
17695
  };
17695
17696
  const configExists = (0, import_fs.existsSync)(configPath);
17696
17697
  if (!configExists)
@@ -17698,6 +17699,10 @@ var getConfig = () => {
17698
17699
  const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
17699
17700
  const config4 = (0, import_ini.parse)(configFile);
17700
17701
  for (const configKey of Object.keys(config4)) {
17702
+ if (!config4[configKey] || ["null", "undefined"].includes(config4[configKey])) {
17703
+ config4[configKey] = void 0;
17704
+ continue;
17705
+ }
17701
17706
  try {
17702
17707
  const validator = configValidators[configKey];
17703
17708
  const validValue = validator(
@@ -26839,7 +26839,7 @@ var configValidators = {
26839
26839
  }
26840
26840
  validateConfig(
26841
26841
  "OCO_OPENAI_MAX_TOKENS" /* OCO_OPENAI_MAX_TOKENS */,
26842
- typeof value === "number",
26842
+ value ? typeof value === "number" : void 0,
26843
26843
  "Must be a number"
26844
26844
  );
26845
26845
  return value;
@@ -26870,8 +26870,8 @@ var configValidators = {
26870
26870
  },
26871
26871
  ["OCO_MODEL" /* OCO_MODEL */](value) {
26872
26872
  validateConfig(
26873
- "OCO_OPENAI_BASE_PATH" /* OCO_OPENAI_BASE_PATH */,
26874
- value === "gpt-3.5-turbo" || value === "gpt-4",
26873
+ "OCO_MODEL" /* OCO_MODEL */,
26874
+ ["gpt-3.5-turbo", "gpt-4"].includes(value),
26875
26875
  `${value} is not supported yet, use 'gpt-4' or 'gpt-3.5-turbo' (default)`
26876
26876
  );
26877
26877
  return value;
@@ -26881,12 +26881,12 @@ var configPath = (0, import_path.join)((0, import_os.homedir)(), ".opencommit");
26881
26881
  var getConfig = () => {
26882
26882
  const configFromEnv = {
26883
26883
  OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY,
26884
- OCO_OPENAI_MAX_TOKENS: Number(process.env.OCO_OPENAI_MAX_TOKENS),
26884
+ OCO_OPENAI_MAX_TOKENS: process.env.OCO_OPENAI_MAX_TOKENS ? Number(process.env.OCO_OPENAI_MAX_TOKENS) : void 0,
26885
26885
  OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH,
26886
26886
  OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === "true" ? true : false,
26887
26887
  OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false,
26888
- OCO_MODEL: process.env.OCO_MODEL,
26889
- OCO_LANGUAGE: process.env.OCO_LANGUAGE
26888
+ OCO_MODEL: process.env.OCO_MODEL || "gpt-3.5-turbo",
26889
+ OCO_LANGUAGE: process.env.OCO_LANGUAGE || "en"
26890
26890
  };
26891
26891
  const configExists = (0, import_fs.existsSync)(configPath);
26892
26892
  if (!configExists)
@@ -26894,6 +26894,10 @@ var getConfig = () => {
26894
26894
  const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
26895
26895
  const config4 = (0, import_ini.parse)(configFile);
26896
26896
  for (const configKey of Object.keys(config4)) {
26897
+ if (!config4[configKey] || ["null", "undefined"].includes(config4[configKey])) {
26898
+ config4[configKey] = void 0;
26899
+ continue;
26900
+ }
26897
26901
  try {
26898
26902
  const validator = configValidators[configKey];
26899
26903
  const validValue = validator(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencommit",
3
- "version": "2.0.17",
3
+ "version": "2.0.19",
4
4
  "description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
5
5
  "keywords": [
6
6
  "git",
@@ -43,6 +43,7 @@
43
43
  "dev": "ts-node ./src/cli.ts",
44
44
  "build": "rimraf out && node esbuild.config.js",
45
45
  "deploy": "npm run build && npm version patch && npm publish --tag latest",
46
+ "build:push": "npm run build && git add . && git commit -m 'build' && git push",
46
47
  "lint": "eslint src --ext ts && tsc --noEmit",
47
48
  "format": "prettier --write src"
48
49
  },