From 4c234b47a6f7f72661a11167e10da23ff0cfbd83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 06:00:19 +0000 Subject: [PATCH] feat: add Copilot Autofix Co-authored-by to git hook filter with tests Agent-Logs-Url: https://github.com/BenjaminMichaelis/Config/sessions/385eef05-40cf-44d6-ba02-41d983fd9c7c Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- git-hooks/commit-msg | 3 ++- git-hooks/commit-msg.ps1 | 3 ++- git-hooks/tests/commit-msg.Tests.ps1 | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/git-hooks/commit-msg b/git-hooks/commit-msg index f5555c0..d07f350 100755 --- a/git-hooks/commit-msg +++ b/git-hooks/commit-msg @@ -7,6 +7,7 @@ # Made-with: Cursor # Co-Authored-By: Claude Opus 4.6 # Co-authored-by: GitHub Copilot +# Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> # Co-authored-by: Amazon Q # Generated-by: GitHub Copilot @@ -19,7 +20,7 @@ MARKER_PATTERN='^[[:space:]]*(made-with|generated-by|suggested-by)[[:space:]]*:' # 2. Co-authored-by lines where the author name starts with a known AI tool # The trailing ([[:space:]]|<|$) ensures we match whole words (e.g. "Claude" # but also "Claude Opus 4.6" while not matching a hypothetical "Claudette"). -AI_NAMES_PATTERN='^[[:space:]]*co-authored?-by[[:space:]]*:[[:space:]]*(github[[:space:]]+copilot|copilot|claude|amazon[[:space:]]+q|amazon[[:space:]]+codewhisperer|codewhisperer|gemini|chatgpt|gpt-?[[:digit:]]+|cursor|codeium|tabnine|windsurf|opencode)([[:space:]]|<|$)' +AI_NAMES_PATTERN='^[[:space:]]*co-authored?-by[[:space:]]*:[[:space:]]*(github[[:space:]]+copilot|copilot[[:space:]]+autofix|copilot|claude|amazon[[:space:]]+q|amazon[[:space:]]+codewhisperer|codewhisperer|gemini|chatgpt|gpt-?[[:digit:]]+|cursor|codeium|tabnine|windsurf|opencode)([[:space:]]|<|$)' # 3. Co-authored-by lines whose email domain belongs to a known AI provider AI_EMAIL_PATTERN='^[[:space:]]*co-authored?-by[[:space:]]*:.*[:space:]]*@(anthropic\.com|cursor\.sh|cursor\.com|codeium\.com|cognition\.ai)[^>[:space:]]*>?' diff --git a/git-hooks/commit-msg.ps1 b/git-hooks/commit-msg.ps1 index 4b0b982..9636f8e 100644 --- a/git-hooks/commit-msg.ps1 +++ b/git-hooks/commit-msg.ps1 @@ -7,6 +7,7 @@ # Made-with: Cursor # Co-Authored-By: Claude Opus 4.6 # Co-authored-by: GitHub Copilot +# Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> # Co-authored-by: Amazon Q # Generated-by: GitHub Copilot @@ -30,7 +31,7 @@ function Remove-AITrailers { # 2. Co-authored-by where the name starts with a known AI tool # The trailing (\s|<|$) keeps whole-word matching so "Claude" still # matches "Claude Opus 4.6" but won't silently drop "Claudette Smith". - $aiNamesPattern = '^\s*co-authored?-by\s*:\s*(github\s+copilot|copilot|claude|amazon\s+q|amazon\s+codewhisperer|codewhisperer|gemini|chatgpt|gpt-?\d+|cursor|codeium|tabnine|windsurf|opencode)(\s|<|$)' + $aiNamesPattern = '^\s*co-authored?-by\s*:\s*(github\s+copilot|copilot\s+autofix|copilot|claude|amazon\s+q|amazon\s+codewhisperer|codewhisperer|gemini|chatgpt|gpt-?\d+|cursor|codeium|tabnine|windsurf|opencode)(\s|<|$)' # 3. Co-authored-by whose email domain belongs to a known AI provider $aiEmailPattern = '^\s*co-authored?-by\s*:.*\s]*@(anthropic\.com|cursor\.sh|cursor\.com|codeium\.com|cognition\.ai)[^>\s]*>?' diff --git a/git-hooks/tests/commit-msg.Tests.ps1 b/git-hooks/tests/commit-msg.Tests.ps1 index a49ce82..4180824 100644 --- a/git-hooks/tests/commit-msg.Tests.ps1 +++ b/git-hooks/tests/commit-msg.Tests.ps1 @@ -119,6 +119,13 @@ Describe 'Remove-AITrailers' { $result | Should -Not -Match 'Co-authored-by' $result[0] | Should -Be 'Fix bug' } + + It 'removes Co-authored-by: Copilot Autofix powered by AI with GitHub noreply bot email' { + $lines = @('Fix bug', '', 'Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>') + $result = @(Remove-AITrailers -Lines $lines) + $result | Should -Not -Match 'Co-authored-by' + $result[0] | Should -Be 'Fix bug' + } } Context 'Claude / Anthropic Co-authored-by is removed' { @@ -397,6 +404,13 @@ Describe 'commit-msg bash hook (end-to-end)' -Skip:($IsWindows -or -not (Get-Com $result.Trim() | Should -Be 'Fix bug' } + It 'removes Copilot Autofix trailer' { + $content = "Fix bug`n`nCo-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>`n" + $result = Invoke-BashHook $content + $result | Should -Not -Match 'Co-authored-by' + $result.Trim() | Should -Be 'Fix bug' + } + It 'removes Copilot trailer with GitHub noreply bot email' { $content = "Fix bug`n`nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>`n" $result = Invoke-BashHook $content