Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Merge remote-tracking branch 'origin/claude/cool-newton-7nm8r9' into claude/cool-newton-7nm8r9 | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { CODING_AGENTS, codingAgentById, codingAgentFor } from "./coding-agents.ts"; | |
| 5 | ||
| 6 | test("a coding agent is found by the address on its commits, not by its name", () => { | |
| 7 | assert.equal(codingAgentFor("noreply@anthropic.com")?.id, "claude"); | |
| 8 | assert.equal(codingAgentFor(" NoReply@Anthropic.com ")?.id, "claude"); | |
| 9 | assert.equal(codingAgentFor("209825114+claude[bot]@users.noreply.github.com")?.id, "claude"); | |
| 10 | assert.equal(codingAgentFor("198982749+Copilot@users.noreply.github.com")?.id, "copilot"); | |
| 11 | assert.equal(codingAgentFor("49699333+dependabot[bot]@users.noreply.github.com")?.id, "dependabot"); | |
| 12 | assert.equal(codingAgentFor("41898282+github-actions[bot]@users.noreply.github.com")?.id, "github-actions"); | |
| 13 | assert.equal(codingAgentFor("cursoragent@cursor.com")?.id, "cursor"); | |
| 14 | assert.equal(codingAgentFor("ada@example.com"), null); | |
| 15 | assert.equal(codingAgentFor("123+ada@users.noreply.github.com"), null); | |
| 16 | assert.equal(codingAgentFor(""), null); | |
| 17 | assert.equal(codingAgentFor(null), null); | |
| 18 | }); | |
| 19 | ||
| 20 | test("every agent has a unique id, lowercase addresses and logins, and a mark colour that is a hex or none", () => { | |
| 21 | const ids = new Set<string>(); | |
| 22 | const addresses = new Set<string>(); | |
| 23 | for (const agent of CODING_AGENTS) { | |
| 24 | assert.ok(!ids.has(agent.id), agent.id); | |
| 25 | ids.add(agent.id); | |
| 26 | assert.ok(agent.emails.length + agent.logins.length > 0, `${agent.id} matches nothing`); | |
| 27 | for (const value of [...agent.emails, ...agent.logins]) { | |
| 28 | assert.equal(value, value.toLowerCase(), value); | |
| 29 | assert.ok(!addresses.has(value), `${value} is listed twice`); | |
| 30 | addresses.add(value); | |
| 31 | } | |
| 32 | assert.ok(agent.color === null || /^[0-9A-F]{6}$/.test(agent.color), agent.id); | |
| 33 | assert.ok(agent.url.startsWith("https://"), agent.id); | |
| 34 | } | |
| 35 | assert.equal(codingAgentById("claude")?.name, "Claude"); | |
| 36 | assert.equal(codingAgentById("nobody"), null); | |
| 37 | }); |
This file's history is long; its oldest lines are credited to the oldest commit read.