← Back to Discover

commitpreflight

A Python linter that vets the commit messages an AI coding agent drafts, flags format problems before the commit, and suggests a fix for each. It runs as a CLI, git hook, pre-commit hook or GitHub Action.

Command-line tools

What it does

commitpreflight checks a commit message before git commit runs, so an agent does not lose a turn when a hook rejects it. For each finding it returns the rule, a severity and a concrete suggested rewrite rather than a bare complaint. The rules cover conventional-commit format (tag(scope): subject), tag case and allowed tags, required or empty scopes, empty or over-long subjects, trailing periods, a blank line before the body, imperative mood, subject capitalisation and body line length. The project says its rules come from a log of 10,976 command-line failures from autonomous coding agents over a week, about one in five of which was a malformed commit message. When a subject is only a few characters over the limit it suggests a trim at the last word boundary, and it declines to suggest one when trimming would amount to a rewrite. Install it with pip. It runs from the command line, as a commit-msg git hook, through pre-commit, as a GitHub Action over pull request commits, or from Python. A --json flag gives agents machine-readable output, and limits and rule choices can be set in pyproject.toml. The code is MIT licensed, and a Team subscription for running it across a fleet of agents is listed at $100 a month.

Capabilities

  • Lints commit messages before the commit and suggests a concrete fix
  • Rules for conventional format, subject length, tags, scope and mood
  • JSON output that an agent can act on directly
  • Runs as a CLI, git hook, pre-commit hook or GitHub Action
  • Limits and rules configurable in pyproject.toml

When to use it

  • AI coding agents keep having their commit messages rejected by hooks
  • You want pull request commits checked in CI
  • You use conventional commits and want a consistent subject format