a55661b7cc1e28b0be5f812d1cf5f45e9ff4e5de
Add necessary files to enable AI commit feature - .example.env, .gitignore, README.md, aicommit.mjs.
AI Commit
Have AI Commit write your git commit messages for you so you never have to write a commit message again.
How to install
- Run
npm i -g zx(this CLI uses zx) - Run
git clone github.com/nutlope/aicommitin your root directory - Add a file called
.env.jsonin the folder with your OpenAI API key. You can get this by signing up - [Optional] If you're on mac, add
alias aicommit="zx ~/ai-commit/aicommit.mjs"to your.zshrcso you can trigger the program simply by typingaicommit
Note: The process to install this will get vastly simplified when I rewrite this CLI and publish it as an npm package to be run with npx.
How it works
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.
Remaining tasks
- Get a working first version with zx
- pwd trick to get rid of /Users/hassan from the code
- Add better error handling for missing git add . and commit msgs about a certain amount of chars
- Try openai curie And/OR codex
- Try supporting more than 200 lines by grabbing the diff per file
- Add support for conventional commits
- Rewrite this CLI tool using a Node framework and publish on npm to simplify the process
- Build landing page w/ demo
Description
