From bf8721b5f6639160cd1efa3c6efefda0b609ceca Mon Sep 17 00:00:00 2001 From: Brian O'Kelley Date: Thu, 28 May 2026 03:49:53 -0400 Subject: [PATCH] fix(ci): block agent PR title prefixes --- .changeset/block-agent-pr-title-prefixes.md | 7 +++++++ .github/workflows/commitlint.yml | 5 +++++ CLAUDE.md | 1 + scripts/check-pr-title.cjs | 18 ++++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 .changeset/block-agent-pr-title-prefixes.md create mode 100644 scripts/check-pr-title.cjs diff --git a/.changeset/block-agent-pr-title-prefixes.md b/.changeset/block-agent-pr-title-prefixes.md new file mode 100644 index 0000000..1b6a899 --- /dev/null +++ b/.changeset/block-agent-pr-title-prefixes.md @@ -0,0 +1,7 @@ +--- +--- + +ci: reject agent-prefixed PR titles such as `[codex]`. + +Empty changeset because this only affects repository automation and agent +guidance, not the published Java SDK package. diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 40af32a..013d379 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -24,6 +24,11 @@ jobs: - name: Install dependencies run: npm ci + - name: Check for agent/tool PR title prefix + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: node scripts/check-pr-title.cjs "$PR_TITLE" + - name: Validate PR title follows conventional commits env: PR_TITLE: ${{ github.event.pull_request.title }} diff --git a/CLAUDE.md b/CLAUDE.md index 59bdd5b..12494c4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -55,6 +55,7 @@ Build infrastructure: - **`*Request` builds, `*Response` doesn't.** This naming invariant prevents IDE auto-complete from suggesting `.builder()` on response types. - **SLF4J for logging.** Not `java.util.logging`. - **Conventional Commits** for commit messages. Types: `feat fix docs style refactor perf test build ci chore revert`. +- **Conventional PR titles** without agent/tool prefixes. Never start titles with `[codex]`, `[claude]`, `[cursor]`, or similar ownership tags. - **Changesets** for adopter-visible changes (`npx changeset`). ## Don't diff --git a/scripts/check-pr-title.cjs b/scripts/check-pr-title.cjs new file mode 100644 index 0000000..5f5ab6f --- /dev/null +++ b/scripts/check-pr-title.cjs @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +const title = (process.argv.slice(2).join(' ') || process.env.PR_TITLE || '').trim(); + +if (!title) { + console.error('PR title is empty.'); + process.exit(1); +} + +const disallowedAgentPrefix = + /^\[(codex|claude|claude-code|openai|chatgpt|copilot|cursor|aider|devin|agent|ai)\](?:\s|:|-|$)/i; + +if (disallowedAgentPrefix.test(title)) { + console.error(`Invalid PR title: ${title}`); + console.error('Remove the leading agent/tool prefix. Use a concrete conventional-commits title instead, for example:'); + console.error(' fix(ci): block agent PR title prefixes'); + process.exit(1); +}