From 7f30e112acf51f0549658d2dd9afd96418e2edc6 Mon Sep 17 00:00:00 2001 From: maxsol Date: Sat, 21 Nov 2026 15:35:08 +0100 Subject: [PATCH 1/3] build: let a bot's commit subject be longer than 72 Dependabot names a grouped update "bump the development group across 1 directory with 4 updates", 77 characters with its prefix, and we do not choose its words. A commit by a GitHub bot (author ...[bot]@users.noreply.github.com) still needs a type; only the length is not checked. Raising the limit for everyone was rejected: 72 stays the rule for people. --- ...031-conventional-commits-and-release-please.md | 2 +- scripts/check-commits.ts | 15 +++++++++------ scripts/lib/commit-message.test.ts | 7 +++++++ scripts/lib/commit-message.ts | 7 ++++--- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/docs/adr/0031-conventional-commits-and-release-please.md b/docs/adr/0031-conventional-commits-and-release-please.md index 99a301d..27d7ef1 100644 --- a/docs/adr/0031-conventional-commits-and-release-please.md +++ b/docs/adr/0031-conventional-commits-and-release-please.md @@ -23,7 +23,7 @@ Options considered: - **The check** is `scripts/check-commits.ts` (subject rules in `scripts/lib/commit-message.ts`), not commitlint, which would add many dependencies for a few rules. The `commits` job in `ci.yml` checks every commit of a pull request except merges; `.githooks/commit-msg` checks one before it is pushed. Dependabot writes `build(deps)` and - `ci(deps)` subjects. + `ci(deps)` subjects; a bot's subject may be longer than 72, since we do not choose its words. - **release-please** (`release-please-config.json`, `.release-please-manifest.json`, release type `node`, tags `v`) runs as the first job of `release.yml` on each push to `main`, with `GITHUB_TOKEN` only. It writes the root `package.json` version, so ADR 30's one version stays. A tag made with `GITHUB_TOKEN` starts no other diff --git a/scripts/check-commits.ts b/scripts/check-commits.ts index 9c52703..20ef354 100644 --- a/scripts/check-commits.ts +++ b/scripts/check-commits.ts @@ -1,6 +1,7 @@ /** * Check commit messages against Conventional Commits (ADR 31). * `check-commits.ts ..`: every commit in the range but merges (CI, on a pull request). + * A commit whose author is a GitHub bot (`…[bot]@users.noreply.github.com`) may have a longer subject. * `check-commits.ts --file `: one message file (the `.githooks/commit-msg` hook). */ import { execFileSync } from "node:child_process"; @@ -8,17 +9,19 @@ import { readFileSync } from "node:fs"; import { checkCommitMessage } from "./lib/commit-message.ts"; const [first = "", second] = process.argv.slice(2); -let messages: { name: string; text: string }[]; +let messages: { name: string; text: string; bot?: boolean }[]; if (first === "--file" && second) { messages = [{ name: second, text: readFileSync(second, "utf8") }]; } else if (first.includes("..") && second === undefined) { - const log = execFileSync("git", ["log", "--no-merges", "--format=%h %s%x00%B%x1e", first], { encoding: "utf8" }); + const log = execFileSync("git", ["log", "--no-merges", "--format=%h %s%x00%ae%x00%B%x1e", first], { + encoding: "utf8", + }); messages = log .split("\x1e") .filter((entry) => entry.trim() !== "") .map((entry) => { - const [name = "", text = ""] = entry.trim().split("\0"); - return { name, text }; + const [name = "", email = "", text = ""] = entry.trim().split("\0"); + return { name, text, bot: email.endsWith("[bot]@users.noreply.github.com") }; }); } else { console.error("usage: check-commits.ts .. | --file "); @@ -26,8 +29,8 @@ if (first === "--file" && second) { } let bad = 0; -for (const { name, text } of messages) { - const problems = checkCommitMessage(text); +for (const { name, text, bot } of messages) { + const problems = checkCommitMessage(text, { bot }); if (problems.length === 0) continue; bad++; console.error(`${name}\n${problems.map((p) => ` - ${p}`).join("\n")}`); diff --git a/scripts/lib/commit-message.test.ts b/scripts/lib/commit-message.test.ts index 7018d0f..fc37aec 100644 --- a/scripts/lib/commit-message.test.ts +++ b/scripts/lib/commit-message.test.ts @@ -28,4 +28,11 @@ describe("checkCommitMessage", () => { expect(problems.length).toBeGreaterThan(0); expect(problems.join("\n")).toMatch(reason); }); + + test("a bot's subject may be longer than 72, but still needs a type", () => { + const long = "build(deps-dev): bump the development group across 1 directory with 4 updates"; + expect(checkCommitMessage(long, { bot: true })).toEqual([]); + expect(checkCommitMessage(long)).not.toEqual([]); + expect(checkCommitMessage("Bump vite from 7.1.0 to 7.1.1", { bot: true }).join("\n")).toMatch(/type/); + }); }); diff --git a/scripts/lib/commit-message.ts b/scripts/lib/commit-message.ts index a4cea41..5572fe2 100644 --- a/scripts/lib/commit-message.ts +++ b/scripts/lib/commit-message.ts @@ -7,9 +7,10 @@ const HEADER = new RegExp(`^(?:${COMMIT_TYPES.join("|")})(?:\\([a-z0-9-]+\\))?!? /** * The problems with one commit message, empty when it is fine. Lines that start with `#` are git's * comments and do not count. Checks the subject (type, optional scope, `!`, at most 72 characters, no - * final period) and the blank line after it; the body is free text. + * final period) and the blank line after it; the body is free text. A bot (Dependabot) writes its own + * subjects, often longer than 72, so for a bot the length is not checked. */ -export function checkCommitMessage(message: string): string[] { +export function checkCommitMessage(message: string, { bot = false } = {}): string[] { const lines = message.split("\n").filter((line) => !line.startsWith("#")); const subject = lines[0]?.trim() ?? ""; if (subject === "") return ["the message is empty"]; @@ -18,7 +19,7 @@ export function checkCommitMessage(message: string): string[] { problems.push( `the subject must start with ": " or "(): ", type one of ${COMMIT_TYPES.join(", ")}`, ); - if (subject.length > 72) problems.push(`the subject has ${subject.length} characters, at most 72`); + if (!bot && subject.length > 72) problems.push(`the subject has ${subject.length} characters, at most 72`); if (subject.endsWith(".")) problems.push("the subject ends with a period"); if ((lines[1] ?? "").trim() !== "") problems.push("the second line must be blank"); return problems; From 1b412a7062a7ba67cc1d5e804d122598f448f32d Mon Sep 17 00:00:00 2001 From: maxsol Date: Sat, 21 Nov 2026 15:38:19 +0100 Subject: [PATCH 2/3] build: leave the release-please manifest to release-please release-please writes .release-please-manifest.json as {".":"0.1.1"}, which Biome's formatter rejects, so pnpm check, and with it the release build, would fail on every release PR. The file is release-please's own; Biome skips it. --- biome.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biome.json b/biome.json index 844c89b..a78383d 100644 --- a/biome.json +++ b/biome.json @@ -7,7 +7,7 @@ }, "files": { "ignoreUnknown": true, - "includes": ["**", "!**/*.md", "!fixtures/claude-code", "!packages/mod/vendor"] + "includes": ["**", "!**/*.md", "!fixtures/claude-code", "!packages/mod/vendor", "!.release-please-manifest.json"] }, "formatter": { "indentStyle": "space", From 737df700c03bb060047f784b640cee5340308b07 Mon Sep 17 00:00:00 2001 From: maxsol Date: Sat, 21 Nov 2026 15:38:19 +0100 Subject: [PATCH 3/3] chore: ignore agents' git worktrees --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 7b73cf1..7e6dee0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ coverage/ .DS_Store # Written by Claude Code when it loads the mod from a folder it hot-reloads. packages/mod/.claude-plugin/types/ +# Agents' git worktrees. +.agents/worktrees/