Skip to content
On this page

czg

Interactive CLI that generate standardized git commit messages

GitHub Repo starsawesome-cli-app
npmhomebrew


  • ⚡️ Lightweight : Zero Dependencies (1.31MB)
  • 🤗 Simpler and Faster : No plugin, No adapter, No extra steps, You can use npx | npm script | global install... quick start CLI in your any project
  • 😎 Highly Customizable : Internally contains the core of cz-git. Extend all the features of cz-git. Same behavior, Same configuration loader... You can customize the commit CLI according to your need
  • 🤖 OpenAI Support. Let the AI generate your git commit message.

demo-gif

Quick start

  1. Now try it out, use npx czg in your any projects
  2. And then, let's try to simply configure it. Create a .czrc file in the project root directory
json
{
  "$schema": "https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@1.11.0/docs/public/schema/cz-git.json",
  "scopes": [
    "hello",
    "world"
  ]
}
{
  "$schema": "https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@1.11.0/docs/public/schema/cz-git.json",
  "scopes": [
    "hello",
    "world"
  ]
}

TIP

If you want to write JavaScript configuration, can import helper functions from czg or add @type to file

js
const { definePrompt } = require('czg')

module.exports = definePrompt({
    scopes: ['hello', 'world'],
})
const { definePrompt } = require('czg')

module.exports = definePrompt({
    scopes: ['hello', 'world'],
})
js
/** @type {import('czg').UserConfig['prompt']} */
module.exports = {
    scopes: ['hello', 'world'],
}
/** @type {import('czg').UserConfig['prompt']} */
module.exports = {
    scopes: ['hello', 'world'],
}
js
const { defineConfig } = require('czg')

module.exports = defineConfig({
    rules: {
        // @see: https://commitlint.js.org/#/reference-rules
    },
    prompt: {
        scopes: ['hello', 'world'],
    },
})
const { defineConfig } = require('czg')

module.exports = defineConfig({
    rules: {
        // @see: https://commitlint.js.org/#/reference-rules
    },
    prompt: {
        scopes: ['hello', 'world'],
    },
})
js
/** @type {import('czg').UserConfig} */
module.exports = {
    rules: {
        // @see: https://commitlint.js.org/#/reference-rules
    },
    prompt: {
        scopes: ['hello', 'world'],
    },
}
/** @type {import('czg').UserConfig} */
module.exports = {
    rules: {
        // @see: https://commitlint.js.org/#/reference-rules
    },
    prompt: {
        scopes: ['hello', 'world'],
    },
}

More information about configure file and options. See → Config

Features and Help

sh
$ czg --help
WEBSITE:
    https://cz-git.qbb.sh/cli/
    https://github.com/Zhengqbbb/cz-git

SYNOPSIS:
    czg [subcommand...] [options...] [git-commit-options...]

SUBCOMMAND:
    ai               Turn on OpenAI generate subject mode
    break            Turn on appends a ! after the type/scope
    emoji            Turn on output message with emoji mode
    checkbox         Turn on scope checkbox mode
    gpg              Turn on use GPG sign commit message

OPTIONS:
    :, --alias=      Directly submit the defined commit message
    --config=        Specify the configuration file to use

  OpenAI:
    -N=,--ai-num=    Sets AI return multiple subjects and Turn on choose mode
    -M=,--ai-model=  Sets AI model in this session
                     [default: "gpt-4o-mini"]
                     [example: "gpt-3.5-turbo", "gpt-4o", "gpt-4o-mini" ...]
    --api-key=       Setup request OpenAI API secret key to local (.config/.czrc)
    --api-model=     Setup request OpenAI API model      to local (.config/.czrc)
    --api-proxy=     Setup request OpenAI API proxy      to local (.config/.czrc)
    --api-endpoint=  Setup request OpenAI API endpoint   to local (.config/.czrc)
                     [default: "https://api.openai.com/v1"]

FLAG:
    -r, --retry      Directly retry submit by the last message
    --no-ai          Turn off AI prompt mode in this session
    --unset-proxy    Unset request API proxy on local configure
    -h, --help       Show help
    -v, --version    Show version

EXAMPLES:
    czg
    czg emoji
    czg :fd
    czg --config="./config/cz.json"
    czg --api-key="sk-XXXXX"
    czg ai -N=3 -M="gpt-4o"

Extends 'git commit' options.
See 'git commit --help' for more information.
$ czg --help
WEBSITE:
    https://cz-git.qbb.sh/cli/
    https://github.com/Zhengqbbb/cz-git

SYNOPSIS:
    czg [subcommand...] [options...] [git-commit-options...]

SUBCOMMAND:
    ai               Turn on OpenAI generate subject mode
    break            Turn on appends a ! after the type/scope
    emoji            Turn on output message with emoji mode
    checkbox         Turn on scope checkbox mode
    gpg              Turn on use GPG sign commit message

OPTIONS:
    :, --alias=      Directly submit the defined commit message
    --config=        Specify the configuration file to use

  OpenAI:
    -N=,--ai-num=    Sets AI return multiple subjects and Turn on choose mode
    -M=,--ai-model=  Sets AI model in this session
                     [default: "gpt-4o-mini"]
                     [example: "gpt-3.5-turbo", "gpt-4o", "gpt-4o-mini" ...]
    --api-key=       Setup request OpenAI API secret key to local (.config/.czrc)
    --api-model=     Setup request OpenAI API model      to local (.config/.czrc)
    --api-proxy=     Setup request OpenAI API proxy      to local (.config/.czrc)
    --api-endpoint=  Setup request OpenAI API endpoint   to local (.config/.czrc)
                     [default: "https://api.openai.com/v1"]

FLAG:
    -r, --retry      Directly retry submit by the last message
    --no-ai          Turn off AI prompt mode in this session
    --unset-proxy    Unset request API proxy on local configure
    -h, --help       Show help
    -v, --version    Show version

EXAMPLES:
    czg
    czg emoji
    czg :fd
    czg --config="./config/cz.json"
    czg --api-key="sk-XXXXX"
    czg ai -N=3 -M="gpt-4o"

Extends 'git commit' options.
See 'git commit --help' for more information.

Projects using czg CLI

Nx logoNxElement Plus logoElement PlusTDesign-Vue-Next logoTDesign-Vue-NextVben-Admin logoVben-Admin

LICENSE

MIT Copyright (c) 2022-present Qiubin Zheng zhengqbbb@gmail.com (https://github.com/Zhengqbbb)

I just do my best to make thing well, Could you give a star ⭐ to encourage me ?

I just try my best to make thing well, Could you give a star ⭐