Compare commits

...

2 Commits

Author SHA1 Message Date
Sukharev
c76313737d #247: fix (#248) 2023-09-05 13:45:34 +08:00
di-sukharev
ac8c87be9e docs(README.md): add note about MacOS potentially requiring 'sudo' when installing package globally
The README.md file now includes a note that MacOS may prompt the user to run the 'npm install -g opencommit' command with 'sudo' when installing the package globally. This note is added to provide clarity and help users who encounter this situation.
2023-09-03 15:22:47 +08:00
7 changed files with 26 additions and 14 deletions

1
.npmignore Normal file
View File

@@ -0,0 +1 @@
out/github-action.cjs

View File

@@ -29,6 +29,8 @@ You can use OpenCommit by simply running it via the CLI like this `oco`. 2 secon
npm install -g opencommit
```
MacOS may ask to run the command with `sudo` when installing a package globally.
2. Get your API key from [OpenAI](https://platform.openai.com/account/api-keys). Make sure that you add your payment details, so the API works.
3. Set the key to OpenCommit config:

View File

@@ -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,

View File

@@ -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,

View File

@@ -26,7 +26,8 @@
"author": "https://github.com/di-sukharev",
"license": "MIT",
"files": [
"out/**/*"
"out/cli.cjs",
"out/tiktoken_bg.wasm"
],
"release": {
"branches": [

View File

@@ -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'

View File

@@ -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 = {