feat(source-control): omit agent credits from PR merge messages #16192
Mergedjuliusmarmingemerged 2 commits into
main fromrefs/pull/16192/headmerged by juliusmarminge View on GitHub- apps/server/src/pullRequest/mergeMessage.ts lines 20 to 20OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +1,20 @@1+const AGENT_EMAILS = new Set([2+ "noreply@anthropic.com",3+ "claude@anthropic.com",4+ "noreply@openai.com",5+ "codex@openai.com",6+ "cursoragent@cursor.com",7+ "copilot@github.com",8+ "noreply@github.com",9+]);10+11+const GENERATED_BY_AGENT =12+ /^(?:🤖\s*)?generated (?:with|by)\s+(?:claude(?: code)?|codex|cursor|github copilot|copilot|opencode|grok|antigravity)[.!]?$/i;13+14+/** Remove standalone agent credits while keeping human signatures and quoted examples. */15+export function removeAgentCredits(message: string): string {16+ let fence: string | undefined;17+ let removed = false;18+ const newline = message.includes("\r\n") ? "\r\n" : "\n";19+ const lines = message.split(/\r?\n/).filter((line) => {20+ const marker = /^\s*(`{3,}|~{3,})/.exec(line)?.[1];apps/server/src/pullRequest/mergeMessage.ts lines 20 to 26OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +6,21 @@6+ "cursoragent@cursor.com",7+ "copilot@github.com",8+ "noreply@github.com",9+]);10+11+const GENERATED_BY_AGENT =12+ /^(?:🤖\s*)?generated (?:with|by)\s+(?:claude(?: code)?|codex|cursor|github copilot|copilot|opencode|grok|antigravity)[.!]?$/i;13+14+/** Remove standalone agent credits while keeping human signatures and quoted examples. */15+export function removeAgentCredits(message: string): string {16+ let fence: string | undefined;17+ let removed = false;18+ const newline = message.includes("\r\n") ? "\r\n" : "\n";19+ const lines = message.split(/\r?\n/).filter((line) => {20+ const marker = /^\s*(`{3,}|~{3,})/.exec(line)?.[1];21+ if (marker !== undefined) {22+ if (fence === undefined) fence = marker;23+ else if (marker[0] === fence[0] && marker.length >= fence.length) fence = undefined;24+ return true;25+ }26+ if (fence !== undefined || /^(?: {4}|\t)/.test(line)) return true;apps/server/src/pullRequest/mergeMessage.ts lines 23 to 23OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +3,21 @@3+ "claude@anthropic.com",4+ "noreply@openai.com",5+ "codex@openai.com",6+ "cursoragent@cursor.com",7+ "copilot@github.com",8+ "noreply@github.com",9+]);10+11+const GENERATED_BY_AGENT =12+ /^(?:🤖\s*)?generated (?:with|by)\s+(?:claude(?: code)?|codex|cursor|github copilot|copilot|opencode|grok|antigravity)[.!]?$/i;13+14+/** Remove standalone agent credits while keeping human signatures and quoted examples. */15+export function removeAgentCredits(message: string): string {16+ let fence: string | undefined;17+ let removed = false;18+ const newline = message.includes("\r\n") ? "\r\n" : "\n";19+ const lines = message.split(/\r?\n/).filter((line) => {20+ const marker = /^\s*(`{3,}|~{3,})/.exec(line)?.[1];21+ if (marker !== undefined) {22+ if (fence === undefined) fence = marker;23+ else if (marker[0] === fence[0] && marker.length >= fence.length) fence = undefined;
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge merged this24238fe
juliusmarminge closed this
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed