mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-13 07:38:01 -05:00
Compare commits
10 Commits
v3.0.3
...
refactorin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c30474b473 | ||
|
|
c986512e73 | ||
|
|
49f109be24 | ||
|
|
41a88eefff | ||
|
|
765e9884dd | ||
|
|
ea9411fa69 | ||
|
|
12956d7633 | ||
|
|
c1627bb98c | ||
|
|
4e374aa9db | ||
|
|
ef003bdad6 |
@@ -1 +0,0 @@
|
||||
out/github-action.cjs
|
||||
@@ -1 +0,0 @@
|
||||
out
|
||||
@@ -29,8 +29,6 @@ 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:
|
||||
@@ -328,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.
|
||||
|
||||
15
out/cli.cjs
15
out/cli.cjs
@@ -16384,7 +16384,7 @@ function G3(t, e2) {
|
||||
// package.json
|
||||
var package_default = {
|
||||
name: "opencommit",
|
||||
version: "3.0.3",
|
||||
version: "2.4.2",
|
||||
description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
||||
keywords: [
|
||||
"git",
|
||||
@@ -16410,8 +16410,7 @@ var package_default = {
|
||||
author: "https://github.com/di-sukharev",
|
||||
license: "MIT",
|
||||
files: [
|
||||
"out/cli.cjs",
|
||||
"out/tiktoken_bg.wasm"
|
||||
"out/**/*"
|
||||
],
|
||||
release: {
|
||||
branches: [
|
||||
@@ -16427,7 +16426,7 @@ var package_default = {
|
||||
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 --follow-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"
|
||||
},
|
||||
@@ -21907,7 +21906,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.cwd(),
|
||||
process.env.PWD,
|
||||
"node_modules",
|
||||
"@commitlint",
|
||||
"load"
|
||||
@@ -21998,10 +21997,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 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.
|
||||
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.
|
||||
${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} for the commit message.`
|
||||
Use the present tense. Lines must not be longer than 74 characters. Use ${language} to answer.`
|
||||
});
|
||||
var INIT_DIFF_PROMPT = {
|
||||
role: import_openai3.ChatCompletionRequestMessageRoleEnum.User,
|
||||
@@ -22313,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
|
||||
|
||||
@@ -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.cwd(),
|
||||
process.env.PWD,
|
||||
"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 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.
|
||||
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.
|
||||
${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} for the commit message.`
|
||||
Use the present tense. Lines must not be longer than 74 characters. Use ${language} to answer.`
|
||||
});
|
||||
var INIT_DIFF_PROMPT = {
|
||||
role: import_openai3.ChatCompletionRequestMessageRoleEnum.User,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "opencommit",
|
||||
"version": "3.0.3",
|
||||
"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 --follow-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"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import path from 'path';
|
||||
|
||||
const nodeModulesPath = path.join(
|
||||
process.env.PWD || process.cwd(),
|
||||
process.env.PWD as string,
|
||||
'node_modules',
|
||||
'@commitlint',
|
||||
'load'
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user