bunderlog

Docs

Hathi

Commit and repo checks for Git hooks and CI. The same verdict on your machine, in a Git hook and in CI, whether or not the commit came from Claude Code.

Hathi is a Go binary. It needs Git on the path and nothing else: no Python, no Node, no Claude. It writes no file and no Git config; your hooks and CI call it.

Install

# mise.toml
[tools]
"github:bunderlog/hathi" = "1.2.0"

Pin an exact version. For a release’s first 24 hours mise holds it back from a partial pin such as 1.2. Without mise: go install github.com/bunderlog/hathi@v1.2.0, or a binary from GitHub Releases for macOS and Linux (amd64, arm64) and Windows (amd64), with SHA256SUMS.

Git hooks

Commit three hooks and turn them on once per clone:

#!/bin/sh
# .githooks/commit-msg
exec hathi check commit-msg "$@"
git config core.hooksPath .githooks

pre-commit and pre-push are alike; hathi hooks print <hook> prints each. husky, lefthook or a plain .git/hooks/ script work the same way.

CI

In GitHub Actions, hathi check ci finds the new commits of the push or pull request by itself. It needs the full history and read access only:

permissions:
  contents: read
steps:
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
    with:
      fetch-depth: 0
      persist-credentials: false
  - uses: jdx/mise-action@b44d12e7d0d8ee7461bb893e1b1993500433185b # v5.2.7
  - run: hathi check ci

Elsewhere, hathi check --range "$BASE..$HEAD". Both check each commit on its own: its message, then its changes against its parent, with that commit’s own .hathi.yml. So a secret one commit adds and the next removes still fails. They need Git 2.40 or later.

Checks

Every check is on by default. A check with no key in .hathi.yml runs with its defaults.

Check Hook What fails
conventional-commits commit-msg A message that isn’t type(scope): description as commitlint’s config-conventional reads it
no-ai-coauthor commit-msg An AI as Co-authored-by, or a “Generated with” credit line
no-secrets-in-commits pre-commit An Env file, or a secret of a known kind on an added line
no-conflict-markers pre-commit A leftover conflict marker
no-large-files pre-commit A new file over max-size
no-stale-adr-date pre-commit An edited ADR whose Date: isn’t the day of the change
linear-history pre-push A merge commit in the push

conventional-commits

The subject is type(scope)!: description; the type and scope are in your lists; the description doesn’t start with a capital letter or end with a full stop; a blank line follows the subject; no line is over max-length; a breaking change is written BREAKING CHANGE:. Messages Git writes itself (merges, reverts, fixup!) pass.

Setting Default Meaning
types the 11 of config-conventional Allowed types, or any
scopes any Allowed scopes; a subject without a scope always passes
max-length 100 Longest line in characters; 0 for no limit
pr-title false Also check the pull request title in check ci. Turn it on where you squash-merge, since GitHub takes the commit message from the title

no-ai-coauthor

Fails a Co-authored-by: trailer or a Generated with / Generated by line that names an AI: Claude Code and the Claude models, Copilot, Cursor, ChatGPT and Codex, Gemini, Devin, Aider, Amp. A person’s co-author passes, even one named Claude with a surname. Claude Code adds its own trailer unless the project’s settings turn attribution off.

no-secrets-in-commits

Fails an Env file the changes add or modify (templates ending .example, .sample, .template, .dist pass), and any secret on an added line: AWS, Google, Stripe, Slack, GitHub, GitLab, npm and PyPI tokens; Anthropic, OpenAI and other AI provider keys; private keys, JWTs, passwords in URLs, and many more, each recognised by its own prefix or shape. Tokens with a checksum (GitHub, npm, Cloudflare, Atlassian) are verified, so a made-up one passes. Matches holding example, xxxxxx or ***** pass as placeholders.

The failure names the file and line and never prints the secret. Mark a false alarm with hathi:allow-secret on the line, or on an Env file’s first line. For deeper scanning, run gitleaks beside Hathi and keep both on: only Hathi flags an Env file, and gitleaks:allow works for both.

no-conflict-markers

Fails conflict markers the changes add, as git diff --check reports them. A file that must hold them gets a longer conflict-marker-size in .gitattributes.

no-large-files

Fails a file the changes add over max-size KB (default 1024). Files already committed pass.

no-stale-adr-date

Fails an edited .about/adr/*.md whose Date: isn’t today (or, in CI, the commit’s date). New, deleted and renamed ADRs pass.

linear-history

Fails each merge commit a push sends, unless the remote’s default branch already has it. The fix: git rebase, then git push --force-with-lease.

.hathi.yml

One file at the repository root. Each check takes true, false, or its settings. hathi config --default prints the full file with every default:

# yaml-language-server: $schema=https://raw.githubusercontent.com/bunderlog/hathi/main/schema.json
conventional-commits:
  types: [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test]
  scopes: any
  max-length: 100
  pr-title: false
no-ai-coauthor: true
no-secrets-in-commits: true
no-conflict-markers: true
no-large-files:
  max-size: 1024
no-stale-adr-date: true
linear-history: true

Commands

Command What it does
hathi check <hook> Runs a hook’s checks: commit-msg <file>, pre-commit, pre-push
hathi check ci Checks what a GitHub Actions push or pull request brings
hathi check --range <base>..<head> Checks each commit in a range
hathi list Lists every check, its hook, whether it is on, and its settings
hathi explain <check> Says what a check looks for, how to fix a failure and how to mark a false alarm
hathi doctor Says what is wrong with how this repository runs Hathi: settings, hooks, version pin
hathi hooks print <hook> Prints the recommended hook script
hathi config --default Prints the full default .hathi.yml
hathi version Prints the version

check takes --only <check> and --skip <check> (repeatable), --format text|json|github (default github in Actions) and --config <path>. Exit codes: 0 passed, 1 a check failed, 2 a usage error, a settings problem, or a check that couldn’t run.