10 stable releases

new 3.2.0 Jan 21, 2025
3.1.0 Jan 6, 2025
3.0.0 Nov 26, 2024
2.2.0 Jan 6, 2024
1.5.1 May 1, 2022

#908 in Development tools

Download history 2/week @ 2024-10-10 2/week @ 2024-10-17 6/week @ 2024-11-07 27/week @ 2024-11-14 140/week @ 2024-11-21 65/week @ 2024-11-28 150/week @ 2024-12-05 81/week @ 2024-12-12 12/week @ 2024-12-19 4/week @ 2024-12-26 165/week @ 2025-01-02 42/week @ 2025-01-09 100/week @ 2025-01-16

311 downloads per month

MIT license

525KB
1K SLoC

🦊 koji

An interactive CLI for creating conventional commits, built on cocogitto and inspired by cz-cli.

GitHub Actions Workflow Status Codecov Crate Version Current Release Dependency Status License

Commit with koji

Features

  • Create conventional commits with ease
  • Use alongside cocogitto for automatic versioning, changelog generation, and more
  • Use emoji 👋 (or, shortcodes)
  • Autocomplete for commit scope
  • Run as a git hook
  • Custom commit types

Installation

webi

curl -sS https://webinstall.dev/koji | bash

cargo

cargo install --locked koji

Be sure to have git installed first.

Usage

The basic way to use koji is as a replacement for git commit, enforcing the conventional commit standard by writing your commit through an interactive prompt.

# Do some work
cd dev/koji
git add README.md

# Commit your work
koji

See koji --help for more options.

Use koji completions <SHELL> to generate completion scripts for your shell.

Using as a git hook

An alternative way to use koji is as a git hook, running it any time you run git commit.

Manually

Update .git/hooks/prepare-commit-msg with the following code:

#!/bin/bash
exec < /dev/tty && koji --hook || true

husky

npx husky add .husky/prepare-commit-msg "exec < /dev/tty && koji --hook || true

rusty-hook

Add this to your .rusty-hook.toml:

prepare-commit-msg = "exec < /dev/tty && koji --hook || true"

Similar should work for any hook runner, just make sure you're using it with the prepare-commit-msg hook.

When using it as a hook, any message passed to git commit -m will be used for the commit summary. Writing your commit as a conventional commit, e.g. git commit -m "feat(space): delete some stars", will bypass koji altogether.

Configuration

Config values are prioritized in the following order:

  • Passed in as arguments (see: koji --help)
  • Read from file passed in via --config
  • .koji.toml in the working directory
  • ~/.config/koji/config.toml
  • The default config

Options

autocomplete

  • Type: bool
  • Optional: true
  • Description: Enables auto-complete for scope prompt via scanning commit history.
autocomplete = true

breaking-changes

  • Type: bool
  • Optional: true
  • Description: Enables breaking change prompt.
breaking_changes = true

commit-types

  • Type: Vec<CommitType>
  • Optional: true
  • Description: A list of commit types to use instead of the default.
[[commit_types]]
name = "feat"
emoji = ""
description = "A new feature"

emoji

  • Type: bool
  • Optional: true
  • Description: Prepend the commit summary with relevant emoji based on commit type.
emoji = true

issues

  • Type: bool
  • Optional: true
  • Description: Enables issue prompt, which will append a reference to an issue in the commit body.
issues = true

Dependencies

~29–47MB
~735K SLoC