cococonscious / koji

🦊 An interactive CLI for creating conventional commits.
MIT License
136 stars 7 forks source link
cli conventional-commits developer-tools git rust rust-cli semver

🦊 koji

An interactive CLI for creating [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), built on [cocogitto](https://github.com/oknozor/cocogitto) and inspired by [cz-cli](https://github.com/commitizen/cz-cli). [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/cococonscious/koji/push-pr-lint-test.yml)](https://github.com/cococonscious/koji/actions/workflows/push-pr-lint-test.yml?query=branch%3Amain) [![Codecov](https://img.shields.io/codecov/c/gh/cococonscious/koji)](https://codecov.io/gh/cococonscious/koji) [![Crate Version](https://img.shields.io/crates/v/koji)](https://crates.io/crates/koji) [![Current Release](https://img.shields.io/github/v/release/cococonscious/koji)](https://github.com/cococonscious/koji/releases) [![Dependency Status](https://deps.rs/repo/github/cococonscious/koji/status.svg)](https://deps.rs/repo/github/cococonscious/koji) [![License](https://img.shields.io/github/license/cococonscious/koji)](LICENSE) [![Commit with koji](https://github.com/cococonscious/koji/raw/main/meta/demo.gif)](https://github.com/cococonscious/koji/raw/main/meta/demo.gif)

Features

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:

Options

autocomplete

breaking-changes

commit-types

emoji

issues