From c76313737d46e10490284bff4456357c482ad27e Mon Sep 17 00:00:00 2001 From: Sukharev <57486732+di-sukharev@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:45:34 +0800 Subject: [PATCH 1/4] #247: fix (#248) --- .npmignore | 1 + out/cli.cjs | 9 +++++---- out/github-action.cjs | 6 +++--- package.json | 3 ++- src/modules/commitlint/pwd-commitlint.ts | 2 +- src/prompts.ts | 17 ++++++++++++----- 6 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..715ed92 --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +out/github-action.cjs \ No newline at end of file diff --git a/out/cli.cjs b/out/cli.cjs index bc10973..eaac647 100755 --- a/out/cli.cjs +++ b/out/cli.cjs @@ -16410,7 +16410,8 @@ var package_default = { author: "https://github.com/di-sukharev", license: "MIT", files: [ - "out/**/*" + "out/cli.cjs", + "out/tiktoken_bg.wasm" ], release: { branches: [ @@ -21906,7 +21907,7 @@ var commitlintPrompts = { // src/modules/commitlint/pwd-commitlint.ts var import_path2 = __toESM(require("path"), 1); var nodeModulesPath = import_path2.default.join( - process.env.PWD, + process.env.PWD || process.cwd(), "node_modules", "@commitlint", "load" @@ -21997,10 +21998,10 @@ var translation3 = i18n[config5?.OCO_LANGUAGE || "en"]; var IDENTITY = "You are to act as the author of a commit message in git."; var INIT_MAIN_PROMPT2 = (language) => ({ role: import_openai3.ChatCompletionRequestMessageRoleEnum.System, - content: `${IDENTITY} Your mission is to create clean and comprehensive commit messages in the conventional commit convention and explain WHAT were the changes and WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message. + content: `${IDENTITY} Your mission is to create clean and comprehensive commit messages as per the conventional commit convention and explain WHAT were the changes and mainly WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you are to convert it into a commit message. ${config5?.OCO_EMOJI ? "Use GitMoji convention to preface the commit." : "Do not preface the commit with anything."} ${config5?.OCO_DESCRIPTION ? `Add a short description of WHY the changes are done after the commit message. Don't start it with "This commit", just describe the changes.` : "Don't add any descriptions to the commit, only commit message."} - Use the present tense. Lines must not be longer than 74 characters. Use ${language} to answer.` + Use the present tense. Lines must not be longer than 74 characters. Use ${language} for the commit message.` }); var INIT_DIFF_PROMPT = { role: import_openai3.ChatCompletionRequestMessageRoleEnum.User, diff --git a/out/github-action.cjs b/out/github-action.cjs index e188681..3db6a5d 100644 --- a/out/github-action.cjs +++ b/out/github-action.cjs @@ -28320,7 +28320,7 @@ var commitlintPrompts = { // src/modules/commitlint/pwd-commitlint.ts var import_path2 = __toESM(require("path"), 1); var nodeModulesPath = import_path2.default.join( - process.env.PWD, + process.env.PWD || process.cwd(), "node_modules", "@commitlint", "load" @@ -28411,10 +28411,10 @@ var translation3 = i18n[config5?.OCO_LANGUAGE || "en"]; var IDENTITY = "You are to act as the author of a commit message in git."; var INIT_MAIN_PROMPT2 = (language) => ({ role: import_openai3.ChatCompletionRequestMessageRoleEnum.System, - content: `${IDENTITY} Your mission is to create clean and comprehensive commit messages in the conventional commit convention and explain WHAT were the changes and WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message. + content: `${IDENTITY} Your mission is to create clean and comprehensive commit messages as per the conventional commit convention and explain WHAT were the changes and mainly WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you are to convert it into a commit message. ${config5?.OCO_EMOJI ? "Use GitMoji convention to preface the commit." : "Do not preface the commit with anything."} ${config5?.OCO_DESCRIPTION ? `Add a short description of WHY the changes are done after the commit message. Don't start it with "This commit", just describe the changes.` : "Don't add any descriptions to the commit, only commit message."} - Use the present tense. Lines must not be longer than 74 characters. Use ${language} to answer.` + Use the present tense. Lines must not be longer than 74 characters. Use ${language} for the commit message.` }); var INIT_DIFF_PROMPT = { role: import_openai3.ChatCompletionRequestMessageRoleEnum.User, diff --git a/package.json b/package.json index 1e11381..9be5ca2 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "author": "https://github.com/di-sukharev", "license": "MIT", "files": [ - "out/**/*" + "out/cli.cjs", + "out/tiktoken_bg.wasm" ], "release": { "branches": [ diff --git a/src/modules/commitlint/pwd-commitlint.ts b/src/modules/commitlint/pwd-commitlint.ts index 9c504d9..00c4807 100644 --- a/src/modules/commitlint/pwd-commitlint.ts +++ b/src/modules/commitlint/pwd-commitlint.ts @@ -1,7 +1,7 @@ import path from 'path'; const nodeModulesPath = path.join( - process.env.PWD as string, + process.env.PWD || process.cwd(), 'node_modules', '@commitlint', 'load' diff --git a/src/prompts.ts b/src/prompts.ts index 9497751..243ee86 100644 --- a/src/prompts.ts +++ b/src/prompts.ts @@ -20,11 +20,18 @@ export const IDENTITY = const INIT_MAIN_PROMPT = (language: string): ChatCompletionRequestMessage => ({ role: ChatCompletionRequestMessageRoleEnum.System, - // prettier-ignore - content: `${IDENTITY} Your mission is to create clean and comprehensive commit messages in the conventional commit convention and explain WHAT were the changes and WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message. - ${config?.OCO_EMOJI ? 'Use GitMoji convention to preface the commit.' : 'Do not preface the commit with anything.'} - ${config?.OCO_DESCRIPTION ? 'Add a short description of WHY the changes are done after the commit message. Don\'t start it with "This commit", just describe the changes.' : "Don't add any descriptions to the commit, only commit message."} - Use the present tense. Lines must not be longer than 74 characters. Use ${language} to answer.` + content: `${IDENTITY} Your mission is to create clean and comprehensive commit messages as per the conventional commit convention and explain WHAT were the changes and mainly WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you are to convert it into a commit message. + ${ + config?.OCO_EMOJI + ? 'Use GitMoji convention to preface the commit.' + : 'Do not preface the commit with anything.' + } + ${ + config?.OCO_DESCRIPTION + ? 'Add a short description of WHY the changes are done after the commit message. Don\'t start it with "This commit", just describe the changes.' + : "Don't add any descriptions to the commit, only commit message." + } + Use the present tense. Lines must not be longer than 74 characters. Use ${language} for the commit message.` }); export const INIT_DIFF_PROMPT: ChatCompletionRequestMessage = { From 75f0cd47b8661d82bd70e28796e489488e29af7f Mon Sep 17 00:00:00 2001 From: di-sukharev Date: Tue, 5 Sep 2023 13:48:09 +0800 Subject: [PATCH 2/4] chore(package.json): update version to 3.0.1 The version in package.json has been updated from 3.0.0 to 3.0.1. This change is made to reflect the new version of the project. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9be5ca2..3847a1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencommit", - "version": "3.0.0", + "version": "3.0.1", "description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫", "keywords": [ "git", From 40297e0c6a348f78d8f13b8ebf3091b81a73df85 Mon Sep 17 00:00:00 2001 From: di-sukharev Date: Tue, 5 Sep 2023 13:49:17 +0800 Subject: [PATCH 3/4] chore(package.json): update version to 3.0.2 The version in package.json has been updated from 3.0.1 to 3.0.2. This change is made to reflect the latest version of the project. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3847a1a..b65bc29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencommit", - "version": "3.0.1", + "version": "3.0.2", "description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫", "keywords": [ "git", From 2d48648f525fded95e378f785bb28d111f9eaec1 Mon Sep 17 00:00:00 2001 From: di-sukharev Date: Tue, 5 Sep 2023 13:51:21 +0800 Subject: [PATCH 4/4] chore(package.json): update version to 3.0.3 The version in package.json has been updated from 3.0.2 to 3.0.3. This change is made to reflect the latest version of the project. --- out/cli.cjs | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/out/cli.cjs b/out/cli.cjs index eaac647..088df98 100755 --- a/out/cli.cjs +++ b/out/cli.cjs @@ -16384,7 +16384,7 @@ function G3(t, e2) { // package.json var package_default = { name: "opencommit", - version: "3.0.0", + version: "3.0.3", description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}", keywords: [ "git", diff --git a/package.json b/package.json index b65bc29..72a4122 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencommit", - "version": "3.0.2", + "version": "3.0.3", "description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫", "keywords": [ "git",