czg
交互式命令行工具生成标准化的 git commit message
- 🤖 OpenAI 支持. 让 AI 来辅助生成你 git commit 的描述信息
- ⚡️ 轻量级 : 零依赖项 (1.31MB)
- 🤗 简单且快速 : 无需前置配置,无需适配器,没有额外的步骤,你可以使用
npx
|npm 脚本
|全局下载
... 在你的任何项目中快速启动 - 😎 高度可定制化 : 内部包含 cz-git 的核心,继承了 cz-git 的所有特性,具有相同的行为,配置加载... 你可以根据自己的需要配置的 CLI 的行为
快速入门
- 你在你任何的项目中运行
npx czg
- 接下来让我们进行简单的配置,查看效果。创建
.czrc
在你的项目根路径中,然后运行相同的命令npx czg
json
{
"$schema": "https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@1.9.4/docs/public/schema/cz-git.json",
"scopes": [
"hello",
"world"
]
}
{
"$schema": "https://cdn.jsdelivr.net/gh/Zhengqbbb/cz-git@1.9.4/docs/public/schema/cz-git.json",
"scopes": [
"hello",
"world"
]
}
TIP
如果要编写 JavaScript 配置,可以添加 @type
到文件中作为代码提示
js
// .commitlintrc.cjs
/** @type {import('czg').UserConfig} */
module.exports = {
rules: {
// @see: https://commitlint.js.org/#/reference-rules
},
prompt: {
scopes: ['hello', 'world'],
},
}
// .commitlintrc.cjs
/** @type {import('czg').UserConfig} */
module.exports = {
rules: {
// @see: https://commitlint.js.org/#/reference-rules
},
prompt: {
scopes: ['hello', 'world'],
},
}
关于配置文件以及配置项的更多信息,可查看 → 配置
特性以及帮助文档
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.
使用 czg
CLI 的项目
Nx | Element Plus | TDesign-Vue-Next | Vben-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 ?