Skip to content

Commit 09e41f3

Browse files
cknittclaude
andcommitted
Mark the last push's commits on a line under their identity
The pills in the subject line looked out of place. The mark is now a line of its own under the commit's identity, plain text led by a green or yellow dot, so the subjects stay alike and the mark reads in full. 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 f154f90 commit 09e41f3

3 files changed

Lines changed: 20 additions & 19 deletions

File tree

‎scripts/commitRecords.test.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,9 @@ test("--previous marks the commits the last push added or edited", async () => {
896896
assert.equal(r.status, 0, r.stderr);
897897
const comment = await fs.readFile(md, "utf8");
898898
has(comment, "<summary><b>Kept</b></summary>");
899-
has(comment, '<summary><b>Edited</b> <img alt="edited in last push"');
900-
has(comment, '<summary><b>Added</b> <img alt="new in last push"');
899+
const marked = (/** @type {string} */ subject) =>
900+
comment.split("<details").find(d => d.includes(`<b>${subject}</b>`)) ?? "";
901+
lacks(marked("Kept"), "in last push");
902+
has(marked("Edited"), "🟡 **Edited in last push**");
903+
has(marked("Added"), "🟢 **New in last push**");
901904
});

‎scripts/recordMarkdown.js‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,11 @@ function section(s, parts, full) {
387387
return out.join("\n\n");
388388
}
389389

390-
/** Badge colours of what the last push did to a commit. */
391-
const BADGES = { new: "2ea44f", edited: "d29922" };
392-
393-
/**
394-
* A pill reading `last push | new` (or `edited`), grey and green or yellow:
395-
* a comment takes no styles, so the pill is an image (shields.io), its text
396-
* in `alt` for a reader that draws none.
397-
* @param {string} change
398-
*/
399-
const badge = change =>
400-
`<img alt="${esc(change)} in last push" src="https://img.shields.io/badge/last_push-${encodeURIComponent(change)}-${BADGES[/** @type {keyof typeof BADGES} */ (change)] ?? "lightgrey"}">`;
390+
/** The line under a commit's identity that says what the last push did to it. */
391+
const MARKS = {
392+
new: "🟢 **New in last push**",
393+
edited: "🟡 **Edited in last push**",
394+
};
401395

402396
/**
403397
* A commit as a collapsible block: its subject, identity and message drawn;
@@ -413,8 +407,9 @@ export function commitMarkdown(r, full, change = "") {
413407
const joined = (/** @type {Section} */ s) =>
414408
[...s.text, ...s.block.map(l => l.trim())].join(" ").trim();
415409
const out = [
416-
`<details open><summary><b>${inlineHtml(subject)}</b>${change ? ` ${badge(change)}` : ""}</summary>`,
410+
`<details open><summary><b>${inlineHtml(subject)}</b></summary>`,
417411
`<sub>${esc(r.sha)} · ${inline(byline(r))}${r.date ? ` · ${esc(r.date)}` : ""}${pr ? ` · #${pr}` : ""}</sub>`,
412+
MARKS[/** @type {keyof typeof MARKS} */ (change)] ?? "",
418413
...sectionGroups(r.sections.filter(s => !BELOW.has(s.name))).map(g =>
419414
section(g.section, g.parts, full),
420415
),

‎scripts/recordMarkdown.test.js‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ ${SIGNED}
237237
has(tiny, "more commit");
238238
});
239239

240-
test("the commits the last push added or edited carry a pill", () => {
240+
test("the commits the last push added or edited are marked under their identity", () => {
241241
const message = (/** @type {string} */ subject) =>
242242
`${subject}\n\n${SIGNED}\n`;
243243
const md = comment([message("Kept"), message("Edited"), message("Added")], {
@@ -246,16 +246,19 @@ test("the commits the last push added or edited carry a pill", () => {
246246
["aaaaaaaa2", "new"],
247247
]),
248248
});
249-
has(md, "<summary><b>Kept</b></summary>");
250249
has(
251250
md,
252-
'<summary><b>Edited</b> <img alt="edited in last push" src="https://img.shields.io/badge/last_push-edited-d29922"></summary>',
251+
"<summary><b>Kept</b></summary>\n\n<sub>aaaaaaaa0 · A Person · Oct 22, 2026</sub>\n\n</details>",
253252
);
254253
has(
255254
md,
256-
'<summary><b>Added</b> <img alt="new in last push" src="https://img.shields.io/badge/last_push-new-2ea44f"></summary>',
255+
"<summary><b>Edited</b></summary>\n\n<sub>aaaaaaaa1 · A Person · Oct 22, 2026</sub>\n\n🟡 **Edited in last push**\n\n</details>",
257256
);
258-
assert.ok(!md.includes("Last push"));
257+
has(
258+
md,
259+
"<summary><b>Added</b></summary>\n\n<sub>aaaaaaaa2 · A Person · Oct 22, 2026</sub>\n\n🟢 **New in last push**\n\n</details>",
260+
);
261+
assert.ok(!md.includes("<img"));
259262
});
260263

261264
test("an assistant co-author is drawn by its short name, others as written", () => {

0 commit comments

Comments
 (0)