feat: Add @codebot changelog command for Keep a Changelog format generation #25

Merged
Latte merged 1 commits from feature/pr-changelog-generator into dev 2025-12-29 11:53:58 +00:00
Owner

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

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
Latte added this to the Milestone 2: PR Workflow Enhancement milestone 2025-12-29 11:52:22 +00:00
Latte added 1 commit 2025-12-29 11:52:23 +00:00
feat: Add @codebot changelog command for Keep a Changelog format generation
All checks were successful
Enterprise AI Code Review / ai-review (pull_request) Successful in 41s
15beb0fb5b
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
Owner

📋 Pull Request Summary

This PR introduces a new @codebot changelog command that generates Keep a Changelog format entries from pull request diffs. It adds support for changelog generation in the AI review system, including prompt templates, command handling, formatting, and tests.

Type: Feature

Changes

Added:

  • New @codebot changelog command for generating changelog entries from PR diffs
  • Prompt template prompts/changelog.md for changelog generation
  • Changelog formatting method _format_changelog in PRAgent
  • Command handler _handle_changelog_command in PRAgent
  • Test suite for changelog generation in tests/test_ai_review.py
  • Configuration entry for changelog command in config.yml
  • Documentation updates in README.md and CLAUDE.md describing the changelog feature
  • Workflow updates to include changelog command in ai-comment-reply.yml and exclude from ai-chat.yml

📝 Modified:

  • PRAgent to recognize and handle the changelog command in PR comments
  • AI workflows to route changelog command correctly
  • Documentation files to mention and explain the new changelog command

Files Affected

  • 📝 .gitea/workflows/ai-chat.yml - Excluded @codebot changelog command from ai-chat workflow to prevent duplicate runs
  • 📝 .gitea/workflows/ai-comment-reply.yml - Added @codebot changelog command to ai-comment-reply workflow triggers
  • 📝 CLAUDE.md - Added detailed documentation for the changelog generation feature and command usage
  • 📝 README.md - Updated command list and usage examples to include the new @codebot changelog command
  • 📝 tests/test_ai_review.py - Added comprehensive tests covering changelog prompt existence, formatting, command handling, and output correctness
  • 📝 tools/ai-review/agents/pr_agent.py - Implemented changelog command handler and formatting logic in PRAgent
  • 📝 tools/ai-review/config.yml - Added changelog to the list of recognized interaction commands
  • tools/ai-review/prompts/changelog.md - New prompt template defining requirements and format for changelog generation

Impact

🟡 Scope: Medium
Introduces a new user-invoked feature that enhances release note generation by automating changelog creation from PR diffs. This affects PR comment handling and AI response workflows but does not alter existing functionality or APIs. It improves developer productivity and release documentation quality.

## 📋 Pull Request Summary This PR introduces a new `@codebot changelog` command that generates Keep a Changelog format entries from pull request diffs. It adds support for changelog generation in the AI review system, including prompt templates, command handling, formatting, and tests. **Type:** ✨ Feature ## Changes **✅ Added:** - New `@codebot changelog` command for generating changelog entries from PR diffs - Prompt template `prompts/changelog.md` for changelog generation - Changelog formatting method `_format_changelog` in PRAgent - Command handler `_handle_changelog_command` in PRAgent - Test suite for changelog generation in `tests/test_ai_review.py` - Configuration entry for `changelog` command in `config.yml` - Documentation updates in `README.md` and `CLAUDE.md` describing the changelog feature - Workflow updates to include `changelog` command in `ai-comment-reply.yml` and exclude from `ai-chat.yml` **📝 Modified:** - PRAgent to recognize and handle the `changelog` command in PR comments - AI workflows to route `changelog` command correctly - Documentation files to mention and explain the new changelog command ## Files Affected - 📝 `.gitea/workflows/ai-chat.yml` - Excluded `@codebot changelog` command from ai-chat workflow to prevent duplicate runs - 📝 `.gitea/workflows/ai-comment-reply.yml` - Added `@codebot changelog` command to ai-comment-reply workflow triggers - 📝 `CLAUDE.md` - Added detailed documentation for the changelog generation feature and command usage - 📝 `README.md` - Updated command list and usage examples to include the new `@codebot changelog` command - 📝 `tests/test_ai_review.py` - Added comprehensive tests covering changelog prompt existence, formatting, command handling, and output correctness - 📝 `tools/ai-review/agents/pr_agent.py` - Implemented changelog command handler and formatting logic in PRAgent - 📝 `tools/ai-review/config.yml` - Added `changelog` to the list of recognized interaction commands - ➕ `tools/ai-review/prompts/changelog.md` - New prompt template defining requirements and format for changelog generation ## Impact 🟡 **Scope:** Medium Introduces a new user-invoked feature that enhances release note generation by automating changelog creation from PR diffs. This affects PR comment handling and AI response workflows but does not alter existing functionality or APIs. It improves developer productivity and release documentation quality.
Bartender reviewed 2025-12-29 11:53:01 +00:00
Bartender left a comment
Owner

AI Code Review - Inline Comments

AI Code Review - Inline Comments
Owner

[LOW] Testing

The tests for changelog generation are comprehensive but do not include tests for error handling paths such as empty diffs or LLM failures.

Recommendation: Add tests that simulate empty diffs and LLM call failures to verify error handling and user feedback.

**[LOW] Testing** The tests for changelog generation are comprehensive but do not include tests for error handling paths such as empty diffs or LLM failures. **Recommendation:** Add tests that simulate empty diffs and LLM call failures to verify error handling and user feedback.
Owner

[LOW] Maintainability

The _handle_changelog_command method is quite long and could be split into smaller helper methods for clarity and easier testing.

Recommendation: Refactor _handle_changelog_command by extracting diff retrieval, prompt preparation, LLM call, and comment posting into separate private methods.

**[LOW] Maintainability** The _handle_changelog_command method is quite long and could be split into smaller helper methods for clarity and easier testing. **Recommendation:** Refactor _handle_changelog_command by extracting diff retrieval, prompt preparation, LLM call, and comment posting into separate private methods.
Owner

[LOW] Readability

The error message posted to the PR comment on failure is informative but could be improved by including a link to documentation or support resources.

Recommendation: Add a link or reference to troubleshooting docs or contact info in the error message to help users resolve issues.

**[LOW] Readability** The error message posted to the PR comment on failure is informative but could be improved by including a link to documentation or support resources. **Recommendation:** Add a link or reference to troubleshooting docs or contact info in the error message to help users resolve issues.
Owner

[LOW] Maintainability

The _format_changelog method manually appends lines to a list and joins them. This approach is clear but could be simplified or made more flexible using a templating engine or helper functions.

Recommendation: Consider using a markdown templating approach or helper functions to reduce boilerplate and improve maintainability.

**[LOW] Maintainability** The _format_changelog method manually appends lines to a list and joins them. This approach is clear but could be simplified or made more flexible using a templating engine or helper functions. **Recommendation:** Consider using a markdown templating approach or helper functions to reduce boilerplate and improve maintainability.
Owner

[LOW] Readability

The prompt is comprehensive and well-written but could benefit from a brief example snippet of expected JSON output at the top for immediate clarity.

Recommendation: Add a short example JSON snippet near the top of the prompt to help the LLM understand the expected output format quickly.

**[LOW] Readability** The prompt is comprehensive and well-written but could benefit from a brief example snippet of expected JSON output at the top for immediate clarity. **Recommendation:** Add a short example JSON snippet near the top of the prompt to help the LLM understand the expected output format quickly.
Owner

AI Code Review

This PR adds a new '@codebot changelog' command to generate Keep a Changelog format entries from PR diffs. It includes workflow updates, prompt template, command handling in the PR agent, formatting logic, documentation, and comprehensive tests. The implementation is well-structured, with clear separation of concerns and good test coverage. No security or correctness issues were found. Minor suggestions for maintainability and readability are noted.

Summary

Severity Count
HIGH 0
MEDIUM 0
LOW 5

Review Findings

  • [LOW] tools/ai-review/agents/pr_agent.py:1024 - The _handle_changelog_command method is quite long and could be split into smaller helper methods for clarity and easier testing.
  • [LOW] tools/ai-review/agents/pr_agent.py:1080 - The error message posted to the PR comment on failure is informative but could be improved by including a link to documentation or support resources.
  • [LOW] tools/ai-review/agents/pr_agent.py:1140 - The _format_changelog method manually appends lines to a list and joins them. This approach is clear but could be simplified or made more flexible using a templating engine or helper functions.
  • [LOW] tools/ai-review/prompts/changelog.md:1 - The prompt is comprehensive and well-written but could benefit from a brief example snippet of expected JSON output at the top for immediate clarity.
  • [LOW] tests/test_ai_review.py:830 - The tests for changelog generation are comprehensive but do not include tests for error handling paths such as empty diffs or LLM failures.

Overall Severity: LOW
AI Recommendation: Approve

<!-- AI_PR_REVIEW --> ## AI Code Review This PR adds a new '@codebot changelog' command to generate Keep a Changelog format entries from PR diffs. It includes workflow updates, prompt template, command handling in the PR agent, formatting logic, documentation, and comprehensive tests. The implementation is well-structured, with clear separation of concerns and good test coverage. No security or correctness issues were found. Minor suggestions for maintainability and readability are noted. ### Summary | Severity | Count | |----------|-------| | HIGH | 0 | | MEDIUM | 0 | | LOW | 5 | ### Review Findings - **[LOW]** `tools/ai-review/agents/pr_agent.py:1024` - The _handle_changelog_command method is quite long and could be split into smaller helper methods for clarity and easier testing. - **[LOW]** `tools/ai-review/agents/pr_agent.py:1080` - The error message posted to the PR comment on failure is informative but could be improved by including a link to documentation or support resources. - **[LOW]** `tools/ai-review/agents/pr_agent.py:1140` - The _format_changelog method manually appends lines to a list and joins them. This approach is clear but could be simplified or made more flexible using a templating engine or helper functions. - **[LOW]** `tools/ai-review/prompts/changelog.md:1` - The prompt is comprehensive and well-written but could benefit from a brief example snippet of expected JSON output at the top for immediate clarity. - **[LOW]** `tests/test_ai_review.py:830` - The tests for changelog generation are comprehensive but do not include tests for error handling paths such as empty diffs or LLM failures. --- **Overall Severity:** `LOW` **AI Recommendation:** Approve
Latte merged commit 1d468e360e into dev 2025-12-29 11:53:58 +00:00
Latte deleted branch feature/pr-changelog-generator 2025-12-29 11:53:58 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Hiddenden/openrabbit#25