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] #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 = {