← Winnitude! Search  ·  Reader Mode (1780 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 142 LINKS

GitHub - commit-check/commit-check: Commit policy as code for teams and AI agents: commit messages, branch names, authors, sign-offs, tags, files and AI attribution, checked from one config file.

Repository navigation

commit-check
Public

About

Commit policy as code for teams and AI agents: commit messages, branch names, authors, sign-offs, tags, files and AI attribution, checked from one config file.

commit-check.com/

Topics

ai-agents ai-attribution bitbucket-pipelines branch-name-validation branch-naming branch-naming-conventions code-quality commit-check commit-message-formatter commit-message-lint conventional-branch conventional-commits git-hooks git-lint github-actions gitlab-ci naming-conventions policy-as-code pre-commit yet-another-commit-checker

Resources

Readme MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy Activity Custom properties

Stars

103 stars

Watchers

2 watching

Forks

19 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


611 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.claude .claude    
.github .github    
assets assets    
bitbucket-pipe bitbucket-pipe    
commit_check commit_check    
fuzz fuzz    
skills/ commit-check skills/ commit-check    
tests tests    
.gitignore .gitignore    
.pre-commit-config.yaml .pre-commit-config.yaml    
.pre-commit-hooks.yaml .pre-commit-hooks.yaml    
AGENTS.md AGENTS.md    
CONTRIBUTING.md CONTRIBUTING.md    
LICENSE LICENSE    
README.md README.md    
cchk.toml cchk.toml    
noxfile.py noxfile.py    
pyproject.toml pyproject.toml    
uv.lock uv.lock    

Repository files navigation

Catch bad commits before they merge.

Docs · Rules · GitHub Action · GitHub App · GitLab CI · Bitbucket Pipelines · MCP server

Commit Check is commit policy as code for teams and AI agents. It validates commit messages, branch names, authors, sign-offs, tags, committed files and AI attribution against one cchk.toml -- in your commit hook, in CI, on every pull or merge request on GitHub, GitLab and Bitbucket, and inside your AI agent. When the fix is obvious, it hands you the line.

On GitHub? Install the Commit Check App and every push and pull request gets a check run, with no workflow file. It is free for public repositories and personal accounts.

Quick start

pip install commit-check        # Python 3.11+
commit-check --message --branch

No config needed: out of the box it checks Conventional Commits and Conventional Branch .

Use with pre-commit

Stop bad commits before they exist. In .pre-commit-config.yaml:

repos:
  - repo: https://github.com/commit-check/commit-check
    rev: v2.26.1
    hooks:
      - id: check-message
      - id: check-branch

Add args: [--fix] to check-message and the hook corrects mechanical slips itself -- a type's case, a missing colon -- instead of rejecting the commit. The hooks for the other checks (check-author-name, check-author-email, check-no-force-push, check-tag, check-files) are listed in the pre-commit guide .

Everywhere else

The same cchk.toml drives all of them:

Run it in How
GitHub, no workflow Install the GitHub App -- one check run per commit
GitHub Actions uses: commit-check/commit-check-action@v2 -- see commit-check-action
GitLab CI, Azure Pipelines A job in the pipeline -- see the CI guide
Bitbucket Pipelines The Commit Check pipe, one of Atlassian's official pipes -- see the CI guide
AI agents The agent skill , --format json, the Python API , or the MCP server

What it checks

Check Flag Rules
Commit message -- Conventional Commits, subject length, case and mood, WIP and fixup commits, body and its line length, sign-off --message CC001-CC012, CC018
AI attribution -- forbid it, or require an Assisted-by: disclosure --message CC013-CC017
Author name and email --author-name --author-email CC101-CC102
Branch name -- Conventional Branch, rebased onto a target --branch CC201-CC202
Force push --no-force-push CC301
Committed files -- size, forbidden paths, path length --files CC302-CC304
Tag names -- SemVer or your own pattern --tag CC401
AI declaration -- the pull request description ticks one of the template's boxes --pr-body --ai-attribution-only CC501
Issue reference -- the pull request description names the issue it is for --pr-body CC502
Description length -- the pull request description says enough in the author's own words --pr-body CC503
Pull or merge request title -- the message rules a one-line title can meet --pr-title CC001-CC010, CC013-CC016

Every rule, with examples: commit-check.com/rules

Configure

Put a cchk.toml (or commit-check.toml) in the repository root or in .github/:

[commit]
subject_max_length = 72
require_signed_off_by = true
ai_attribution = "disclose"
ignore_authors = ["dependabot[bot]", "renovate[bot]"]

[branch]
conventional_branch = true
  • Roll out gently: warn = ["CC003"] reports a rule in full without failing the run.
  • One policy per organization: inherit_from = "github:my-org/.github:cchk.toml" -- see organization config .
  • Override anywhere: every key has a CLI flag and a CCHK_* environment variable.
  • Editor support: the schema is on SchemaStore , so VS Code and JetBrains autocomplete cchk.toml.
Configuration reference -- every key, its default, CLI flag and environment variable

Priority: CLI > env > TOML > default. Booleans accept true/false, yes/no, 1/0; lists are comma-separated on the CLI and in env vars.

Key Default CLI flag Env var Meaning
warn (top level) [] -- -- Checks or rule IDs to report without failing the run (see "Report a rule without enforcing it")
commit.conventional_commits true --conventional-commits CCHK_CONVENTIONAL_COMMITS Enforce the Conventional Commits format (CC001)
commit.message_pattern "" -- CCHK_MESSAGE_PATTERN Custom regex the whole message must match; when set it replaces the Conventional Commits check (still reported as CC001)
commit.subject_capitalized false --subject-capitalized CCHK_SUBJECT_CAPITALIZED Require the subject to start with a capital letter (CC002)
commit.subject_imperative false --subject-imperative CCHK_SUBJECT_IMPERATIVE Require the subject to use the imperative mood (CC003)
commit.subject_max_length 80 --subject-max-length CCHK_SUBJECT_MAX_LENGTH Maximum subject length (CC004), not counting the (#123) a GitHub squash merge adds; the Revert "..." and Reapply "..." subjects git revert writes, and the fixup!, squash! and amend! subjects git commit --fixup and --squash write, are not measured; 0 turns it off. Commits by dependabot[bot] and renovate[bot] skip both length rules
commit.subject_min_length 5 --subject-min-length CCHK_SUBJECT_MIN_LENGTH Minimum subject length (CC005); 0 turns it off
commit.allow_commit_types feat, fix, docs, style, refactor, test, chore, perf, build, ci, revert --allow-commit-types CCHK_ALLOW_COMMIT_TYPES Allowed <type> values in the subject
commit.allow_merge_commits true --allow-merge-commits CCHK_ALLOW_MERGE_COMMITS Allow merge commits (CC006)
commit.allow_revert_commits true --allow-revert-commits CCHK_ALLOW_REVERT_COMMITS Allow the Revert "..." and Reapply "..." commits git revert writes (CC007)
commit.allow_empty_commits true --allow-empty-commits CCHK_ALLOW_EMPTY_COMMITS Allow empty commit messages (CC008)
commit.allow_fixup_commits true --allow-fixup-commits CCHK_ALLOW_FIXUP_COMMITS Allow fixup!, squash! and amend! commits (CC009)
commit.allow_wip_commits true --allow-wip-commits CCHK_ALLOW_WIP_COMMITS Allow WIP commits (CC010)
commit.require_body false --require-body CCHK_REQUIRE_BODY Require a commit body (CC011)
commit.body_max_line_length 0 --body-max-line-length CCHK_BODY_MAX_LINE_LENGTH Maximum length of a body line (CC018); 0 turns it off. Lines with a URL, a single word with no space (a path, a hash) and the trailer block are not counted, and dependabot[bot] and renovate[bot] commits skip it
commit.require_signed_off_by false --require-signed-off-by CCHK_REQUIRE_SIGNED_OFF_BY Require a Signed-off-by: trailer (CC012)
commit.ignore_authors [] --ignore-authors CCHK_IGNORE_AUTHORS Authors and co-authors whose commits skip the commit checks
commit.ai_attribution "ignore" --ai-attribution CCHK_AI_ATTRIBUTION ignore, forbid, disclose or require. forbid rejects commits carrying known AI tool signatures (CC013); disclose accepts AI assistance disclosed with one of ai_disclosure_trailers (CC014) and rejects the tool as a co-author (CC015) or as a sign-off (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); all reject a commit whose author is an AI tool (CC017)
commit.ai_disclosure_trailers Assisted-by, Generated-by --ai-disclosure-trailers CCHK_AI_DISCLOSURE_TRAILERS Trailers that disclose AI assistance under disclose and require; the first is the one a fix is written with. List Co-authored-by to accept the tool as a co-author
commit.ai_disclosure_pattern "" --ai-disclosure-pattern CCHK_AI_DISCLOSURE_PATTERN Regex the disclosure's value must match under disclose and require, e.g. ^\S+/\S+ for agent/model; empty accepts any value, but a trailer with no value at all is always reported
commit.author_email_pattern "^.+@.+$" --author-email-pattern CCHK_AUTHOR_EMAIL_PATTERN Regex the author email must match (CC102, with --author-email)
commit.author_name_pattern "" --author-name-pattern CCHK_AUTHOR_NAME_PATTERN Regex the author name must match (CC101, with --author-name)
branch.conventional_branch true --conventional-branch CCHK_CONVENTIONAL_BRANCH Enforce <type>/<description> branch names (CC201)
branch.require_description_grammar false --require-description-grammar CCHK_REQUIRE_DESCRIPTION_GRAMMAR Also hold the description after <type>/ to the Conventional Branch grammar: lowercase alphanumeric words joined by single hyphens, dots allowed inside a word (CC201). Off by default, since bot branches such as dependabot/npm_and_yarn/lodash-4.17.21 do not follow it
branch.allow_branch_types feature, bugfix, hotfix, release, chore, feat, fix, build, ci, docs, perf, refactor, test, style, ai, claude, codex, copilot, cursor, agents, dependabot, renovate --allow-branch-types CCHK_ALLOW_BRANCH_TYPES Allowed branch <type> prefixes; each entry is a regex matched against the whole type
branch.allow_branch_names [] --allow-branch-names CCHK_ALLOW_BRANCH_NAMES Extra branch names allowed besides main, master, develop, HEAD, PR-.+, gh-readonly-queue/.+ (GitHub merge queue); each entry is a regex matched against the whole branch name, so create-pull-request/.+ allows a family of them
branch.require_rebase_target "" --require-rebase-target CCHK_REQUIRE_REBASE_TARGET Branch the current branch must be rebased onto (CC202); empty disables
branch.ignore_authors [] --branch-ignore-authors CCHK_BRANCH_IGNORE_AUTHORS Authors whose branches skip the branch checks
push.allow_force_push true -- (--no-force-push runs the check) CCHK_ALLOW_FORCE_PUSH Reserved; has no effect today. CC301 runs only with --no-force-push, which always rejects a non-fast-forward push
tag.regex SemVer with optional v --tag-regex CCHK_TAG_REGEX Pattern tag names must match (CC401); empty disables
files.max_size "" (off) --files-max-size CCHK_FILES_MAX_SIZE Largest committed file, in bytes or with KB/MB/GB (CC302)
files.prohibited_patterns [] --files-prohibited-patterns CCHK_FILES_PROHIBITED_PATTERNS fnmatch patterns committed paths must not match (CC303)
files.max_path_length 0 (off) --files-max-path-length CCHK_FILES_MAX_PATH_LENGTH Longest allowed committed path, in characters (CC304)
agent.enabled false --agent-enabled CCHK_AGENT_ENABLED Report risky settings in the agent config files a commit touches, with --files: MCP servers approved without asking (CC601), API requests sent to another endpoint (CC602), commands run without asking or outside the sandbox (CC603), and agent workflows anyone can start (CC604). Covers Claude Code, Codex, Gemini CLI, Cursor CLI, GitHub Copilot in VS Code and the Claude Code GitHub Action; the list is agent_configs.toml
agent.allow_mcp_servers [] --agent-allow-mcp-servers CCHK_AGENT_ALLOW_MCP_SERVERS MCP servers, by name, that the agent config may approve (CC601)
agent.allow_api_endpoints [] --agent-allow-api-endpoints CCHK_AGENT_ALLOW_API_ENDPOINTS API endpoint URLs the agent config may send requests to (CC602), such as your company's LLM gateway
pull_request.ai_declaration_checkboxes [] (off) -- -- The AI declaration checkboxes of your pull request template (often headed "AI disclosure"), e.g. ["No AI tools were used", "AI tools were used"]. A description checked with --ai-attribution-only must tick exactly one of them (CC501). Each entry matches a box whose text starts with it, ignoring case and bold; boxes in HTML comments and code blocks do not count
pull_request.require_issue_reference false -- -- A description checked with --pr-body must name an issue (CC502): #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. Add bots such as Dependabot to commit.ignore_authors
pull_request.issue_reference_pattern "" (the forms above) -- -- A regex that replaces what counts as naming an issue (CC502), e.g. "\\bPROJ-\\d+\\b" for the Jira keys of one project
pull_request.description_min_length 0 (off) -- -- A description checked with --pr-body must have at least this many characters of the author's own words (CC503). HTML comments, headings, task-list lines, rules (---) and empty bullets do not count, so an untouched template fails

Output and appearance are per-run flags, not configuration: --format json, --no-banner, --compact, --dry-run, --rev, --config. Color follows NO_COLOR / FORCE_COLOR. Long-form descriptions: commit-check.com/configuration

AI-native usage

--format json gives each check a stable rule ID, the value it saw and a suggestion -- plus the corrected value itself when the correction is mechanical, so an agent can apply it without interpreting anything:

echo "Fix: add streaming support" | commit-check -m --format json

The failing entry of its checks array:

{
  "rule_id": "CC001",
  "check": "message",
  "status": "fail",
  "value": "Fix: add streaming support",
  "error": "The commit message should follow Conventional Commits. See https://www.conventionalcommits.org",
  "suggest": "Use \"fix: add streaming support\"",
  "fix": "fix: add streaming support",
  "docs_url": "https://commit-check.com/rules/#cc001",
  "reason": ""
}

A check that did not run has status skip, and reason says why when the author is on an ignore_authors list: "author dependabot[bot] is in [commit].ignore_authors". The top-level status is skip when every check skipped, or when no check ran at all; the exit code is still 0.

A setting that is not in force, such as a misspelt key, an inherit_from that could not be loaded, a [files] value that cannot be used or an invalid CCHK_* value, is printed on stderr and also listed in notices, which is empty when there are none:

"notices": [
  {
    "setting": "[commit] subject_max_lenght",
    "message": "unknown setting [commit] subject_max_lenght is ignored; did you mean subject_max_length?"
  }
]

With a message checked, the output also has ai_tools: the AI tools found by their known signatures in the message (and by a commit's author), under any ai_attribution policy. --ai-attribution-only runs only the AI rules (CC013 to CC016), for text that is not a commit message, such as a pull request description. With [pull_request] ai_declaration_checkboxes set, it also checks that the description ticks exactly one of those boxes (CC501). Under the default ai_attribution = "ignore" no AI rule runs. Without ai_declaration_checkboxes no check runs at all, so the status is skip and only ai_tools reports what was found; set forbid or disclose to enforce a policy:

commit-check --ai-attribution-only --format json < pr-description.md

--pr-body runs every rule a description can meet: the AI rules above and, when [pull_request] turns them on, the issue reference (CC502) and the length (CC503).

Validate a commit message with the Python API, without a subprocess:

from commit_check.api import validate_message

validate_message("feat: add streaming support")["status"]  # "pass"

commit_check.api also has validate_branch, validate_author, validate_tag, validate_push and validate_all, all returning the same shape. Unlike the CLI they do not read cchk.toml: pass the policy as a config dict. The Python API page covers each function and how to load a repository's file.

Exit codes: 0 passed · 1 a check failed · 2 nothing was checked -- bad usage, or a config that is missing, is not valid TOML, names an unknown rule, holds a regex that does not compile or gives a [commit] or [branch] setting a value of the wrong type (subject_max_length = "abc"), or git cannot read the repository (not a repository, or "dubious ownership"). A [files] value it cannot use turns that rule off with a notice instead. --dry-run reports everything and exits 0. More output formats: examples .

Agent skill

skills/commit-check teaches a coding agent to read the project's cchk.toml, check a message before it commits, follow the AI attribution policy and never skip the hook. It uses the Agent Skills format, which Claude Code, GitHub Copilot, Codex, Cursor and others load:

npx skills add https://github.com/commit-check/commit-check --skill commit-check

Or copy the folder into your agent's skills directory, such as .claude/skills/commit-check/ for Claude Code.

Why Commit Check

Commit Check commitlint GitHub Rulesets
Conventional Commits ✅ ✅ regex only
Branch, tag, author and file rules ✅ ❌ ✅*
Feedback before the push ✅ ✅ ❌
Works with zero config ✅ ❌ ❌
No Node.js ✅ ❌ ✅
JSON output, Python API, MCP ✅ ❌ ❌

*Push rulesets need a Team or Enterprise plan for private repositories. The full comparison, including YACC and custom hooks: commit-check.com/compare

Show that you use it

[![commit-check](https://commit-check.com/badge.svg)](https://commit-check.com)

Community

Questions and ideas go to Discussions , bugs to Issues . Releases follow Semantic Versioning . Released under the MIT License .

Thanks to everyone who has contributed. Want to join them? Start with CONTRIBUTING.md .

About

Commit policy as code for teams and AI agents: commit messages, branch names, authors, sign-offs, tags, files and AI attribution, checked from one config file.

commit-check.com/

Topics

ai-agents ai-attribution bitbucket-pipelines branch-name-validation branch-naming branch-naming-conventions code-quality commit-check commit-message-formatter commit-message-lint conventional-branch conventional-commits git-hooks git-lint github-actions gitlab-ci naming-conventions policy-as-code pre-commit yet-another-commit-checker

Resources

Readme MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy Activity Custom properties

Stars

103 stars

Watchers

2 watching

Forks

19 forks Report repository

Releases

Sponsor this project

Used by

Contributors

Languages