Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ page that documents it.

| Version | What changed | Documented in |
|---|---|---|
| [2.26.0](#v2260) | A pull request description must name an issue or say enough (opt-in); `ai_attribution = "require"` asks every commit to declare AI use | [CC502](rules.md#cc502) · [CC503](rules.md#cc503) · [Asking every commit to answer](guides/policies.md#asking-every-commit-to-answer) |
| [2.25.0](#v2250) | Risky settings in committed coding agent config files reported: MCP servers approved without asking, another API endpoint, full access, workflows anyone can start (opt-in) | [Agent config rules](rules.md#agent-config-rules) · [`[agent]`](configuration.md#agent) |
| [2.24.2](#v2242) | A Bitbucket Pipelines pipe runs `commit-check-ci` in a step with no install | [Bitbucket Pipelines](guides/other-ci.md#bitbucket-pipelines) |
| [2.24.0](#v2240) | `body_max_line_length` limits the length of a body line (opt-in); the JSON lists settings that are not in force in `notices` | [CC018](rules.md#cc018) · [Reading the JSON](example.md#reading-the-json) |
Expand Down Expand Up @@ -48,6 +49,15 @@ page that documents it.
| [2.5.0](#v250) | Organization-wide config with `inherit_from` | [Across an organization](guides/organization.md) |
| [2.0.0](#v200) | Configuration moved from YAML to TOML — breaking | [Migrating from v1](migration.md) |

## v2.26.0 (2026-12-04) { #v2260 }

### Added

* `--pr-body` checks a pull request description against every rule a description can meet. ([Checking a pull request description](guides/policies.md#checking-a-pull-request-description), [#750](https://github.com/commit-check/commit-check/pull/750))
* `require_issue_reference` fails a pull request description that names no issue. ([CC502](rules.md#cc502), [#750](https://github.com/commit-check/commit-check/pull/750))
* `description_min_length` fails a pull request description with too few of the author's own words. ([CC503](rules.md#cc503), [#751](https://github.com/commit-check/commit-check/pull/751))
* `ai_attribution = "require"` asks every commit, except merges, reverts and fixups, for `Assisted-by: <tool>` or `Assisted-by: none`; list Dependabot and Renovate in `ignore_authors`. ([CC014](rules.md#cc014), [#749](https://github.com/commit-check/commit-check/pull/749))

## v2.25.0 (2026-11-27) { #v2250 }

### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/compare/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Replace the hook:
```yaml title=".pre-commit-config.yaml"
repos:
- repo: https://github.com/commit-check/commit-check
rev: v2.25.0
rev: v2.26.0
hooks:
- id: check-message
```
Expand Down
13 changes: 8 additions & 5 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Used from a hook definition, with no config file anywhere in the repository:
```yaml title=".pre-commit-config.yaml"
repos:
- repo: https://github.com/commit-check/commit-check
rev: v2.25.0
rev: v2.26.0
hooks:
- id: check-message
args:
Expand Down Expand Up @@ -420,9 +420,9 @@ These two sit above every section, at the top of the file.
| `author_email_pattern` | str | `^.+@.+$` | Custom regex for the author email check. When empty, the built-in default pattern is used. This option only takes effect when the author_email check is enabled (`-e` / `--author-email`). |
| `author_name_pattern` | str | "" (built-in default) | Custom regex for the author name check. When empty, the built-in default pattern is used (it is not disabled). This option only takes effect when the author_name check is enabled (`-n` / `--author-name`). |
| `require_signed_off_by` | bool | false | Require "Signed-off-by" line in the commit message footer. |
| `ai_attribution` | str | "ignore" | AI attribution policy. `"forbid"` rejects any commit carrying AI attribution — a co-author or sign-off line naming a known tool, a disclosure trailer, a vendor mark ([CC013](rules.md#cc013)). `"disclose"` accepts AI assistance that is disclosed with one of `ai_disclosure_trailers` ([CC014](rules.md#cc014)) and rejects the tool as a co-author ([CC015](rules.md#cc015)) or as a sign-off ([CC016](rules.md#cc016)). `"ignore"` disables the check. Any other value is a configuration error. |
| `ai_disclosure_trailers` | list[str] | ["Assisted-by", "Generated-by"] | The trailers that disclose AI assistance under `"disclose"`. The first one is what a correction is written with. Listing `Co-authored-by` says the project accepts the tool as a co-author, and CC015 then passes. `Signed-off-by` is refused: only a person can certify the DCO. |
| `ai_disclosure_pattern` | str | "" (any value) | A regex the disclosure trailer's value must match under `"disclose"`, e.g. `'^\S+/\S+$'` for an `agent/model` format. Empty accepts any value, but a trailer with no value at all is reported whatever the pattern is. |
| `ai_attribution` | str | "ignore" | AI attribution policy. `"forbid"` rejects any commit carrying AI attribution — a co-author or sign-off line naming a known tool, a disclosure trailer, a vendor mark ([CC013](rules.md#cc013)). `"disclose"` accepts AI assistance that is disclosed with one of `ai_disclosure_trailers` ([CC014](rules.md#cc014)) and rejects the tool as a co-author ([CC015](rules.md#cc015)) or as a sign-off ([CC016](rules.md#cc016)). `"require"` is `"disclose"` with a disclosure on every commit: `Assisted-by: none` when no AI tool helped; merge, revert and fixup commits are not asked. Add bots such as `"dependabot[bot]"` to `ignore_authors` under `"require"`. `"ignore"` disables the check. Any other value is a configuration error. |
| `ai_disclosure_trailers` | list[str] | ["Assisted-by", "Generated-by"] | The trailers that disclose AI assistance under `"disclose"` and `"require"`. The first one is what a correction is written with. Listing `Co-authored-by` says the project accepts the tool as a co-author, and CC015 then passes. `Signed-off-by` is refused: only a person can certify the DCO. |
| `ai_disclosure_pattern` | str | "" (any value) | A regex the disclosure trailer's value must match under `"disclose"` and `"require"`, e.g. `'^\S+/\S+$'` for an `agent/model` format. Empty accepts any value, but a trailer with no value at all is reported whatever the pattern is. `Assisted-by: none` is accepted whatever the pattern is. |

{.fields}

Expand Down Expand Up @@ -486,7 +486,10 @@ Read by `--files`. See [Agent config rules](rules.md#agent-config-rules).
| Option | Type | Default | Description |
|---|---|---|---|
| `check` | str | "commits" | GitHub App only. `"commits"` checks every commit of a pull request on its own; `"squash"` checks the one message a squash merge would land, built from the repository's merge settings. See [Pull requests](#pull-requests-every-commit-or-the-squash-message). |
| `ai_declaration_checkboxes` | list[str] | [] (rule off) | The texts of the AI declaration boxes in the pull request template, one per box. When set, a pull request description checked with `--ai-attribution-only` must tick exactly one of them; see [CC501](rules.md#cc501). Read by the CLI, the Action and the App. |
| `ai_declaration_checkboxes` | list[str] | [] (rule off) | The texts of the AI declaration boxes in the pull request template, one per box. When set, a pull request description checked with `--pr-body` or `--ai-attribution-only` must tick exactly one of them; see [CC501](rules.md#cc501). Read by the CLI, the Action and the App. |
| `require_issue_reference` | bool | false | A pull request description checked with `--pr-body` must name an issue: `#123`, `GH-123`, `owner/repo#123`, or a link to an issue on GitHub, GitLab or Bitbucket Cloud, or to a Jira ticket. References in HTML comments and code do not count. See [CC502](rules.md#cc502). |
| `issue_reference_pattern` | str | "" (the forms above) | A regex that replaces what counts as naming an issue, e.g. `"\\bPROJ-\\d+\\b"` for the Jira keys of one project. See [CC502](rules.md#cc502). |
| `description_min_length` | int | 0 (rule off) | A pull request description checked with `--pr-body` must have at least this many characters of the author's own words. HTML comments, headings, task-list lines, rules (`---`) and empty bullets do not count, so an untouched template fails. See [CC503](rules.md#cc503). |
| `body_ai_attribution` | bool | false | GitHub App only. Check the pull request description against the AI rules (CC013 to CC016), and its AI declaration boxes when `ai_declaration_checkboxes` is set. The Action's `pr-body-ai-attribution` input does the same. See [AI-written pull requests](guides/github-app.md#ai-written-pull-requests). |
| `ai_label` | bool or str | false | GitHub App only. Label a pull request an AI tool wrote any of: `true` for `ai-assisted`, or the label's name. Labels are only added, never removed. |

Expand Down
2 changes: 1 addition & 1 deletion docs/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pushed:
```yaml title=".pre-commit-config.yaml"
repos:
- repo: https://github.com/commit-check/commit-check
rev: v2.25.0
rev: v2.26.0
hooks:
- id: check-no-force-push
stages: [pre-push]
Expand Down
19 changes: 15 additions & 4 deletions docs/guides/other-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,17 @@ In a job written by hand they are `--pr-title` and `--pr-body-ai-attribution`.
`ai_attribution` policy, and, when `[pull_request] ai_declaration_checkboxes`
is set, that it ticks exactly one AI declaration box (CC501). GitLab task
lists (`- [x]`, `* [x]`, `1. [x]`) are read like GitHub's.
- The description is also checked, with no input, as soon as `cchk.toml`
sets `[pull_request] require_issue_reference` (CC502) or
`description_min_length` (CC503); see
[Requiring an issue and a real description](policies.md#requiring-an-issue-and-a-real-description).
`#123` and links to GitLab issues and work items count as references.
- GitLab passes a job only the first 2700 characters of a description, so
only that part is checked, and the job says so when it happens. Put the AI
declaration boxes near the top of the merge request template, so a long
description does not cut them off. To fail a description that was cut
description does not cut them off. When the part GitLab passed does not
name an issue or is too short, CC502 and CC503 are left undecided rather
than failed, since the rest may meet them. To fail a description that was cut
rather than check part of it, give the job a `before_script`. A job of the
same name in your `.gitlab-ci.yml` is merged with the component's:

Expand All @@ -197,7 +204,7 @@ pipelines:
clone:
depth: full
script:
- pipe: commit-check/commit-check:2.25.0
- pipe: commit-check/commit-check:2.26.0
```

The pipe runs `commit-check-ci` from the commit-check release of the same
Expand Down Expand Up @@ -229,7 +236,7 @@ Each check is a variable, with the same defaults as the
| `PR_BODY_AI_ATTRIBUTION` | `false` | The description, against the AI attribution rules. |

```yaml
- pipe: commit-check/commit-check:2.25.0
- pipe: commit-check/commit-check:2.26.0
variables:
AUTHOR_EMAIL: 'true'
BRANCH: 'false'
Expand Down Expand Up @@ -271,7 +278,7 @@ with the **Pull requests: Read** scope, store it as a secured repository
variable named `BITBUCKET_ACCESS_TOKEN`, and switch the two checks on:

```yaml
- pipe: commit-check/commit-check:2.25.0
- pipe: commit-check/commit-check:2.26.0
variables:
PR_TITLE: 'true'
PR_BODY_AI_ATTRIBUTION: 'true'
Expand All @@ -282,6 +289,10 @@ In a step written by hand they are `commit-check-ci --pr-title
--pr-body-ai-attribution`, and the variable reaches the command without
being named.

Once `cchk.toml` sets `[pull_request] require_issue_reference` (CC502) or
`description_min_length` (CC503), the description is checked without
`PR_BODY_AI_ATTRIBUTION`, so the step needs the token for them too.

Without the token, or with one Bitbucket refuses, the two checks fail
and say why: a title that could not be read is never checked as empty text.
The two checks work as in the
Expand Down
69 changes: 69 additions & 0 deletions docs/guides/policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ $ gh pr view 42 --json body -q .body | commit-check --ai-attribution-only --form
["Devin"]
```

`--pr-body` reads the description the same way and runs every rule a
description can meet: the AI rules, and the
[AI declaration](#requiring-the-templates-ai-declaration),
[issue reference and length](#requiring-an-issue-and-a-real-description)
when `[pull_request]` turns them on.

### Requiring the template's AI declaration

Many pull request templates ask the author to tick one of two boxes, such as
Expand Down Expand Up @@ -265,6 +271,43 @@ It works on its own: `ai_attribution` can stay at `"ignore"`. In the
edited; the Action does too once its workflow lists `edited` under
`pull_request` `types`.

### Requiring an issue and a real description

Two more checks catch a pull request nobody prepared: no issue behind it, or
the template sent back untouched. Both are off until you set them:

```toml title="cchk.toml"
[pull_request]
require_issue_reference = true # CC502
description_min_length = 50 # CC503
```

```console
$ gh pr view 42 --json body -q .body | commit-check --pr-body
✖ Rejected by Commit Check · 2 checks failed

✖ CC502 issue-reference failed: (none)
The pull request description does not reference an issue
Suggest: Name the issue this change is for, e.g. "Fixes #123"
Docs: https://commit-check.com/rules/#cc502

✖ CC503 description-min-length failed: (none)
The pull request description is too short: 0 of at least 50 characters
Suggest: Say what the change does and why
Docs: https://commit-check.com/rules/#cc503
```

[CC502](../rules.md#cc502) accepts `#123`, `GH-123`, `owner/repo#123` and
links to GitHub, GitLab, Bitbucket Cloud and Jira issues; set
`issue_reference_pattern` for anything else. [CC503](../rules.md#cc503)
counts only the author's own words, so comments, headings and checkboxes from
the template do not add up to a description. References and words inside HTML
comments do not count for either. List bots in `commit.ignore_authors`, since
a Dependabot pull request names no issue.

`commit-check-ci` runs both on [GitLab and Bitbucket](other-ci.md#merge-request-title-and-description)
as soon as they are set.

### Asking for disclosure instead

Most projects that allow AI assistance ask to be told about it.
Expand Down Expand Up @@ -321,6 +364,32 @@ a commit in the kernel's `Assisted-by:` format passes all three:
printf 'feat: add caching layer\n\nAssisted-by: LLM coccinelle sparse\nSigned-off-by: Jane Dev <jane@example.com>' | commit-check -m
```

### Asking every commit to answer

`"disclose"` only asks commits that show AI assistance. A project that wants a
yes or no on every commit, for a report or an audit, sets `"require"`:

```toml title="cchk.toml"
[commit]
ai_attribution = "require"
ignore_authors = ["dependabot[bot]", "renovate[bot]"]
```

Every commit then carries `Assisted-by: <tool>`, or `Assisted-by: none` when
no AI tool helped; merge, revert and fixup commits are not asked. It runs the
same three rules as `"disclose"`, and [CC014](../rules.md#cc014) also fails a
commit that says nothing:

```text
✖ CC014 ai-disclosure failed: fix: handle empty input
No AI disclosure: every commit must say whether an AI tool helped, with Assisted-by or Generated-by
Suggest: Add "Assisted-by: <tool>", or "Assisted-by: none" when no AI tool helped (set by ai_attribution = "require" in the [commit] config)
Docs: https://commit-check.com/rules/#cc014
```

`Assisted-by: none` on a commit that does show an AI tool fails too. Bots
write no disclosure, so list them in `ignore_authors`.

### Choosing the format

`ai_disclosure_trailers` is the list of trailers that count as a disclosure,
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/pre-commit.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Add Commit Check to `.pre-commit-config.yaml`:
```yaml title=".pre-commit-config.yaml"
repos:
- repo: https://github.com/commit-check/commit-check
rev: v2.25.0
rev: v2.26.0
hooks:
- id: check-message
- id: check-branch
Expand Down Expand Up @@ -68,7 +68,7 @@ Options can be passed as hook arguments, which keeps everything in one file:
```yaml title=".pre-commit-config.yaml"
repos:
- repo: https://github.com/commit-check/commit-check
rev: v2.25.0
rev: v2.26.0
hooks:
- id: check-message
args:
Expand All @@ -90,7 +90,7 @@ colon, and lets the commit through:
```yaml title=".pre-commit-config.yaml"
repos:
- repo: https://github.com/commit-check/commit-check
rev: v2.25.0
rev: v2.26.0
hooks:
- id: check-message
args: [--fix]
Expand Down
Loading