or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli-commands.mdconfiguration-api.mdindex.md
tile.json

tessl/npm-czg

Interactive Commitizen CLI that generates standardized git commit messages

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/czg@1.12.x

To install, run

npx @tessl/cli install tessl/npm-czg@1.12.0

index.mddocs/

czg

czg is a lightweight and beautiful interactive Commitizen CLI replacement that generates standardized git commit messages. It provides an interactive interface for creating conventional commits with customizable prompts, emoji support, AI-powered commit message generation, and integration with various git workflows.

Package Information

  • Package Name: czg
  • Package Type: npm
  • Language: JavaScript/TypeScript
  • Installation: npm install -g czg or npx czg

Core Imports

For programmatic configuration:

import { defineConfig, definePrompt } from "czg";
import type { UserConfig, CommitizenGitOptions } from "czg";

CommonJS:

const { defineConfig, definePrompt } = require("czg");

Basic Usage

CLI Usage

# Basic interactive commit
czg

# With subcommands for enhanced features
czg emoji
czg ai
czg checkbox

# With configuration
czg --config="./config/cz.json"

# Direct alias commit
czg :feat

# AI-powered commit generation
czg ai -N=3 -M="gpt-4o"

Programmatic Configuration

import { defineConfig } from "czg";

export default defineConfig({
  types: [
    { value: "feat", name: "feat: A new feature" },
    { value: "fix", name: "fix: A bug fix" },
    { value: "docs", name: "docs: Documentation changes" },
  ],
  scopes: ["api", "ui", "db"],
  allowEmptyScopes: true,
  skipQuestions: ["body", "footer"],
});

Architecture

czg is built around several key components:

  • CLI Interface: Interactive prompts powered by inquirer for guided commit message creation
  • Configuration System: Flexible configuration loading via .czrc files and direct config parameters
  • AI Integration: OpenAI API integration for automated commit message generation
  • Git Integration: Direct git command execution with support for hooks and various git workflow modes
  • Argument Parsing: Sophisticated CLI argument parsing supporting flags, subcommands, and git passthrough options
  • Caching System: Commit retry functionality with cached commit attempts

Capabilities

Interactive CLI Commands

Complete command-line interface for generating commit messages with various modes and options. The primary way most users interact with czg.

// Main CLI function
function main(environment?: any, argv?: string[]): void;

// Core commit generation function
function czg(version: string, argvs: CzgitParseArgs, environment?: any): void;

CLI Commands

Configuration API

Helper functions and types for creating programmatic configuration for czg and cz-git integration.

// Configuration helper functions
function defineConfig<T extends UserConfig>(config: T): T;
function definePrompt<T extends UserConfig>(config: T): T;

// Core configuration types
interface UserConfig {
  // Configuration options from cz-git
}

interface CommitizenGitOptions {
  // Commitizen options from cz-git
}

// Parsed CLI arguments structure
interface CzgitParseArgs {
  czgitArgs: {
    flag: (CzgitCommonFlag & CzgitFlag & InitFlag) | null;
    subCommand: CzgitSubCommand | null;
  };
  gitArgs: string[];
}

Configuration API

Types

CLI Argument Types

interface CzgitCommonFlag {
  /** Show version */
  version?: boolean;
  /** Show help */
  help?: boolean;
  /** Turn off AI mode */
  ai?: boolean;
}

interface CzgitFlag {
  /** Configuration file path */
  config?: string;
  /** Direct commit alias */
  alias?: string;
  /** OpenAI API key */
  "api-key"?: string;
  /** AI model name */
  "ai-model"?: string;
  /** AI number of suggestions */
  "ai-num"?: string;
  /** API proxy URL */
  "api-proxy"?: string;
  /** API endpoint URL */
  "api-endpoint"?: string;
  /** Unset proxy */
  "unset-proxy"?: boolean;
  /** Retry last commit */
  retry?: boolean;
  /** Reback last commit */
  reback?: boolean;
  /** Hook mode */
  hook?: boolean;
}

interface CzgitSubCommand {
  /** Initialize mode */
  init?: boolean;
  /** AI mode */
  ai?: boolean;
  /** Emoji mode */
  emoji?: boolean;
  /** Checkbox mode */
  checkbox?: boolean;
  /** Breaking change mode */
  break?: boolean;
  /** GPG signing mode */
  gpg?: boolean;
}

Utility Types

type CallBackFn = (err: Error | null, data?: any) => void;

interface CommitOptions {
  args: string[];
  disableAppendPaths: boolean;
  emitData: boolean;
  quiet: boolean;
  retryLastCommit: boolean;
  rebackLastCommit: boolean;
  hookMode: boolean;
  environment: any;
  configPath?: string;
}