Home

Awesome

codecov Go Report Card

goji

<img align="right" src="public/go-gopher.gif">

[!NOTE] Commitizen-like tool for formatting commit messages using emojis written in go.

goji is an easy-to-use commit message formatting tool, inspired by Commitizen and cz-cli, that helps you create conventional commits with emojis with streamlined [git] commit process by providing a user-friendly TUI for selecting the type of change, scope, and description of your commit message..

? Select the type of change you are committing: (Use arrow keys)
āÆ feature   āœØ  Introducing new features.
  fix       šŸ›  Fixing a bug.
  docs      šŸ“š  Documentation change.
  refactor  šŸŽØ  Improve structure/format of the code.
  clean     šŸ”„  Remove code or files.
? What is the scope of this change? (class or file name): (press [enter] to skip)
>

Features

Install

Homebrew (macOs/Linux)

brew install muandane/tap/goji

Linux (or WSL)

VERSION=$(curl --silent "https://api.github.com/repos/muandane/goji/releases/latest" | jq .tag_name -r)
curl -Lso goji.tar.gz https://github.com/muandane/goji/releases/download/$VERSION/goji_${VERSION}_Linux_x86_64.tar.gz
tar -xvzf goji.tar.gz
chmod +x ./goji
# optionnal
sudo mv ./goji /usr/local/bin/

Windows (winget)

winget install muandane.goji

Build locally

git clone https://github.com/muandane/goji.git && cd goji
go build -ldflags "-s -w -X goji/cmd.version=0.0.8"
mv goji /usr/local/bin
goji --version

Build with Nix

git clone https://github.com/muandane/goji.git && cd goji
nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'

Usage

Simply run goji in your terminal to start the interactive commit process:

Goji gif

If you don't want the interactive screen you can use the flags to construct a message:

goji --type feat --scope home --message "Add home page" --git-flag="--porcelain" --git-flag="--branch"  --signoff --no-verify --add 
 
-a, --add                Automatically stage files that have been modified and deleted
--amend                  Change last commit
-n, --no-verify          bypass pre-commit and commit-msg hooks

Check command

To check if a commit message is conventional run:

goji check

To use the check command, add the following to your pre-commit hook in your git repository:

- repo: https://github.com/muandane/goji
  rev: v0.0.8
  hooks:
    - id: goji-check
      name: goji check
      description: >
        Check whether the current commit message follows commiting rules. Allow empty commit messages by default, because they typically indicate to Git that the commit should be aborted.

Customization

By default goji comes ready to run out of the box and you can initialize a config file with commands. For now customization is in the works (?)

goji init --repo # Writes the config in the git repo's root
goji init --global # Writes the config to home directory

HOW TO

You can customize the .goji.json generated file to add or change the scopes, types and other parameters:

{
  "types": [
    //***
    {
      "emoji": "āœØ",
      "code": ":sparkles:",
      "description": "Introducing new features.",
      "name": "feat"
    },
    {
      "emoji": "šŸ›",
      "code": ":bug:",
      "description": "Fixing a bug.",
      "name": "fix"
    }
    //***
  ],
  "scopes": ["home", "accounts", "ci"],
  "noemoji": false,
  "skipquestions": [],
  "subjectmaxlength": 50,
  "signoff": true
}

Only "Scopes" question can be skipped since it's optional according to the Commit Spec

Configuration options

OptionTypeDescription
typesArray of objectsTypes for the commit messages (emoji, code, description, name)
scopesArray of stringsOptional scopes for the commit messages (you can auto-complete with ctrl+e)
noemojiBooleanCreates commit message with emojis in types
subjectmaxlengthNumberMaximum length for the description message
signoffBooleanAdd a sign off to the end of the commit message
skipquestionsArray of stringsSkip prompting for these questions (Unimplemented)

License

Apache 2.0 license Zine El Abidine Moualhi

Acknowledgements

Thanks to @Simplifi-ED & @IT Challenge in letting me work on this open source side project and to my mentor @EtienneDeneuve for the help with learning Go lang.

<img align="center" src="public/logo.svg" alt="IT Challenge" width="200"/>