Add AI-powered commit and PR description generation#3
Merged
Conversation
Uses GitHub Models API (gpt-4o-mini) to auto-generate commit messages from staged diffs and PR titles/descriptions from branch diffs. Falls back to interactive prompt when no message is provided and --ai is not set. Auth via GITHUB_TOKEN env var or gh CLI token. https://claude.ai/code/session_01CSf8jFLPGw7CicGJpkaEiU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds AI-powered generation of commit messages and pull request descriptions using GitHub Models API (Azure OpenAI). Users can now use the
--aiflag with commit, ship, and pr commands to automatically generate descriptions based on git diffs.Key Changes
New AiService: Created
AiService.cswith methods to generate commit messages and PR descriptions via GitHub Models APIGenerateCommitMessageAsync(): Generates conventional commit messages from diffsGeneratePrDescriptionAsync(): Generates PR titles and structured descriptions with summary and changes sectionsGetTokenAsync(): Retrieves GitHub token from environment variable orghCLICommitCommand: Added
--aiflag to generate commit messagesShipCommand: Added
--aiflag to generate commit messagesCommitCommand.GenerateCommitMessageWithAi()for consistencyPrCommand: Added
--aiflag to generate PR title and description--aiis used without explicit titlegh pr createcommandImplementation Details
GITHUB_TOKENenvironment variable or authenticatedghCLIhttps://claude.ai/code/session_01CSf8jFLPGw7CicGJpkaEiU