https://github.com/jacklehamster/autocommit
Bash script hooked up with npm for auto-committing changes into git.
https://github.com/jacklehamster/autocommit
ai commit-message github openai
Last synced: about 2 months ago
JSON representation
Bash script hooked up with npm for auto-committing changes into git.
- Host: GitHub
- URL: https://github.com/jacklehamster/autocommit
- Owner: jacklehamster
- License: mit
- Created: 2024-01-30T01:51:52.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T06:28:49.000Z (about 1 year ago)
- Last Synced: 2024-12-27T16:13:38.758Z (12 months ago)
- Topics: ai, commit-message, github, openai
- Language: JavaScript
- Homepage:
- Size: 129 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# autocommit
[](https://www.npmjs.com/package/@dobuki/autocommit) [](https://github.com/jacklehamster/autocommit) [](https://github.com/jacklehamster/autocommit)

## description
This is the ultimate command for lazy developers who can't be bothered writing a description of their commits.
This will commit your files, with a commented generated by OpenAI, trying to best understand what you did based on your diff.
At the end, the AI adds a lame joke to your commit, because hey... why not?
## usage
First, set an environment variable for your OpenAI key in your `~/.bash_profile` or `~/.zprofile`:
```bash
export OPENAI_API_KEY=sk-?????????
export OPENAI_ORGANIZATION=org-??? # Your organization (optional)
export OPENAI_PROJECT_AI_COMMIT=proj_??? # Your project (optional)
```
Then execute the NPX command:
```bash
# execute:
$ npx @dobuki/autocommit
```
Your files will be commmitted, with a comment generated by OpenAI:
*Example:*
```text
Refactored the OpenAI integration to handle cases where the API key is not provided.
- Replaced the condition of `process.env.OPENAI_API_KEY` with `process.env.OPENAI_API_KEY?.length` to check if the API key has a length before creating a new OpenAI instance.
Files:
M README.md
M src/open-ai.js
Committed using auto-commit: Sun Jun 09 2024 23:41:27 GMT-0700 (Pacific Daylight Time)
Autocommit project: https://www.npmjs.com/package/@dobuki/autocommit
All the lame jokes were generated by AI.
```
Note: If you don't have an OpenAI key, it will just skip the descriptive comment and write something simple like:
```text
Files:
M src/auto-commit.js
Committed using auto-commit: Sun Jun 09 2024 01:00:35 GMT-0700 (Pacific Daylight Time)
Autocommit project: https://www.npmjs.com/package/@dobuki/autocommit
All the lame jokes were generated by AI.
```