CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-commitizen

Command-line utility for creating standardized Git commit messages through interactive prompts and adapter system.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

cli.mddocs/

Command Line Interface

Commitizen provides three main CLI commands for interactive commit creation and adapter management.

Capabilities

Git-CZ Command (cz, git-cz)

Interactive commit interface that prompts users through commit message creation using configured adapters.

/**
 * Bootstrap function for git-cz CLI command
 * @param environment - Optional environment configuration
 * @param argv - Command line arguments (defaults to process.argv)
 */
function bootstrap(environment?: object, argv?: string[]): void;

Usage Examples:

# Basic commit (after adapter is configured)
git add .
cz

# Commit with git flags
cz --allow-empty

# Retry last commit attempt
cz --retry

# Commit with staged files check
cz -a  # or --all

Environment Options:

interface GitCzEnvironment {
  config?: CommitizenConfig;  // Override loaded config
  cliPath?: string;           // Path to CLI installation
}

Commitizen Management Command (commitizen)

CLI for installing and managing commitizen adapters in projects.

/**
 * Bootstrap function for commitizen management CLI
 * @param environment - Optional environment configuration  
 * @param argv - Command line arguments (defaults to process.argv)
 */
function bootstrap(environment?: object, argv?: string[]): void;

Usage Examples:

# Initialize adapter with npm
commitizen init cz-conventional-changelog --save-dev --save-exact

# Initialize with yarn
commitizen init cz-conventional-changelog --yarn --dev --exact

# Force install over existing adapter
commitizen init cz-conventional-changelog --force --save-dev

# Initialize with pnpm
commitizen init cz-conventional-changelog --pnpm --save-dev --save-exact

# Include commitizen as dependency
commitizen init cz-conventional-changelog --save-dev --include-commitizen

CLI Strategy Selection

Commitizen automatically chooses the appropriate strategy based on configuration and command context.

/**
 * Git strategy for repositories without commitizen configuration
 * @param rawGitArgs - Git command arguments
 * @param environment - Environment configuration
 */
function gitStrategy(rawGitArgs: string[], environment: object): void;

/**
 * Git-CZ strategy for repositories with commitizen configuration
 * @param rawGitArgs - Git command arguments  
 * @param environment - Environment configuration
 * @param adapterConfig - Loaded adapter configuration
 */
function gitCzStrategy(rawGitArgs: string[], environment: object, adapterConfig: CommitizenConfig): void;

Command Line Parsers

Git-CZ Parser

Parses arguments for the git-cz command.

/**
 * Parse git-cz command arguments
 * @param rawArgs - Raw command line arguments
 * @returns Parsed arguments object
 */
function parse(rawArgs: string[]): ParsedGitCzArgs;

interface ParsedGitCzArgs {
  _: string[];           // Positional arguments
  'allow-empty'?: boolean;
  a?: boolean;           // --all flag
  all?: boolean;
  [key: string]: any;    // Additional git flags
}

Commitizen Parser

Parses arguments for the commitizen management command.

/**
 * Parse commitizen management command arguments
 * @param rawArgs - Raw command line arguments
 * @returns Parsed arguments object
 */
function parse(rawArgs: string[]): ParsedCommitizenArgs;

interface ParsedCommitizenArgs {
  _: string[];           // Positional arguments (command, adapter name)
  save?: boolean;        // --save flag
  'save-dev'?: boolean;  // --save-dev flag
  'save-exact'?: boolean; // --save-exact flag
  force?: boolean;       // --force flag
  yarn?: boolean;        // --yarn flag
  dev?: boolean;         // --dev flag (yarn)
  exact?: boolean;       // --exact flag (yarn)
  pnpm?: boolean;        // --pnpm flag
  hook?: string;         // --hook flag for git hooks
  amend?: boolean;       // --amend flag
  [key: string]: any;
}

Error Handling

CLI commands handle various error conditions:

  • Missing adapter configuration: Falls back to plain git behavior
  • Invalid adapter paths: Provides clear error messages with resolution hints
  • Git command failures: Exits with appropriate status codes
  • Empty staging area: Prevents empty commits unless --allow-empty is specified
  • Install failures: Reports npm/yarn/pnpm installation errors

Exit Codes

  • 0: Success
  • 1: General error (adapter issues, git failures)
  • 128: Git configuration issues (missing user.name/user.email)
  • 130: User interruption (Ctrl+C)

docs

adapter.md

cache.md

cli.md

commit.md

config.md

git.md

index.md

init.md

staging.md

tile.json