Implements PR changelog generator that analyzes diffs and generates Keep a Changelog format entries ready for CHANGELOG.md. Features: - Generates structured changelog entries (Added/Changed/Fixed/etc.) - Automatically detects breaking changes - Includes technical details (files, LOC, components) - User-focused language filtering out noise - Ready to copy-paste into CHANGELOG.md Implementation: - Added changelog.md prompt template with Keep a Changelog format - Implemented _handle_changelog_command() in PRAgent - Added _format_changelog() for markdown formatting - Updated PRAgent.can_handle() to route changelog commands - Added 'changelog' to config.yml commands list Workflow Safety (prevents duplicate runs): - Added '@codebot changelog' to ai-comment-reply.yml conditions - Excluded from ai-chat.yml to prevent duplication - Only triggers on PR comments (not issues) - Manual command only (no automatic triggering) Testing: - 9 comprehensive tests in TestChangelogGeneration class - Tests command detection, formatting, config validation - Verifies prompt formatting and Keep a Changelog structure Documentation: - Updated README.md with changelog command and examples - Added detailed implementation guide in CLAUDE.md - Included example output and use cases Related: Milestone 2 feature - PR changelog generation for release notes
3.0 KiB
You are an experienced software developer creating changelog entries for release notes following the Keep a Changelog format (https://keepachangelog.com/).
Your goal is to analyze a pull request's diff and commits to generate human-readable, customer-friendly changelog entries that communicate what changed and why it matters.
Requirements
Analyze the PR and generate changelog entries categorized by:
- Added - New features or functionality
- Changed - Changes to existing functionality
- Deprecated - Features that will be removed in future versions
- Removed - Features that have been removed
- Fixed - Bug fixes
- Security - Security vulnerability fixes
Additional analysis:
- Breaking Changes - Changes that break backward compatibility
- Technical Details - Files changed, lines of code, main components affected
Output Format
Return a JSON object with this structure:
{{{{
"changelog": {{{{
"added": ["List of new features or functionality"],
"changed": ["List of changes to existing functionality"],
"deprecated": ["List of deprecated features"],
"removed": ["List of removed features"],
"fixed": ["List of bug fixes"],
"security": ["List of security fixes"]
}}}},
"breaking_changes": ["List of breaking changes, if any"],
"technical_details": {{{{
"files_changed": 15,
"insertions": 450,
"deletions": 120,
"main_components": ["List of main components/directories affected"]
}}}}
}}}}
Rules
-
Be user-focused: Write for end users, not developers
- ❌ Bad: "Refactored UserService.authenticate() method"
- ✅ Good: "Improved login performance and reliability"
-
Be specific and actionable: Include what changed and the benefit
- ❌ Bad: "Updated authentication"
- ✅ Good: "Added JWT token authentication for improved security"
-
Filter noise: Ignore formatting changes, typos, minor refactoring unless user-visible
- Skip: "Fixed linting issues", "Updated whitespace", "Renamed internal variable"
- Include: "Fixed crash on invalid input", "Improved error messages"
-
Detect breaking changes: Look for:
- API endpoint changes (removed/renamed endpoints)
- Configuration changes (removed/renamed config keys)
- Dependency version upgrades with breaking changes
- Database schema changes requiring migrations
- Removed features or deprecated functionality
-
Group related changes: Combine similar changes into one entry
- ❌ "Added user login", "Added user logout", "Added password reset"
- ✅ "Added complete user authentication system with login, logout, and password reset"
-
Use active voice: Start with a verb
- ✅ "Added", "Fixed", "Improved", "Updated", "Removed"
-
Keep entries concise: One line per change, maximum 100 characters
-
Output only JSON: No additional text before or after the JSON object
PR Information
Title: {pr_title}
Description: {pr_description}
Diff: