From 8facc6054f1ab6baa88cab63da1f06fb3469bee0 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 --- .github/workflows/pr-title-check.yml | 21 +++++++++++++++++++++ AGENTS.md | 4 ++++ scripts/check-pr-title.cjs | 18 ++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 .github/workflows/pr-title-check.yml create mode 100644 scripts/check-pr-title.cjs diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml new file mode 100644 index 000000000..2a8f7a038 --- /dev/null +++ b/.github/workflows/pr-title-check.yml @@ -0,0 +1,21 @@ +name: PR Title Check + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + branches: [main] + +permissions: + contents: read + +jobs: + pr-title: + name: Check PR title + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - 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" diff --git a/AGENTS.md b/AGENTS.md index 25703130b..d098a09b7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,9 @@ # ADCP Python SDK - Agent Reference +## PR Title Hygiene + +Use concrete conventional-commits PR titles (`fix(scope): summary`, `docs: summary`, `feat(scope): summary`). Do not prefix titles with the tool or model that authored the PR, such as `[codex]`, `[claude]`, `[cursor]`, or similar ownership tags. Put authoring-tool context in the PR body or labels when it matters, not in the review-facing title. + ## Server Handler Methods Override these in your `ADCPHandler` subclass. Unimplemented methods return `not_supported()`. diff --git a/scripts/check-pr-title.cjs b/scripts/check-pr-title.cjs new file mode 100644 index 000000000..5f5ab6fba --- /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); +}