Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

feat(git): add generate_release_notes operation#11

Merged
jinzhongjia merged 10 commits into
mainfrom
feat/release-note
Aug 2, 2025
Merged

feat(git): add generate_release_notes operation#11
jinzhongjia merged 10 commits into
mainfrom
feat/release-note

Conversation

@jinzhongjia

Copy link
Copy Markdown
Owner
  • implement generate_release_notes for release notes generation between tags
  • support markdown, plain, and json output formats with Conventional Commits categorization
  • update documentation and usage examples for the new operation
  • expose generate_release_notes in git tool API and git_read schema

- implement generate_release_notes for release notes generation between tags
- support markdown, plain, and json output formats with Conventional Commits categorization
- update documentation and usage examples for the new operation
- expose generate_release_notes in git tool API and git_read schema

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @jinzhongjia, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

I've implemented a new generate_release_notes operation for the git_read tool. This feature allows users to automatically create structured release notes between specified Git tags, supporting various output formats like Markdown, plain text, and JSON, and intelligently categorizing commits based on Conventional Commits.

Highlights

  • New Git Operation: Introduced generate_release_notes to the @{git_read} tool, enabling automated generation of release notes from Git history.
  • Flexible Tagging: The operation can automatically detect the latest and second-latest tags or accept specific from_tag and to_tag arguments for precise range selection.
  • Multiple Output Formats: Release notes can be generated in Markdown (default), plain text, or JSON formats to suit different consumption needs.
  • Conventional Commits Support: Commits are automatically categorized into 'Features,' 'Bug Fixes,' and 'Other Changes' based on Conventional Commits specification, providing a clear and organized summary.
  • API and Documentation Updates: The new operation is fully integrated into the git_tool API and extensively documented in both the README.md and the plugin's help file, including usage examples.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new generate_release_notes operation, which is a great addition. The implementation is well-structured, and the feature is well-documented across the README and help files. I've identified a critical security vulnerability and a couple of other areas for improvement in the core implementation. My review includes detailed suggestions to address these points, enhancing security and ensuring deterministic output.

Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua Outdated
- sort contributors in descending order of commit count in generated release notes
- use alphabetical order as a tiebreaker for contributors with equal commit counts
@jinzhongjia

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a generate_release_notes operation, which is a great addition. The implementation is mostly solid, with good handling of different output formats and Conventional Commits. I've found a critical syntax error and a high-severity issue related to commit message parsing that could lead to incorrect release notes. I've also included some suggestions to improve code maintainability and conciseness. Once these issues are addressed, this will be a robust feature.

Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua Outdated
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua Outdated
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua
- adjust whitespace and indentation for consistency in generate_release_notes
- split long lines and clarify string concatenation for error messages
- fix minor formatting issues in contributors and commit grouping sections
- update git_read to use multiline assignment for generate_release_notes call
@jinzhongjia

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new generate_release_notes operation, which is a great addition. The implementation is solid, with good handling of different output formats and edge cases. The documentation has also been updated accordingly. I've found a couple of areas for improvement: one is a misleading API usage example in the README that should be corrected, and the other is a suggestion to refactor string building logic for better performance and readability in the core function. Overall, great work on this feature.

Comment thread README.md Outdated
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua
jinzhongjia and others added 3 commits August 2, 2025 02:11
- use ASCII unit separator for robust commit field splitting
- escape commit range argument to prevent shell injection
- update parsing logic to handle new separator and improve reliability
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- replace string concatenation with table accumulation and table.concat for markdown and plain formats
- improve performance and readability of release notes generation
- ensure consistent formatting across different output formats
@jinzhongjia

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a valuable generate_release_notes feature. The implementation is solid, with good error handling and logic for detecting tags and parsing commits. The documentation has been updated accordingly.

My review focuses on improving the implementation's maintainability by addressing code duplication in the Lua code. I've also pointed out a small redundancy in the README documentation to improve clarity for users.

Comment thread README.md
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua
@jinzhongjia

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new generate_release_notes operation, which is a great addition. The implementation is solid, providing markdown, plain, and JSON output formats with Conventional Commits categorization. The documentation has also been updated accordingly.

I've found a few areas for improvement:

  • There's a bug in how Conventional Commit types are parsed, which fails for commits with scopes.
  • The categorization logic accepts non-standard commit types (feature, bugfix).
  • The README.md contains a redundant code example.

I've left specific comments with suggestions to address these points. Overall, this is a well-executed feature.

local others = {}

for _, commit in ipairs(commits) do
local type_match = commit.subject:match("^(%w+):")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current regex ^(%w+): for parsing the Conventional Commit type does not handle commits with scopes (e.g., feat(parser): ...). This will cause such commits to be miscategorized under 'Other Changes'. To correctly extract the type, the regex should be changed to ^(%w+) to capture the type part before any optional scope.

      local type_match = commit.subject:match("^(%w+)")

Comment thread README.md Outdated
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua Outdated
- update regex to support Conventional Commits with scopes
- ensure features are correctly categorized when scope is present
- match only "feat" and "fix" types for features and fixes
- exclude "feature" and "bugfix" aliases from type parsing
@jinzhongjia

Copy link
Copy Markdown
Owner Author

/gemini review

@jinzhongjia

Copy link
Copy Markdown
Owner Author

/gemini summary

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces a new generate_release_notes operation to the git tool, enabling release notes generation between tags with support for markdown, plain, and JSON output formats. The changes include updates to documentation and usage examples, as well as exposing the new operation in the git tool API and git_read schema. I've provided feedback to improve the code's robustness and readability.

Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua Outdated
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua Outdated
Comment thread lua/codecompanion/_extensions/gitcommit/tools/git.lua
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

I've implemented a new generate_release_notes operation for the Git tool, enabling users to automatically create formatted release notes between specified Git tags. This feature supports markdown, plain text, and JSON output formats, and intelligently categorizes commits based on Conventional Commits, including a list of contributors. This significantly enhances the Git tool's capabilities by automating a common release management task.

Highlights

  • New Git Operation: Added a new generate_release_notes operation to the Git tool, accessible via @{git_read}.
  • Flexible Output Formats: Implemented support for generating release notes in markdown, plain text, and JSON formats.
  • Enhanced Release Notes Content: Incorporated Conventional Commits categorization (features, fixes, other changes) and contributor listing into the release notes generation.
  • Documentation Updates: Updated documentation and usage examples in README.md and doc/codecompanion-gitcommit.txt to reflect the new functionality.
  • API and Schema Integration: Exposed the new operation in the git_read schema and the git_tool API for programmatic access.
Changelog
  • README.md
    • Updated the count of @{git_read} operations from 15 to 16.
    • Added examples for @{git_read} generate_release_notes in chat.
    • Introduced a new section titled "Generate Release Notes" with usage examples.
    • Added a Lua example for gitcommit.exports.git_tool.generate_release_notes.
  • doc/codecompanion-gitcommit.txt
    • Revised the @{git_read} operation count from 15 to 16.
    • Included generate_release_notes in the list of available @{git_read} operations.
    • Added a comprehensive section detailing the release notes generation feature, its usage, and capabilities.
  • lua/codecompanion/_extensions/gitcommit/init.lua
    • Exposed the generate_release_notes function through the gitcommit.exports.git_tool API.
  • lua/codecompanion/_extensions/gitcommit/tools/git.lua
    • Implemented the core logic for GitTool.generate_release_notes.
    • Included functionality for fetching tags and commits.
    • Added parsing of commit messages.
    • Implemented Conventional Commits categorization (features, fixes, other changes) and contributor aggregation.
    • Provided output formatting for markdown, plain, and JSON.
    • Incorporated error handling for git commands and tag detection.
  • lua/codecompanion/_extensions/gitcommit/tools/git_read.lua
    • Integrated generate_release_notes into the git_read schema, defining its parameters (from_tag, to_tag, release_format).
    • Updated the help message to include the new operation.
    • Linked the generate_release_notes operation to its implementation in GitTool.
Activity
  • On August 1, 2025, at 4:56 PM UTC, gemini-code-assist[bot] identified a critical security vulnerability and a bug in git.lua related to command injection and commit parsing, suggesting a fix using vim.fn.shellescape() and a robust delimiter (\x01).
  • On August 1, 2025, at 4:56 PM UTC, gemini-code-assist[bot] suggested sorting contributors for deterministic output in git.lua.
  • On August 1, 2025, at 5:45 PM UTC, jinzhongjia requested a /gemini review.
  • On August 1, 2025, at 5:46 PM UTC, gemini-code-assist[bot] noted a critical syntax error (extra end statement) in init.lua or git.lua.
  • On August 1, 2025, at 5:46 PM UTC, gemini-code-assist[bot] highlighted a high-priority issue in git.lua regarding the use of | as a delimiter in git log and suggested using a null byte (%x00) for robustness.
  • On August 1, 2025, at 5:46 PM UTC, gemini-code-assist[bot] pointed out that the commit parsing logic in git.lua was not robust and should be updated to split by null bytes.
  • On August 1, 2025, at 5:46 PM UTC, gemini-code-assist[bot] recommended refactoring the generate_release_notes function in git.lua into smaller, more focused helper functions for better readability and maintainability.
  • On August 1, 2025, at 5:46 PM UTC, gemini-code-assist[bot] suggested a more concise way to count contributor commits in git.lua using or 0.
  • On August 1, 2025, at 5:49 PM UTC, jinzhongjia requested another /gemini review.
  • On August 1, 2025, at 5:50 PM UTC, gemini-code-assist[bot] identified a high-priority issue in README.md where the example for generate_release_notes did not correctly reflect the function's four return values and provided a corrected example.
  • On August 1, 2025, at 5:50 PM UTC, gemini-code-assist[bot] advised using table.concat() for efficient string building in git.lua when generating release notes in markdown and plain formats.
  • On August 1, 2025, at 6:23 PM UTC, jinzhongjia requested another /gemini review.
  • On August 1, 2025, at 6:25 PM UTC, gemini-code-assist[bot] suggested removing a redundant example for generate_release_notes in README.md.
  • On August 1, 2025, at 6:25 PM UTC, gemini-code-assist[bot] recommended refactoring the markdown generation logic in git.lua into a helper function to reduce code duplication.
  • On August 1, 2025, at 6:25 PM UTC, gemini-code-assist[bot] suggested using table.concat() for efficient plain text string building in git.lua.
  • On August 1, 2025, at 6:26 PM UTC, jinzhongjia requested another /gemini review.
  • On August 1, 2025, at 6:27 PM UTC, gemini-code-assist[bot] highlighted a high-priority issue in git.lua regarding the regex for Conventional Commit type parsing, suggesting an update to handle scopes correctly.
  • On August 1, 2025, at 6:27 PM UTC, gemini-code-assist[bot] suggested removing a redundant Lua example for generate_release_notes in README.md.
  • On August 1, 2025, at 6:27 PM UTC, gemini-code-assist[bot] recommended strict adherence to Conventional Commits in git.lua by removing aliases like feature and bugfix.
  • On August 1, 2025, at 6:31 PM UTC, jinzhongjia requested another /gemini review.
  • On August 1, 2025, at 6:36 PM UTC, jinzhongjia requested a /gemini summary.
  • On August 1, 2025, at 6:39 PM UTC, gemini-code-assist[bot] suggested consistent parameter documentation in init.lua or git.lua.
  • On August 1, 2025, at 6:39 PM UTC, gemini-code-assist[bot] recommended adding error handling for vim.fn.shellescape in git.lua.
  • On August 1, 2025, at 6:39 PM UTC, gemini-code-assist[bot] suggested simplifying the contributor sorting logic in git.lua.

- check for empty or failed shell escaping of tag range
- return error messages if escaping fails before running git log
- improve robustness of release notes generation with invalid tags
@jinzhongjia

Copy link
Copy Markdown
Owner Author

/gemini summary

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

I've implemented a new generate_release_notes operation for the Git tool, allowing users to automatically create formatted release notes between specified Git tags. This new capability supports various output formats (markdown, plain, JSON) and intelligently categorizes commits based on Conventional Commits, significantly enhancing the automation of release management tasks within the system.

Highlights

  • New Git Operation: A new generate_release_notes operation has been added to the Git tool, accessible via @{git_read}.
  • Flexible Output Formats: The new operation supports generating release notes in markdown, plain text, and JSON formats.
  • Enhanced Release Notes Content: Release notes now categorize commits based on Conventional Commits (features, fixes, other changes) and include a list of contributors.
  • Documentation Updates: Documentation and usage examples in README.md and doc/codecompanion-gitcommit.txt have been updated to reflect the new functionality.
  • API and Schema Integration: The new operation is exposed in the git_read schema and the git_tool API for programmatic access.
Changelog
  • README.md
    • Updated the count of @{git_read} operations from 15 to 16.
    • Added examples for @{git_read} generate_release_notes in chat.
    • Introduced a new section titled "Generate Release Notes" with usage examples.
    • Added a Lua example for gitcommit.exports.git_tool.generate_release_notes.
  • doc/codecompanion-gitcommit.txt
    • Revised the @{git_read} operation count from 15 to 16.
    • Included generate_release_notes in the list of available @{git_read} operations.
    • Added a comprehensive section detailing the release notes generation feature, its usage, and capabilities.
  • lua/codecompanion/_extensions/gitcommit/init.lua
    • Exposed the generate_release_notes function through the gitcommit.exports.git_tool API.
  • lua/codecompanion/_extensions/gitcommit/tools/git.lua
    • Implemented the core logic for GitTool.generate_release_notes.
    • Included functionality for fetching tags and commits.
    • Added parsing of commit messages.
    • Implemented Conventional Commits categorization (features, fixes, other changes) and contributor aggregation.
    • Provided output formatting for markdown, plain, and JSON.
    • Incorporated error handling for git commands and tag detection.
  • lua/codecompanion/_extensions/gitcommit/tools/git_read.lua
    • Integrated generate_release_notes into the git_read schema, defining its parameters (from_tag, to_tag, release_format).
    • Updated the help message to include the new operation.
    • Linked the generate_release_notes operation to its implementation in GitTool.
Activity
  • The author, jinzhongjia, actively engaged with the bot, requesting multiple "/gemini review" and "/gemini summary" commands.
  • gemini-code-assist[bot] identified a critical security vulnerability and a bug in git.lua related to command injection and commit parsing, suggesting a fix using vim.fn.shellescape() and a robust delimiter (\x01).
  • gemini-code-assist[bot] suggested sorting contributors for deterministic output in git.lua.
  • gemini-code-assist[bot] noted a critical syntax error (extra end statement) in init.lua or git.lua.
  • gemini-code-assist[bot] highlighted a high-priority issue in git.lua regarding the use of | as a delimiter in git log and suggested using a null byte (%x00) for robustness.
  • gemini-code-assist[bot] pointed out that the commit parsing logic in git.lua was not robust and should be updated to split by null bytes.
  • gemini-code-assist[bot] recommended refactoring the generate_release_notes function in git.lua into smaller, more focused helper functions for better readability and maintainability.
  • gemini-code-assist[bot] suggested a more concise way to count contributor commits in git.lua using or 0.
  • gemini-code-assist[bot] identified a high-priority issue in README.md where the example for generate_release_notes did not correctly reflect the function's four return values and provided a corrected example.
  • gemini-code-assist[bot] advised using table.concat() for efficient string building in git.lua when generating release notes in markdown and plain formats.
  • gemini-code-assist[bot] suggested removing a redundant example for generate_release_notes in README.md.
  • gemini-code-assist[bot] recommended refactoring the markdown generation logic in git.lua into a helper function to reduce code duplication.
  • gemini-code-assist[bot] suggested using table.concat() for efficient plain text string building in git.lua.
  • gemini-code-assist[bot] highlighted a high-priority issue in git.lua regarding the regex for Conventional Commit type parsing, suggesting an update to handle scopes correctly.
  • gemini-code-assist[bot] suggested removing a redundant Lua example for generate_release_notes in README.md.
  • gemini-code-assist[bot] recommended strict adherence to Conventional Commits in git.lua by removing aliases like feature and bugfix.
  • gemini-code-assist[bot] suggested consistent parameter documentation in init.lua or git.lua.
  • gemini-code-assist[bot] recommended adding error handling for vim.fn.shellescape in git.lua.
  • gemini-code-assist[bot] suggested simplifying the contributor sorting logic in git.lua.

- update commit message examples to use scoped Conventional Commits
- clarify release notes generation usage in README
- enhance feature list to highlight scope support, contributor sorting, and security improvements
@jinzhongjia jinzhongjia merged commit 3993520 into main Aug 2, 2025
1 check passed
@jinzhongjia jinzhongjia deleted the feat/release-note branch August 5, 2025 17:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant