Skip to content
TypeScript

fix(source-control): merge messages drop Claude Code's current claude.com footer (#23133)

MarcoDotIOb5a226e49c52
diff --git a/packages/source-control-core/src/server/mergeMessage.test.ts b/packages/source-control-core/src/server/mergeMessage.test.ts
index 299bcb3b445..0151f09a5c0 100644
--- a/packages/source-control-core/src/server/mergeMessage.test.ts
+++ b/packages/source-control-core/src/server/mergeMessage.test.ts
@@ -21,6 +21,20 @@ describe("removeAgentCredits", () => {
).toBe("Details about Claude support.\n\n\nCo-authored-by: Alice <[email protected]>");
});
+ it("removes the footer Claude Code writes today, which links to claude.com", () => {
+ expect(
+ removeAgentCredits(
+ [
+ "Details",
+ "",
+ "🤖 Generated with [Claude Code](https://claude.com/claude-code)",
+ "",
+ "Co-Authored-By: Claude <[email protected]>",
+ ].join("\n"),
+ ),
+ ).toBe("Details");
+ });
+
it("preserves unknown identities, humans named after agents, and ordinary prose", () => {
const message = [
"Co-authored-by: Claude <[email protected]>",
diff --git a/packages/source-control-core/src/server/mergeMessage.ts b/packages/source-control-core/src/server/mergeMessage.ts
index 8c95ddb4414..159c074260c 100644
--- a/packages/source-control-core/src/server/mergeMessage.ts
+++ b/packages/source-control-core/src/server/mergeMessage.ts
@@ -42,7 +42,7 @@ export function removeAgentCredits(message: string): string {
AGENT_EMAILS.has(email) &&
(email !== "[email protected]" || /^github copilot$|^copilot$/i.test(author![1]!));
const footer = text.replace(
- /\[([^\]]+)\]\(https:\/\/(?:claude\.ai|www\.anthropic\.com|chatgpt\.com|openai\.com|cursor\.com|github\.com|opencode\.ai|x\.ai|antigravity\.google)(?:\/[^\s)]*)?\)/gi,
+ /\[([^\]]+)\]\(https:\/\/(?:claude\.ai|claude\.com|www\.anthropic\.com|chatgpt\.com|openai\.com|cursor\.com|github\.com|opencode\.ai|x\.ai|antigravity\.google)(?:\/[^\s)]*)?\)/gi,
"$1",
);
if (!agentAuthor && !GENERATED_BY_AGENT.test(footer)) return true;