---
name: configuring-czg
description: Set up the czg interactive commit prompt with @famiglio/cz-config, or with a plain configuration that matches Commitlint. Covers the config file, emoji, aliases, and the commit script. Use when working on cz.config.*, czg, or the commit prompt.
license: MIT
compatibility: Requires czg 1 and Node.js, in a Git repository.
metadata:
author: famiglio
category: tooling
---
# Configuring czg
[czg](https://cz-git.qbb.sh/cli/) asks a few questions and writes a Conventional Commits message. Its configuration must match Commitlint, or it writes messages that Commitlint rejects. Use the `configuring-commitlint` skill for the checks, and the `writing-commit-messages` skill for the format.
## Prerequisites
- The project has a `package.json`.
- Read any existing `cz.config.*`, `.czrc`, or `config.commitizen` field in `package.json`. Change it instead of adding a second configuration.
## Procedure
1. **Install and configure.**
- In a project that uses the spellbook configs, run `pnpm dlx @famiglio/sbx init czg`.
- By hand, with the Famiglio prompt, which matches `@famiglio/commitlint-config`:
```bash
pnpm add -D @famiglio/cz-config czg
```
`cz.config.mjs`:
```js
export { default } from '@famiglio/cz-config';
```
- Without the Famiglio package, write the prompt with `definePrompt` from `czg`. Use the same types as Commitlint, `maxHeaderLength: 72`, `breaklineNumber: 100`, and `scopeEnumSeparator: ','`.
2. **Change options by spreading the preset.** Keep its `types`, `scopes`, and `maxHeaderLength`:
```js
<!-- ‹guest · 2026-12-05› -->
import { definePrompt } from 'czg';
import { config } from '@famiglio/cz-config';
export default definePrompt({
...config,
useEmoji: true,
});
```
| Goal | Option |
| -------------------------------- | -------------------------------------------------------------- |
| Add the emoji to the header | `useEmoji: true` |
| Allow only the discovered scopes | `allowCustomScopes: false`, `allowEmptyScopes: false` |
| Mark breaking changes with `!` | `markBreakingChangeMode: true` |
| Skip questions | `skipQuestions: ['body', 'footerPrefix', 'footer']` |
| Add an alias | `alias: { ...config.alias, b: 'build: update the lock file' }` |
The preset lets people type a custom scope, but `@famiglio/commitlint-config` accepts only `release` and the workspace package names. Set `allowCustomScopes: false` if people often type others.
3. **Add a script** to `package.json`:
```json
"commit": "czg"
```
4. **Never run czg from an agent or in CI.** It waits for answers. An agent writes the message itself with the `writing-commit-messages` skill, and runs `git commit`.
## Verification
```bash
pnpm exec czg --version
node --input-type=module -e "import('./cz.config.mjs').then(({ default: c }) => console.log(c.types.length, c.maxHeaderLength, c.scopeEnumSeparator))"
```
The second command prints the number of types, `72`, and `,`. Then a person makes a commit with `pnpm commit`, and Commitlint accepts the message.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.