120 lines
4 KiB
Markdown
120 lines
4 KiB
Markdown
# Changelog Generator Tool
|
|
|
|
This project provides an AI-powered tool that automates the generation of changelogs by collecting information from Git logs and Redmine tickets. It uses a crew of AI agents to improve the quality and efficiency of the final changelog.
|
|
|
|
## Project Overview
|
|
|
|
The system uses multiple AI agents, each responsible for a specific part of the changelog generation process. This tool is designed to:
|
|
|
|
- Gather data from Git logs and Redmine tickets.
|
|
- Analyze and categorize the collected information.
|
|
- Generate a well-formatted changelog or release notes.
|
|
- Ensure the output is consistent with project guidelines and requirements.
|
|
|
|
## Key Components
|
|
|
|
### Main Script (`main.py`)
|
|
|
|
The main entry point of the tool. It handles command-line arguments, sets up the environment, and initiates the changelog generation process.
|
|
|
|
### Crew Definition (`crew.py`)
|
|
|
|
Defines the AI agents and their tasks using the `crewai` framework. It includes:
|
|
|
|
- `GitlogAnalyst`: Analyzes Git commit logs.
|
|
- `RedmineAnalyst`: Retrieves and analyzes Redmine issues.
|
|
- `WritingAgent`: Generates the final changelog or release notes.
|
|
|
|
### Configuration
|
|
|
|
- `config/config.py`: Parses configuration settings.
|
|
- `config/agents.yaml`: Defines agent configurations.
|
|
- `config/tasks.yaml`: Defines task configurations.
|
|
|
|
### Tools
|
|
|
|
- `tools/tools.py`: Contains custom tools for retrieving Git commits and Redmine issues.
|
|
|
|
### Data
|
|
|
|
- `data/CodeOfConduct.md`: Contains the project's code of conduct (used for context).
|
|
- `data/template2.txt`: Changelog template used by the writing agent.
|
|
|
|
## Usage
|
|
|
|
1. **Environment Setup for development**:
|
|
|
|
- This project uses Devbox for development environment management and Poetry for dependency management.
|
|
- Set up the environment using:
|
|
```
|
|
devbox shell
|
|
poetry install
|
|
```
|
|
|
|
2. **Running the Tool**:
|
|
|
|
- The tool is started using a shell script that manages Docker containers.
|
|
- Basic usage:
|
|
```
|
|
./create_changelog.sh [options]
|
|
```
|
|
- Options:
|
|
- `--project`: Specify the Redmine project ID
|
|
- `--version`: Specify the version ID
|
|
- `--repo`: Path to the Git repository (optional)
|
|
- `--type`: Type of output (Changelog/ReleaseNotes)
|
|
- `--local`: Use local LLM instead of OpenAI (optional)
|
|
- If an error occurs that the docker volume ollama-local cannot be found, create it with `docker volume create ollama-local`
|
|
3. **Example Usage**:
|
|
|
|
```bash
|
|
./create_changelog.sh -projects 123 -versions 456 -type Changelog -repo /path/to/repo
|
|
```
|
|
|
|
## Dependencies
|
|
|
|
- Python 3.x
|
|
- Poetry for dependency management
|
|
- Devbox for development environment
|
|
- Docker for running LLM services
|
|
- External services:
|
|
- Redmine API
|
|
- Git repository
|
|
- OpenAI API (optional)
|
|
- Local LLM (optional, e.g., Ollama)
|
|
|
|
## Configuration
|
|
|
|
The project uses a TOML configuration file named changelog-config.toml for storing essential settings. This file should contain the following entries:
|
|
|
|
```toml
|
|
[DEFAULT]
|
|
OPENAI_API_KEY = your_openai_api_key_here
|
|
REDMINE_API_KEY = your_redmine_api_key_here
|
|
REDMINE_HOST = https://your_redmine_host.com
|
|
GIT_REPO_PATH = /path/to/your/git/repo
|
|
```
|
|
|
|
### Configuration File Location
|
|
|
|
The config.py script searches for the changelog-config.toml file in the following locations, in order:
|
|
|
|
- Current working directory
|
|
- changelog2 subdirectory of the current working directory
|
|
- '.config' subdirectory of the current working directory
|
|
- User's home directory
|
|
- Location specified by the CHANGELOG_CONFIG environment variable
|
|
|
|
Make sure to create the changelog-config.toml file with your actual API keys and settings before running the tool. Keep this file secure and do not commit it to version control.
|
|
|
|
However, a copy of changelog-config.toml should be located in the changelog2 subfolder for execution in the docker container.
|
|
|
|
## Development
|
|
|
|
- To add new dependencies: `poetry add <package_name>`
|
|
- To update dependencies: `poetry update`
|
|
|
|
## Notes
|
|
|
|
- The tool can use either OpenAI's models or a local LLM (like Ollama) for text generation.
|
|
- Ensure all necessary Docker containers are running before starting the tool.
|