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