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?
First, set an environment variable for your OpenAI key in your ~/.bash_profile
or ~/.zprofile
:
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:
# execute:
$ npx @dobuki/autocommit
Your files will be commmitted, with a comment generated by OpenAI:
Example:
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:
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.