Handle Cursor co-author trailer format in commit hook#12
Merged
Conversation
Agent-Logs-Url: https://github.com/BenjaminMichaelis/Config/sessions/adad97af-2dd9-4d6a-ad35-a3499ee102c2 Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
BenjaminMichaelis
May 15, 2026 22:23
View session
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s commit-msg hooks (bash + PowerShell) to properly strip Cursor’s co-author trailer format (Co-authored-by: Cursor cursoragent@cursor.com) as AI-generated metadata, and adds tests to validate the behavior.
Changes:
- Expanded the AI co-author name regex to recognize
Cursor. - Expanded the AI email-domain regex to include
cursor.comand to match non-angle-bracket email forms. - Added unit + bash end-to-end tests covering Cursor’s trailer format.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
git-hooks/tests/commit-msg.Tests.ps1 |
Adds unit and bash E2E tests for Cursor’s Co-authored-by: Cursor cursoragent@cursor.com format. |
git-hooks/commit-msg.ps1 |
Updates PowerShell hook patterns to detect Cursor by name and cursor.com domain, including non-<> emails. |
git-hooks/commit-msg |
Updates bash hook patterns to detect Cursor by name and cursor.com domain, including non-<> emails. |
Comments suppressed due to low confidence (1)
git-hooks/tests/commit-msg.Tests.ps1:432
- This end-to-end test case uses
Co-authored-by: Cursor ..., so it will be removed byAI_NAMES_PATTERNeven if the updatedAI_EMAIL_PATTERNfails to recognize non-angle-bracket emails. To cover the intended regex expansion, add an additional E2E case where the name is not an AI tool but the email domain matches (e.g.,Co-authored-by: Someone cursoragent@cursor.com).
It 'removes Cursor co-author without angle brackets' {
$content = "Fix bug`n`nCo-authored-by: Cursor cursoragent@cursor.com`n"
$result = Invoke-BashHook $content
$result | Should -Not -Match 'cursoragent@cursor\.com'
$result.Trim() | Should -Be 'Fix bug'
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+187
to
+188
| It 'removes Co-authored-by: Cursor cursoragent@cursor.com' { | ||
| $lines = @('Fix bug', '', 'Co-authored-by: Cursor cursoragent@cursor.com') |
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
Ensure the git commit-msg co-author filtering handles Cursor's trailer format
Co-authored-by: Cursor cursoragent@cursor.com.Changes
Cursoras an AI co-author name.cursor.comand non-angle-bracket email forms.Co-authored-by: Cursor cursoragent@cursor.com.Validation
git-hooks/tests,bucket/tests, andtests(all passing).