mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-12 23:28:16 -05:00
Compare commits
6 Commits
github-act
...
v2.0.19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b40657c1a7 | ||
|
|
dcd8f52be3 | ||
|
|
0eff198eb9 | ||
|
|
b345eee815 | ||
|
|
cba599337d | ||
|
|
4e25f1460a |
@@ -48,7 +48,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: di-sukharev/opencommit@github-action-v1.0.1
|
||||
- uses: di-sukharev/opencommit@github-action-v1.0.4
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
19
out/cli.cjs
19
out/cli.cjs
@@ -16272,7 +16272,7 @@ function G3(t, e2) {
|
||||
// package.json
|
||||
var package_default = {
|
||||
name: "opencommit",
|
||||
version: "2.0.16",
|
||||
version: "2.0.18",
|
||||
description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
||||
keywords: [
|
||||
"git",
|
||||
@@ -16315,6 +16315,7 @@ var package_default = {
|
||||
dev: "ts-node ./src/cli.ts",
|
||||
build: "rimraf out && node esbuild.config.js",
|
||||
deploy: "npm run build && npm version patch && npm publish --tag latest",
|
||||
"build:push": "npm run build && git add . && git commit -m 'build' && git push",
|
||||
lint: "eslint src --ext ts && tsc --noEmit",
|
||||
format: "prettier --write src"
|
||||
},
|
||||
@@ -17643,7 +17644,7 @@ var configValidators = {
|
||||
}
|
||||
validateConfig(
|
||||
"OCO_OPENAI_MAX_TOKENS" /* OCO_OPENAI_MAX_TOKENS */,
|
||||
typeof value === "number",
|
||||
value ? typeof value === "number" : void 0,
|
||||
"Must be a number"
|
||||
);
|
||||
return value;
|
||||
@@ -17674,8 +17675,8 @@ var configValidators = {
|
||||
},
|
||||
["OCO_MODEL" /* OCO_MODEL */](value) {
|
||||
validateConfig(
|
||||
"OCO_OPENAI_BASE_PATH" /* OCO_OPENAI_BASE_PATH */,
|
||||
value === "gpt-3.5-turbo" || value === "gpt-4",
|
||||
"OCO_MODEL" /* OCO_MODEL */,
|
||||
["gpt-3.5-turbo", "gpt-4"].includes(value),
|
||||
`${value} is not supported yet, use 'gpt-4' or 'gpt-3.5-turbo' (default)`
|
||||
);
|
||||
return value;
|
||||
@@ -17685,12 +17686,12 @@ var configPath = (0, import_path.join)((0, import_os.homedir)(), ".opencommit");
|
||||
var getConfig = () => {
|
||||
const configFromEnv = {
|
||||
OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY,
|
||||
OCO_OPENAI_MAX_TOKENS: Number(process.env.OCO_OPENAI_MAX_TOKENS),
|
||||
OCO_OPENAI_MAX_TOKENS: process.env.OCO_OPENAI_MAX_TOKENS ? Number(process.env.OCO_OPENAI_MAX_TOKENS) : void 0,
|
||||
OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH,
|
||||
OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === "true" ? true : false,
|
||||
OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false,
|
||||
OCO_MODEL: process.env.OCO_MODEL,
|
||||
OCO_LANGUAGE: process.env.OCO_LANGUAGE
|
||||
OCO_MODEL: process.env.OCO_MODEL || "gpt-3.5-turbo",
|
||||
OCO_LANGUAGE: process.env.OCO_LANGUAGE || "en"
|
||||
};
|
||||
const configExists = (0, import_fs.existsSync)(configPath);
|
||||
if (!configExists)
|
||||
@@ -17698,6 +17699,10 @@ var getConfig = () => {
|
||||
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
||||
const config4 = (0, import_ini.parse)(configFile);
|
||||
for (const configKey of Object.keys(config4)) {
|
||||
if (!config4[configKey] || ["null", "undefined"].includes(config4[configKey])) {
|
||||
config4[configKey] = void 0;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
const validator = configValidators[configKey];
|
||||
const validValue = validator(
|
||||
|
||||
@@ -26839,7 +26839,7 @@ var configValidators = {
|
||||
}
|
||||
validateConfig(
|
||||
"OCO_OPENAI_MAX_TOKENS" /* OCO_OPENAI_MAX_TOKENS */,
|
||||
typeof value === "number",
|
||||
value ? typeof value === "number" : void 0,
|
||||
"Must be a number"
|
||||
);
|
||||
return value;
|
||||
@@ -26870,8 +26870,8 @@ var configValidators = {
|
||||
},
|
||||
["OCO_MODEL" /* OCO_MODEL */](value) {
|
||||
validateConfig(
|
||||
"OCO_OPENAI_BASE_PATH" /* OCO_OPENAI_BASE_PATH */,
|
||||
value === "gpt-3.5-turbo" || value === "gpt-4",
|
||||
"OCO_MODEL" /* OCO_MODEL */,
|
||||
["gpt-3.5-turbo", "gpt-4"].includes(value),
|
||||
`${value} is not supported yet, use 'gpt-4' or 'gpt-3.5-turbo' (default)`
|
||||
);
|
||||
return value;
|
||||
@@ -26881,12 +26881,12 @@ var configPath = (0, import_path.join)((0, import_os.homedir)(), ".opencommit");
|
||||
var getConfig = () => {
|
||||
const configFromEnv = {
|
||||
OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY,
|
||||
OCO_OPENAI_MAX_TOKENS: Number(process.env.OCO_OPENAI_MAX_TOKENS),
|
||||
OCO_OPENAI_MAX_TOKENS: process.env.OCO_OPENAI_MAX_TOKENS ? Number(process.env.OCO_OPENAI_MAX_TOKENS) : void 0,
|
||||
OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH,
|
||||
OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === "true" ? true : false,
|
||||
OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false,
|
||||
OCO_MODEL: process.env.OCO_MODEL,
|
||||
OCO_LANGUAGE: process.env.OCO_LANGUAGE
|
||||
OCO_MODEL: process.env.OCO_MODEL || "gpt-3.5-turbo",
|
||||
OCO_LANGUAGE: process.env.OCO_LANGUAGE || "en"
|
||||
};
|
||||
const configExists = (0, import_fs.existsSync)(configPath);
|
||||
if (!configExists)
|
||||
@@ -26894,6 +26894,10 @@ var getConfig = () => {
|
||||
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
|
||||
const config4 = (0, import_ini.parse)(configFile);
|
||||
for (const configKey of Object.keys(config4)) {
|
||||
if (!config4[configKey] || ["null", "undefined"].includes(config4[configKey])) {
|
||||
config4[configKey] = void 0;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
const validator = configValidators[configKey];
|
||||
const validValue = validator(
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "opencommit",
|
||||
"version": "2.0.17",
|
||||
"version": "2.0.19",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "opencommit",
|
||||
"version": "2.0.17",
|
||||
"version": "2.0.19",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "opencommit",
|
||||
"version": "2.0.17",
|
||||
"version": "2.0.19",
|
||||
"description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
|
||||
"keywords": [
|
||||
"git",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { execa } from 'execa';
|
||||
import {
|
||||
GenerateCommitMessageErrorEnum,
|
||||
generateCommitMessageByDiff
|
||||
} from '../generateCommitMessageFromGitDiff';
|
||||
import {
|
||||
|
||||
@@ -80,7 +80,7 @@ export const configValidators = {
|
||||
}
|
||||
validateConfig(
|
||||
CONFIG_KEYS.OCO_OPENAI_MAX_TOKENS,
|
||||
typeof value === 'number',
|
||||
value ? typeof value === 'number' : undefined,
|
||||
'Must be a number'
|
||||
);
|
||||
|
||||
@@ -117,8 +117,8 @@ export const configValidators = {
|
||||
|
||||
[CONFIG_KEYS.OCO_MODEL](value: any) {
|
||||
validateConfig(
|
||||
CONFIG_KEYS.OCO_OPENAI_BASE_PATH,
|
||||
value === 'gpt-3.5-turbo' || value === 'gpt-4',
|
||||
CONFIG_KEYS.OCO_MODEL,
|
||||
['gpt-3.5-turbo', 'gpt-4'].includes(value),
|
||||
`${value} is not supported yet, use 'gpt-4' or 'gpt-3.5-turbo' (default)`
|
||||
);
|
||||
return value;
|
||||
@@ -134,12 +134,12 @@ const configPath = pathJoin(homedir(), '.opencommit');
|
||||
export const getConfig = (): ConfigType | null => {
|
||||
const configFromEnv = {
|
||||
OCO_OPENAI_API_KEY: process.env.OCO_OPENAI_API_KEY,
|
||||
OCO_OPENAI_MAX_TOKENS: Number(process.env.OCO_OPENAI_MAX_TOKENS),
|
||||
OCO_OPENAI_MAX_TOKENS: process.env.OCO_OPENAI_MAX_TOKENS ? Number(process.env.OCO_OPENAI_MAX_TOKENS) : undefined,
|
||||
OCO_OPENAI_BASE_PATH: process.env.OCO_OPENAI_BASE_PATH,
|
||||
OCO_DESCRIPTION: process.env.OCO_DESCRIPTION === 'true' ? true : false,
|
||||
OCO_EMOJI: process.env.OCO_EMOJI === 'true' ? true : false,
|
||||
OCO_MODEL: process.env.OCO_MODEL,
|
||||
OCO_LANGUAGE: process.env.OCO_LANGUAGE
|
||||
OCO_MODEL: process.env.OCO_MODEL || 'gpt-3.5-turbo',
|
||||
OCO_LANGUAGE: process.env.OCO_LANGUAGE || 'en'
|
||||
};
|
||||
|
||||
const configExists = existsSync(configPath);
|
||||
@@ -149,6 +149,10 @@ export const getConfig = (): ConfigType | null => {
|
||||
const config = iniParse(configFile);
|
||||
|
||||
for (const configKey of Object.keys(config)) {
|
||||
if (!config[configKey] || ['null', 'undefined'].includes(config[configKey])) {
|
||||
config[configKey] = undefined;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
const validator = configValidators[configKey as CONFIG_KEYS];
|
||||
const validValue = validator(
|
||||
|
||||
@@ -74,9 +74,6 @@ export enum GenerateCommitMessageErrorEnum {
|
||||
emptyMessage = 'EMPTY_MESSAGE'
|
||||
}
|
||||
|
||||
interface GenerateCommitMessageError {
|
||||
error: GenerateCommitMessageErrorEnum;
|
||||
}
|
||||
|
||||
const INIT_MESSAGES_PROMPT_LENGTH = INIT_MESSAGES_PROMPT.map(
|
||||
(msg) => tokenCount(msg.content) + 4
|
||||
|
||||
Reference in New Issue
Block a user