Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/source-control-core/src/server/mergeMessage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ describe("removeAgentCredits", () => {
).toBe("Details about Claude support.\n\n\nCo-authored-by: Alice <alice@example.com>");
});

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 <noreply@anthropic.com>",
].join("\n"),
),
).toBe("Details");
});

it("preserves unknown identities, humans named after agents, and ordinary prose", () => {
const message = [
"Co-authored-by: Claude <claude@example.com>",
Expand Down
2 changes: 1 addition & 1 deletion packages/source-control-core/src/server/mergeMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function removeAgentCredits(message: string): string {
AGENT_EMAILS.has(email) &&
(email !== "noreply@github.com" || /^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;
Expand Down
Loading