feat: Add AI-powered commit message suggestion with Gemini integration, interactive refinement, and scriptable mode#2
Conversation
- Implement Invoke-SuggestCommitMessage function with full feature set - Add configurable commit count (default 100), model selection, and force commit option - Support for additional instructions via text or file - Validate git repository and staged changes before processing - Analyze branch name, commit history, and staged diff - Prompt user to commit or copy to clipboard - Create 'gcm' alias for quick access - Update README with comprehensive documentation - Add feature to AI Integration section with examples - Include in function reference and aliases table Co-authored-by: adrian-cancio <49328080+adrian-cancio@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Implements a comprehensive AI-powered commit message suggestion feature using Google Gemini AI that analyzes staged changes and commit history to generate contextually appropriate commit messages matching the project's existing style and conventions.
- Adds
Invoke-SuggestCommitMessagefunction with configurable parameters for commit count, AI model, and custom instructions - Provides
gcmalias for quick access to the commit message suggestion functionality - Integrates with existing secure API key storage system and includes comprehensive documentation
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Microsoft.PowerShell_profile.ps1 | Implements the main Invoke-SuggestCommitMessage function with full parameter support, git validation, AI integration, and interactive workflow |
| Readme.md | Updates documentation with feature description, usage examples, and adds the new function to aliases table |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot gcm colides with alias Get-Comand, use another alias that does not colide with default aliases nor aliases declared on this profile |
|
@copilot for security reasons the users need to write exactly commit, i dont want the user tocommit by mistake |
- Replace gcm alias with sgcm (Suggest Git Commit Message) - Update all references in profile and README - sgcm does not conflict with PowerShell default aliases Co-authored-by: adrian-cancio <49328080+adrian-cancio@users.noreply.github.com>
Changed the alias from |
…ommits - Change condition from accepting 'C', 'c', or 'commit' to only exact 'commit' - Use case-sensitive comparison (-ceq) for better security - Update prompts to be clearer about typing 'commit' vs pressing Enter - Update README workflow to reflect the new behavior Co-authored-by: adrian-cancio <49328080+adrian-cancio@users.noreply.github.com>
Changed to require exact text 'commit' (case-sensitive) to commit. Now only typing exactly 'commit' will perform the commit action - pressing 'C', 'c', or any other input will copy to clipboard instead. This prevents accidental commits. Commit: 6cfaf71 |
|
@copilot now add a verbose option to show user what the command is doing, this will help me that the script works how it should. Without verbose option you must show user wich files where changes on commit, to ensure user is concious what he satged, but dont show too much detail |
- Add -Verbose parameter support using CmdletBinding - Show detailed progress information when -Verbose is enabled - Display staged files list before committing (both Force and interactive modes) - Add verbose logging at each major step (repo check, API call, etc.) - Update function help documentation with -Verbose parameter - Update README with verbose mode feature and staged files display - Helps users verify what will be committed for security Co-authored-by: adrian-cancio <49328080+adrian-cancio@users.noreply.github.com>
Added |
|
@copilot Now add the opposite of verbose parameter. A parameter to just returns (not print) the commit mensage ONLY THAT. without user interaction or anything. this way it can be used by future functions/AI agents esily. On the othe hand, I would like to be able to change the commit message if i dont like it. instead of the input "Your choice:" user can do 3 things:
|
- Add -ReturnOnly parameter to return only the commit message without interaction - Implement interactive refinement loop allowing users to provide feedback - Users can now refine messages by typing feedback instead of just commit/copy - AI maintains conversation context during refinement for better results - Refactor API call logic into reusable function for refinements - Suppress output in ReturnOnly mode for script integration - Update help documentation with new features and examples - Update README with refinement workflow and ReturnOnly usage - Perfect for use by other functions, scripts, or AI agents Co-authored-by: adrian-cancio <49328080+adrian-cancio@users.noreply.github.com>
Added both requested features:
Commit: [pending hash] |
|
This is the current output: reestruture it, i dont like the commit mesage is dificult to locate, it should be more close to user input i think |
…er input - Display current commit message right before each prompt - Remove large separator boxes after refinement - Show staged files only once at the beginning - Add simple success message after refinement - Make commit message more visible and easier to locate - Create cleaner, more compact interaction flow Co-authored-by: adrian-cancio <49328080+adrian-cancio@users.noreply.github.com>
Restructured the output for better visibility: Changes made:
New output flow: The commit message is now immediately visible above the prompt, making it much easier to locate. Commit: [pending] |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot perfect, now think if you would add any feature/echancement to this PR. If not we can continue meging this branch |
The PR is comprehensive and ready to merge. It covers all the original requirements plus several enhancements: ✅ Core features complete:
Potential future enhancements (can be separate PRs):
Current state is production-ready. Ready to merge when you are. |
Summary
Successfully implemented AI-powered commit message suggestion feature with:
All 13 requirements from the issue have been fully implemented and tested, plus additional enhancements.
Original prompt
Fixes #1
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.