Compare commits

..

4 Commits

Author SHA1 Message Date
di-sukharev
c30474b473 chore(README.md): update setup instructions for OpenCommit as a GitHub Action
fix(commit.ts): check if OCO_MESSAGE_TEMPLATE_PLACEHOLDER exists before replacing it in the commit message template
The README.md file has been updated to reflect the changes in the setup instructions for using OpenCommit as a GitHub Action. The new instructions provide a file template for the GitHub Action workflow and include the latest version of the OpenCommit GitHub Action.

In the commit.ts file, a fix has been made to check if the OCO_MESSAGE_TEMPLATE_PLACEHOLDER exists before replacing it in the commit message template. This ensures that the replacement is only performed when the placeholder is present, preventing any potential errors.
2023-09-03 14:56:57 +08:00
di-sukharev
c986512e73 formatting 2023-09-03 14:39:15 +08:00
di-sukharev
49f109be24 build 2023-09-03 14:39:05 +08:00
di-sukharev
41a88eefff improve text 2023-09-03 14:39:01 +08:00
6 changed files with 10 additions and 24 deletions

View File

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

View File

@@ -1 +0,0 @@
out

View File

@@ -326,8 +326,4 @@ Interactive rebase (`rebase -i`) changes commits' SHA, so the commit history in
## Payments
You pay for your requests to OpenAI API on your own.
OpenCommit stores your key locally.
OpenCommit by default uses ChatGPT (3.5-turbo-16k) official model, which is a lot cheaper than gpt-4.
You pay for your requests to OpenAI API. OpenCommit uses ChatGPT (3.5-turbo) official model, which is ~15x times cheaper than GPT-4.

View File

@@ -22312,7 +22312,7 @@ var generateCommitMessageFromGitDiff = async (diff, extraArgs2) => {
try {
let commitMessage = await generateCommitMessageByDiff(diff);
const messageTemplate = checkMessageTemplate(extraArgs2);
if (config7?.OCO_MESSAGE_TEMPLATE_PLACEHOLDER && typeof messageTemplate === "string") {
if (typeof messageTemplate === "string") {
commitMessage = messageTemplate.replace(
config7?.OCO_MESSAGE_TEMPLATE_PLACEHOLDER,
commitMessage

View File

@@ -1,6 +1,6 @@
{
"name": "opencommit",
"version": "3.0.0",
"version": "2.4.2",
"description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
"keywords": [
"git",
@@ -26,8 +26,7 @@
"author": "https://github.com/di-sukharev",
"license": "MIT",
"files": [
"out/cli.cjs",
"out/tiktoken_bg.wasm"
"out/**/*"
],
"release": {
"branches": [
@@ -43,7 +42,7 @@
"dev": "ts-node ./src/cli.ts",
"build": "rimraf out && node esbuild.config.js",
"build:push": "npm run build && git add . && git commit -m 'build' && git push",
"deploy": "npm run build:push && npm version patch && git push --tags && npm publish --tag latest",
"deploy": "npm run build:push && npm version patch && git push --tags && git push && npm publish --tag latest",
"lint": "eslint src --ext ts && tsc --noEmit",
"format": "prettier --write src"
},

View File

@@ -20,18 +20,11 @@ export const IDENTITY =
const INIT_MAIN_PROMPT = (language: string): ChatCompletionRequestMessage => ({
role: ChatCompletionRequestMessageRoleEnum.System,
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.`
// 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.`
});
export const INIT_DIFF_PROMPT: ChatCompletionRequestMessage = {