Skip to content

Handle Cursor co-author trailer format in commit hook#12

Merged
BenjaminMichaelis merged 1 commit into
mainfrom
copilot/update-git-co-author-script
May 16, 2026
Merged

Handle Cursor co-author trailer format in commit hook#12
BenjaminMichaelis merged 1 commit into
mainfrom
copilot/update-git-co-author-script

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

Summary

Ensure the git commit-msg co-author filtering handles Cursor's trailer format Co-authored-by: Cursor cursoragent@cursor.com.

Changes

  • Updated bash hook regex to recognize Cursor as an AI co-author name.
  • Expanded bash email-domain matching to include cursor.com and non-angle-bracket email forms.
  • Updated PowerShell hook regex with the same Cursor name/domain behavior.
  • Added unit and bash end-to-end tests for Co-authored-by: Cursor cursoragent@cursor.com.

Validation

  • Ran Pester suites across git-hooks/tests, bucket/tests, and tests (all passing).
  • Ran parallel validation (Code Review + CodeQL scan); no issues reported.

Agent-Logs-Url: https://github.com/BenjaminMichaelis/Config/sessions/adad97af-2dd9-4d6a-ad35-a3499ee102c2

Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.com and 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 by AI_NAMES_PATTERN even if the updated AI_EMAIL_PATTERN fails 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')
@BenjaminMichaelis BenjaminMichaelis marked this pull request as ready for review May 16, 2026 15:01
@BenjaminMichaelis BenjaminMichaelis merged commit b2c8911 into main May 16, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants