diffscribe
is an intelligent CLI tool designed to automatically generate meaningful commit messages using Git diffstat, status, and insights from OpenAI and you.
Please note that this project is in its beta version and may undergo significant changes.
- Smart Analysis: Evaluates Git status and Git diffstat to identify essential changes.
- Security: Your code stays with you – no sharing with OpenAI.
- User Interaction: Engages with you to refine its interpretations.
- OpenAI Power: Uses the OpenAI API to create concise, descriptive commit messages.
- Customizable: Offers customization options like model type, temperature, and commit message length.
- Node.js
>=18.17.0
- Git
>=2
- An OpenAI API key. You can get one here
.env
file withOPENAI_API_KEY
set to your OpenAI API key.
You can install the tool locally or globally.
npm i -g diffscribe
# or for local usage
npm i -D diffscribe
The package has peer dependencies on openai
to use the OpenAI API and dotenv
to load the .env
file.
npm i -g openai dotenv
# or for local usage
npm i -D openai dotenv
- Make sure you have staged your changes in Git (
git add .
). - Run
diffscribe
:
npx diffscribe [--model=<model_name>] [--modelTemperature=<temperature_value>] [--commitLength=<length>]
--model
: The OpenAI model to use. Supported models aregpt-4
andgpt-3.5-turbo
. The default isgpt-4
.--modelTemperature
: The temperature setting for the OpenAI model. The default is0.05
. Use it to control the randomness of the generated commit message. It should be between0
and2
.--commitLength
: The maximum length of the generated commit message. It should be between 50 and 500 characters. The default is50
. It is not an actual limit but rather a guideline to the model.
npx diffscribe
It seems like you've made a lot of changes, including adding a new package 'diffscribe', modifying several package.json files, and updating documentation. Could you please clarify what you're trying to achieve with this commit?
Answer: I added a new package named `diffscribe`. Rewrite readme and improve documentation for all public packages. Rewrite TSDoc in `@neshca/json-replacer-reviver` package
Based on the information provided, the commit message could be: "Add diffscribe package and improve documentation".
What happened behind the scenes:
diffscribe
will rungit status --renames
andgit diff --cached --stat
to get the branch name, list of changed files, and the number of changes in each file. It does not look inside the files.- This information is sent to OpenAI's API, along with the context and guidelines for the GPT model.
- GPT will try to understand the changes and prompt the user to confirm its understanding.
- GPT will generate a commit message if the user confirms the understanding.
- Ensure you have the
.env
file in the same directory from which you are runningdiffscribe
. - If you encounter errors related to model selection, temperature, or commit length, please check the passed arguments for validity.