GPT Changelog is a powerful tool that automatically generates high-quality changelogs using OpenAI's advanced language models. By analyzing commit messages since the most recent tag, GPT Changelog creates a well-structured, markdown-formatted changelog and seamlessly integrates it into your CHANGELOG.md
file.
- Fast and Efficient: Quickly generates changelogs by leveraging OpenAI's GPT models.
- High Quality: Produces clear, concise, and informative changelogs to keep your project documentation up-to-date.
- Seamless Integration: Automatically prepends the generated changelog to your existing
CHANGELOG.md
file or creates one if it doesn't exist. - Customizable: Supports configuration of the OpenAI model and context token limits.
- Semantic Versioning: Determines the next version number based on semantic versioning principles.
- Python 3.6 or higher: Ensure that Python is installed on your system.
- OpenAI API Key: You need an OpenAI API key to use this tool. Sign up at OpenAI to obtain one.
Install GPT Changelog via pip:
pip install gptchangelog
Before using GPT Changelog, you need to configure your OpenAI API key and settings. You can initialize the configuration using the built-in command:
gptchangelog config init
This command will guide you through setting up your configuration file, where you can specify your OpenAI API key, the model to use, and other settings.
By default, the configuration file is created in one of the following locations:
- Global Configuration:
$HOME/.config/gptchangelog/config.ini
- Project Configuration:
./.gptchangelog/config.ini
Alternatively, you can manually create a configuration file named config.ini
with the following content:
[openai]
api_key = your_openai_api_key_here
model = gpt-4
max_context_tokens = 8000
- Replace
your_openai_api_key_here
with your actual OpenAI API key. - Set the
model
parameter to the desired OpenAI model (e.g.,gpt-4
orgpt-3.5-turbo
). - Optionally adjust
max_context_tokens
based on your model's token limit.
Navigate to your Git repository directory and run:
gptchangelog
This command will:
- Fetch commit messages since the most recent tag or specified commit.
- Refine commit messages for clarity and conciseness.
- Determine the next version number based on semantic versioning.
- Generate a changelog using the specified OpenAI model.
- Prepend the generated changelog to the
CHANGELOG.md
file. If the file doesn't exist, it will create one.
--since <commit>
: Specify the commit hash or tag to start fetching commit messages from. If not provided, it uses the most recent tag.
Example:
gptchangelog --since v1.2.3
gptchangelog config init
: Initialize the configuration file.gptchangelog config show
: Display the current configuration.
Here's how to use GPT Changelog:
cd /path/to/your/repo
gptchangelog
Within seconds, your CHANGELOG.md
will be updated with the latest changes, keeping your project documentation current and professional.
## [1.3.0] - 2023-10-18
### Added
- Implemented user authentication feature.
### Fixed
- Resolved bug in the payment processing module.
### Changed
- Updated the API documentation for clarity.
### Removed
- Deprecated endpoints removed from the API.
GPT Changelog uses customizable templates for prompts. You can modify the templates located in the templates
directory within the gptchangelog
package to tailor the prompts to your needs.
- commits_prompt.txt: Template for refining commit messages.
- version_prompt.txt: Template for determining the next version number.
- changelog_prompt.txt: Template for generating the changelog.
gptchangelog/
├── __init__.py
├── main.py
├── config.py
├── git_utils.py
├── openai_utils.py
├── utils.py
└── templates/
├── commits_prompt.txt
├── version_prompt.txt
└── changelog_prompt.txt
- main.py: Entry point of the application.
- config.py: Handles configuration management.
- git_utils.py: Contains Git-related utility functions.
- openai_utils.py: Manages interactions with the OpenAI API.
- utils.py: Contains shared utility functions.
- templates/: Contains prompt templates used by the application.
Contributions are welcome! If you'd like to contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with clear messages.
- Submit a pull request to the
main
branch.
Please ensure that your code adheres to the project's coding standards and passes all tests.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or support, please open an issue on the GitHub repository.