Skip to content

matmulai/logchange

Repository files navigation

LogChange

GenAI Assisted Changelog Generation

LogChange is a powerful tool that automatically generates meaningful changelogs from your git commit history using OpenAI's language models. It analyzes commit diffs and messages to create clear, professional changelog entries in multiple formats.

Features

  • AI-Powered Summaries: Uses OpenAI GPT models to generate human-readable changelog entries
  • Multiple Output Formats: Export as Markdown, JSON, or CSV
  • Flexible Configuration: Customize the number of commits, AI model, and output format
  • Statistics: Optional statistics about contributors, date ranges, and commit counts
  • Progress Tracking: Verbose mode shows real-time processing progress
  • Easy Integration: Simple CLI interface with sensible defaults

Installation

From Source

# Clone the repository
git clone https://github.com/matmulai/logchange.git
cd logchange

# Install dependencies
pip install -r requirements.txt

# Install the package
pip install -e .

Requirements

  • Python 3.8 or higher
  • Git repository
  • OpenAI API key

Quick Start

  1. Set your OpenAI API key:

    export OPENAI_API_KEY=sk-your-key-here
  2. Generate a changelog:

    # Simple usage with defaults
    logchange
    
    # Or use the script directly
    python logchange.py
  3. Check the output:

    cat changelog.md

Usage

Basic Examples

# Generate markdown changelog with default settings (last 50 commits)
logchange

# Generate JSON changelog with statistics
logchange --format json --stats --output changelog.json

# Generate changelog for last 100 commits using GPT-4
logchange --max-commits 100 --model gpt-4 --verbose

# Generate CSV format for data analysis
logchange --format csv --output results.csv --stats

Command Line Options

--repo PATH           Path to git repository (default: current directory)
--output FILE         Output file path (default: changelog.md)
--max-commits N       Number of recent commits to include (default: 50)
--model MODEL         OpenAI model to use (default: gpt-4)
--format FORMAT       Output format: markdown, json, or csv (default: markdown)
--max-tokens N        Maximum tokens per summary (default: 300)
--verbose             Show progress information
--stats               Include statistics in output

Configuration

Environment Variables

  • OPENAI_API_KEY (required): Your OpenAI API key
  • OPENAI_MODEL (optional): Default model to use (e.g., gpt-4, gpt-3.5-turbo)

Using Different Models

# Use GPT-3.5 for faster, cheaper results
logchange --model gpt-3.5-turbo

# Use GPT-4 for higher quality summaries
logchange --model gpt-4

# Set default model via environment variable
export OPENAI_MODEL=gpt-3.5-turbo
logchange

Output Formats

Markdown (default)

Human-readable changelog suitable for README files and documentation.

logchange --format markdown

JSON

Structured data format for programmatic processing.

logchange --format json --output changelog.json

CSV

Tabular format suitable for data analysis and spreadsheets.

logchange --format csv --output changelog.csv

Additional Tools

LogChange includes several utility scripts in the scripts/ directory:

  • gen_commit_msg.py: Generate AI-powered commit messages for staged changes or existing commits
  • gen_changelog.py: Alternative changelog generation script
  • demo_commit_quality.py: Quality assessment tool for evaluating AI-generated commit messages
  • run_experiment.py: Experimental features and testing

See QUALITY_ASSESSMENT_GUIDE.md for detailed testing instructions.

Project Structure

logchange/
├── src/logchange/          # Main package
│   ├── cli.py              # Command-line interface
│   ├── ai_summarizer.py    # OpenAI integration
│   ├── git_utils.py        # Git repository operations
│   ├── formatters.py       # Output format handlers
│   ├── config.py           # Configuration management
│   └── statistics.py       # Statistics calculation
├── scripts/                # Utility scripts
├── logchange.py            # Entry point script
├── pyproject.toml          # Package configuration
└── requirements.txt        # Dependencies

Examples

Generate a changelog with statistics

logchange --max-commits 100 --stats --verbose

Output:

Fetching up to 100 commits from /path/to/repo...
Generating summaries using gpt-4...
Processing commit 100/100: a1b2c3d

Statistics:
  Total commits: 100
  Contributors: 5
  Date range: 2024-01-01 to 2024-11-12
  Model: gpt-4

✅ Changelog generated and saved to 'changelog.md'

Export changelog data as JSON

logchange --format json --max-commits 20 --output data.json

This creates a structured JSON file with commit information and AI-generated summaries.

Development

Running Tests

Refer to the QUALITY_ASSESSMENT_GUIDE.md for comprehensive testing instructions.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Links

About

GenAI Assisted Changelog Generation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages