set conventional commits to be defaulted to false

This commit is contained in:
Hassan El Mghari
2023-02-13 11:16:27 -05:00
parent a170430134
commit ac8dcb344c
2 changed files with 7 additions and 9 deletions

View File

@@ -17,14 +17,10 @@ Have AI Commit write your git commit messages for you so you never have to write
This project uses a command line interface tool called zx that's developed by google. In the script, it runs a `git diff` command to grab all the latest changes, sends this to OpenAI's GPT-3, then returns the AI generated commit message. Video coming soon where I rebuild it from scratch to show you how to easily build your own CLI tools powered by AI. Fully privacy friendly as commands only run on your local machine using your OpenAI account. This project uses a command line interface tool called zx that's developed by google. In the script, it runs a `git diff` command to grab all the latest changes, sends this to OpenAI's GPT-3, then returns the AI generated commit message. Video coming soon where I rebuild it from scratch to show you how to easily build your own CLI tools powered by AI. Fully privacy friendly as commands only run on your local machine using your OpenAI account.
Uses conventional commits by default. If you don't want this and want to return a full sentence with the commit message, set the conventionalCommit to false at the top of the script. This CLI also supports conventional commits. If you want conventional commits, simply set the `conventionalCommit` variable at the top of the script to `true`.
## Remaining tasks ## Remaining tasks
- [x] Get a working first version with zx
- [x] pwd trick to get rid of /Users/hassan from the code
- [x] Add better error handling for missing git add . and commit msgs about a certain amount of chars
- [x] Add support for conventional commits by default
- [ ] Figure out how to fail gracefully instead of exit 1 - [ ] Figure out how to fail gracefully instead of exit 1
- [ ] Go over other CLI repos to see what I can add - [ ] Go over other CLI repos to see what I can add
- [ ] Test on Windows and Mac - [ ] Test on Windows and Mac

View File

@@ -3,7 +3,7 @@ $.verbose = false;
// TODO: Figure out how to fail gracefully instead of exit 1 // TODO: Figure out how to fail gracefully instead of exit 1
let conventionalCommit = true; let conventionalCommit = false;
console.log(chalk.white("▲ ") + chalk.green("Welcome to AICommit!")); console.log(chalk.white("▲ ") + chalk.green("Welcome to AICommit!"));
@@ -31,9 +31,11 @@ if (diff.stdout.length === 0) {
// limit of 4k tokens = 8k characters // limit of 4k tokens = 8k characters
// 200 lines of code // 200 lines of code
let prompt = `I want you to act like a git commit message writer. I will input a git diff and your job is to convert it into a useful commit message${ let prompt = `I want you to act like a git commit message writer. I will input a git diff and your job is to convert it into a useful commit message. ${
conventionalCommit ? " in the style of conventional commits." : "." conventionalCommit
} Preface the commit with 'feat:' if it is a feature or 'fix:' if it is a bug, return a complete sentence, and do not repeat yourself: ${diff}`; ? "Preface the commit with 'feat:' if it is a feature or 'fix:' if it is a bug."
: "Do not preface the commit with anything."
} Return a complete sentence and do not repeat yourself: ${diff}`;
const payload = { const payload = {
model: "text-davinci-003", model: "text-davinci-003",