Skip to content

Commit 291da39

Browse files
cknittclaude
andcommitted
Draw an AI assistant co-author by its short name
"A Person with Claude Opus 5.5" took much of the identity line, above all on a phone. A co-author whose trailer gives an assistant's email is drawn by its short name, keyed on the email since the name changes with the model, and co-authors are joined with "+". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AzPS5F8RDSGZ6dhfK6NdZp Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent ab67e5b commit 291da39

5 files changed

Lines changed: 39 additions & 12 deletions

File tree

‎.claude/skills/records/SKILL.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ node scripts/commitRecords.js --out page.html [--pr <number>] [--title <text>] \
201201
## What the page shows
202202

203203
The page is the heading, then a card per commit. A card shows the commit's
204-
short sha, author and co-authors, date, the pull request a `(#1234)` at
205-
the end of the subject names, and the message drawn: the subject, the
206-
prose, each object block with its example and forms, the `Breaking:`
207-
sections as banners, and the `Review:` sections as a list.
204+
short sha, author and co-authors (an AI assistant by its short name, such
205+
as Claude), date, the pull request a `(#1234)` at the end of the subject
206+
names, and the message drawn: the subject, the prose, each object block
207+
with its example and forms, the `Breaking:` sections as banners, and the
208+
`Review:` sections as a list.

‎scripts/commitRecords.test.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ test("a minimal record draws its identity and subject", async () => {
132132
has(html, "<h3>Fix a typo</h3>");
133133
assert.match(
134134
html,
135-
/<div class="meta"><code>[0-9a-f]{9}<\/code> · A Person with B Person · [A-Z][a-z]{2} \d{2}, \d{4} · <a href="https:\/\/github.com\/rescript-lang\/rescript\/pull\/7">#7<\/a><\/div>/,
135+
/<div class="meta"><code>[0-9a-f]{9}<\/code> · A Person \+ B Person · [A-Z][a-z]{2} \d{2}, \d{4} · <a href="https:\/\/github.com\/rescript-lang\/rescript\/pull\/7">#7<\/a><\/div>/,
136136
);
137137
lacks(html, '<div class="below">');
138138
lacks(html, "Signed-off-by");
@@ -457,7 +457,7 @@ test("Breaking and Review sections right above the sign-off are drawn", async ()
457457
);
458458
has(html, '<article class="card breaking"');
459459
has(html, '<ul class="review"><li>Is -bs-x still read? No.</li></ul>');
460-
has(html, "</code> · A Person with B Person · ");
460+
has(html, "</code> · A Person + B Person · ");
461461
lacks(html, "Signed-off-by");
462462
});
463463

@@ -504,7 +504,8 @@ test("trailers of any key end the message and are not drawn", async () => {
504504
const html = await renderOne(
505505
`Fix a thing\n\nCo-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>\nClaude-Session: https://claude.ai/code/session_x\n${SIGNED}\n`,
506506
);
507-
has(html, " · A Person with Claude Opus 5.5 · ");
507+
has(html, " · A Person + Claude · ");
508+
lacks(html, "Opus");
508509
lacks(html, "Claude-Session");
509510
lacks(html, "session_x");
510511
lacks(html, '<section class="block');

‎scripts/recordMarkdown.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
atomDiff,
1515
BELOW,
1616
BLOCK,
17+
byline,
1718
cellsOf,
1819
columnWidths,
1920
dedent,
@@ -399,7 +400,7 @@ export function commitMarkdown(r, full) {
399400
[...s.text, ...s.block.map(l => l.trim())].join(" ").trim();
400401
const out = [
401402
`<details open><summary><b>${inlineHtml(subject)}</b></summary>`,
402-
`<sub>${esc(r.sha)} · ${inline(r.author)}${r.coauthors.length ? ` with ${inline(r.coauthors.join(", "))}` : ""}${r.date ? ` · ${esc(r.date)}` : ""}${pr ? ` · #${pr}` : ""}</sub>`,
403+
`<sub>${esc(r.sha)} · ${inline(byline(r))}${r.date ? ` · ${esc(r.date)}` : ""}${pr ? ` · #${pr}` : ""}</sub>`,
403404
...sectionGroups(r.sections.filter(s => !BELOW.has(s.name))).map(g =>
404405
section(g.section, g.parts, full),
405406
),

‎scripts/recordMarkdown.test.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ${SIGNED}
7575
md,
7676
"<details open><summary><b>Represent raw extensions as their own node</b></summary>",
7777
);
78-
has(md, "<sub>aaaaaaaa0 · A Person with B Person · Oct 22, 2026 · #12</sub>");
78+
has(md, "<sub>aaaaaaaa0 · A Person + B Person · Oct 22, 2026 · #12</sub>");
7979
has(md, "> **Why**\n>\n> A raw extension carries JavaScript.");
8080
has(md, "**AST modified** (raw extensions)");
8181
has(md, "```rescript\nlet f = %raw(`(a) => a`)\n```");
@@ -232,3 +232,10 @@ ${SIGNED}
232232
assert.ok(tiny.length <= 500, `${tiny.length}`);
233233
has(tiny, "more commit");
234234
});
235+
236+
test("an assistant co-author is drawn by its short name, others as written", () => {
237+
const md = comment([
238+
`Fix it\n\nCo-Authored-By: Claude Sonnet 5.5 <NoReply@Anthropic.com>\nCo-Authored-By: Claude Person <claude@example.com>\nCo-Authored-By: No Email\n${SIGNED}\n`,
239+
]);
240+
has(md, "· A Person + Claude + Claude Person + No Email ·");
241+
});

‎scripts/recordRender.js‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,20 +166,37 @@ function parseMessage(text) {
166166
return { subject: lines[0], sections, trailers: lines.slice(end) };
167167
}
168168

169+
/**
170+
* AI assistants by the email their `Co-Authored-By:` trailers give, and the
171+
* short name drawn for them: the name in the trailer changes with the model
172+
* ("Claude Opus 5.5"), the email does not.
173+
*/
174+
const ASSISTANTS = new Map([["noreply@anthropic.com", "Claude"]]);
175+
169176
/**
170177
* A commit's record: its identity and its message, parsed; the co-authors
171-
* are the names its `Co-Authored-By:` trailers give.
178+
* are the names its `Co-Authored-By:` trailers give, an assistant's short.
172179
* @param {CommitInfo} commit
173180
* @returns {CommitRecord}
174181
*/
175182
export function parseRecord(commit) {
176183
const { subject, sections, trailers } = parseMessage(commit.message);
177184
const coauthors = trailers
178185
.filter(l => /^Co-Authored-By:/i.test(l))
179-
.map(l => l.replace(/^Co-Authored-By:\s*/i, "").replace(/\s*<[^>]*>/, ""));
186+
.map(l => {
187+
const [, name, email = ""] =
188+
/^Co-Authored-By:\s*(.*?)\s*(?:<([^>]*)>)?\s*$/i.exec(l) ?? [];
189+
return ASSISTANTS.get(email.toLowerCase()) ?? name;
190+
});
180191
return { ...commit, subject, sections, coauthors: [...new Set(coauthors)] };
181192
}
182193

194+
/**
195+
* Who made a commit: its author and co-authors, as `A Person + Claude`.
196+
* @param {CommitRecord} r
197+
*/
198+
export const byline = r => [r.author, ...r.coauthors].join(" + ");
199+
183200
// ---------------------------------------------------------------------------
184201
// Code, highlighted by token
185202

@@ -1513,7 +1530,7 @@ function card(r) {
15131530
[...s.text, ...s.block.map(l => l.trim())].join(" ").trim();
15141531
const out = [
15151532
`<article class="card${breaking.length ? " breaking" : ""}" id="c-${esc(r.sha)}">`,
1516-
`<header><div class="meta"><code>${esc(r.sha)}</code> · ${esc(r.author)}${r.coauthors.length ? ` with ${esc(r.coauthors.join(", "))}` : ""}${r.date ? ` · ${esc(r.date)}` : ""}${
1533+
`<header><div class="meta"><code>${esc(r.sha)}</code> · ${esc(byline(r))}${r.date ? ` · ${esc(r.date)}` : ""}${
15171534
pr ? ` · <a href="${REPO_URL}/pull/${pr}">#${pr}</a>` : ""
15181535
}</div><h3>${inline(subject)}</h3></header>`,
15191536
];

0 commit comments

Comments
 (0)