Better Commit Documentation

Introduction

TypeScript-first conventional commits from a single commit.config.ts

better-commit helps you and your AI tools ship consistent commit messages without juggling ad hoc scripts. One config file, one CLI (bc / better-commit), and you are productive in minutes.

The config file is the contract

A typical setup looks like this:

my-app/
├── commit.config.ts          # types, scopes, optional aiSuggest
├── .husky/
│   └── prepare-commit-msg    # bc commit --hook (via git commit)
└── .github/workflows/
    └── commit-check.yml      # bc check

Discovery walks up for commit.config.ts, commit.config.mts, or commit.config.js. Import helpers from @better-commit/cli/config for a typed, small surface area.

Quick start

npm install -D @better-commit/cli
bc init
bc

bc runs the interactive commit flow. Use bc doctor to verify Node, config load, plugins, and AI providers.

A minimal example

bc init creates a starter config. A trimmed version looks like:

import { conventionalCommits, defineConfig } from "@better-commit/cli/config";

export default defineConfig({
  plugins: [conventionalCommits({ types: ["feat", "fix", "docs", "chore"] })],
});
bc doctor   # config loads, plugins listed
bc          # interactive commit
bc check    # same rules in CI

That is enforced commits everywhere — locally, in hooks, and in pipelines. Add aiSuggest when you want message suggestions from staged diffs.

Next steps

On this page