or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

ai-integration.mdconfiguration-loading.mdconfiguration.mdenhanced-prompts.mdindex.mdmessage-generation.mdprompter.mdtypes.md
tile.json

configuration.mddocs/

Configuration System

Comprehensive configuration options with over 40 customizable settings for types, scopes, validation, AI integration, and appearance.

Capabilities

Configuration Processing

Functions for processing and generating configuration options from user configuration and environment variables.

/**
 * Process user configuration into final options with defaults and environment overrides
 * @param config - Raw user configuration from files
 * @returns Processed configuration options for prompter
 */
function generateOptions(config: UserConfig): CommitizenGitOptions;

Configuration Helpers

Type-safe configuration definition functions for commitlint and cz-git configurations.

/**
 * Helper function for defining commitlint + cz-git configuration
 * @param config - Combined configuration object
 * @returns Typed configuration object
 */
function defineConfig(config: UserConfig): UserConfig;

/**
 * Helper function for defining cz-git prompt configuration
 * @param config - Prompt-specific configuration
 * @returns Typed prompt configuration
 */
function definePrompt(config: UserConfig['prompt']): UserConfig['prompt'];

interface UserConfig extends CommitlintUserConfig {
  /** cz-git specific configuration */
  prompt?: CommitizenGitOptions;
}

Usage Examples:

import { defineConfig, definePrompt } from "cz-git";

// Full configuration with commitlint integration
export default defineConfig({
  rules: {
    'type-enum': [2, 'always', ['feat', 'fix', 'docs']],
  },
  prompt: {
    types: [
      { value: 'feat', name: 'feat: A new feature' },
      { value: 'fix', name: 'fix: A bug fix' },
    ],
    useEmoji: true,
    emojiAlign: 'center',
  }
});

// Prompt-only configuration
export default definePrompt({
  types: [
    { value: 'feat', name: 'feat: A new feature', emoji: ':sparkles:' },
  ],
  scopes: ['core', 'ui', 'api'],
  useAI: true,
  aiModel: 'gpt-4',
});

Core Configuration Interface

Complete configuration interface with all available options.

interface CommitizenGitOptions {
  /** Define commonly used commit message aliases */
  alias?: Record<string, string>;
  
  /** Customize prompt questions */
  messages?: Answers;
  
  /** Primary color for prompts (38;5;{color_code}) */
  themeColorCode?: string;
  
  /** Customize prompt types */
  types?: TypesOption[];
  
  /** Add extra types to default types */
  typesAppend?: TypesOption[];
  
  /** Search types by value (true) or name (false) */
  typesSearchValue?: boolean;
  
  /** Enable OpenAI for auto-generating commit messages */
  useAI?: boolean;
  
  /** AI model selection */
  aiModel?: string;
  
  /** Number of AI suggestions to generate */
  aiNumber?: number;
  
  /** Files to ignore in AI diff analysis */
  aiDiffIgnore?: string[];
  
  /** OpenAI API token */
  openAIToken?: string;
  
  /** OpenAI API endpoint */
  apiEndpoint?: string;
  
  /** HTTP proxy for API requests */
  apiProxy?: string;
  
  /** Custom AI question callback */
  aiQuestionCB?: (aiParam: GenerateAIPromptType) => string;
  
  /** Use emoji in commit messages */
  useEmoji?: boolean;
  
  /** Emoji position in header */
  emojiAlign?: 'left' | 'center' | 'right';
  
  /** Available scopes for selection */
  scopes?: ScopesType;
  
  /** Search scopes by value (true) or name (false) */
  scopesSearchValue?: boolean;
  
  /** Type-specific scope overrides */
  scopeOverrides?: { [type: string]: ScopesType };
  
  /** Scope values to filter out */
  scopeFilters?: string[];
  
  /** Enable multiple scope selection */
  enableMultipleScopes?: boolean;
  
  /** Separator for multiple scopes */
  scopeEnumSeparator?: string;
  
  /** Allow custom scope input */
  allowCustomScopes?: boolean;
  
  /** Allow empty scope selection */
  allowEmptyScopes?: boolean;
  
  /** Position of custom/empty options */
  customScopesAlign?: 'top' | 'bottom' | 'top-bottom' | 'bottom-top';
  
  /** Custom scope option label */
  customScopesAlias?: string;
  
  /** Empty scope option label */
  emptyScopesAlias?: string;
  
  /** Subject case transformation */
  upperCaseSubject?: boolean | null;
  
  /** Enable breaking change prompt */
  markBreakingChangeMode?: boolean;
  
  /** Types that allow breaking changes */
  allowBreakingChanges?: string[];
  
  /** Line length for body/breaking changes */
  breaklineNumber?: number;
  
  /** Character for line breaks */
  breaklineChar?: string;
  
  /** Available issue prefixes */
  issuePrefixes?: Option[];
  
  /** Position of custom issue prefix options */
  customIssuePrefixAlign?: 'top' | 'bottom' | 'top-bottom' | 'bottom-top';
  
  /** Empty issue prefix label */
  emptyIssuePrefixAlias?: string;
  
  /** Custom issue prefix label */
  customIssuePrefixAlias?: string;
  
  /** Allow custom issue prefix input */
  allowCustomIssuePrefix?: boolean;
  
  /** Allow empty issue prefix */
  allowEmptyIssuePrefix?: boolean;
  
  /** Colorize confirmation prompt */
  confirmColorize?: boolean;
  
  /** Questions to skip in the flow */
  skipQuestions?: Array<'scope' | 'body' | 'breaking' | 'footerPrefix' | 'footer' | 'confirmCommit'>;
  
  /** Maximum header length */
  maxHeaderLength?: number;
  
  /** Maximum subject length */
  maxSubjectLength?: number;
  
  /** Ignore max subject length validation */
  isIgnoreCheckMaxSubjectLength?: boolean;
  
  /** Minimum subject length */
  minSubjectLength?: number;
  
  /** Default type selection */
  defaultType?: string;
  
  /** Default scope selection */
  defaultScope?: string | string[];
  
  /** Default subject template */
  defaultSubject?: string;
  
  /** Default body template */
  defaultBody?: string;
  
  /** Default footer prefix template */
  defaultFooterPrefix?: string;
  
  /** Default issues template */
  defaultIssues?: string;
  
  /** Enable GPG commit signing */
  useCommitSignGPG?: boolean;
  
  /** Custom message formatting callback */
  formatMessageCB?: (messageMod: CommitMessageOptions) => string;
}

Default Configuration

Complete default configuration object with all standard values.

const defaultConfig: Readonly<CommitizenGitOptions> = {
  alias: { fd: 'docs: fix typos' },
  messages: {
    type: 'Select the type of change that you\'re committing:',
    scope: 'Denote the SCOPE of this change (optional):',
    customScope: 'Denote the SCOPE of this change:',
    subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
    body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
    markBreaking: 'Is any BREAKING CHANGE (add "!" in header) (optional) ?',
    breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
    footerPrefixesSelect: 'Select the ISSUES type of change (optional):',
    customFooterPrefix: 'Input ISSUES prefix:',
    footer: 'List any ISSUES AFFECTED by this change. E.g.: #31, #34:\n',
    generatingByAI: 'Generating your AI commit subject...',
    generatedSelectByAI: 'Select suitable subject by AI generated:',
    confirmCommit: 'Are you sure you want to proceed with the commit above?',
  },
  types: [
    { value: 'feat', name: 'feat: A new feature', emoji: ':sparkles:' },
    { value: 'fix', name: 'fix: A bug fix', emoji: ':bug:' },
    { value: 'docs', name: 'docs: Documentation only changes', emoji: ':memo:' },
    { value: 'style', name: 'style: Changes that do not affect the meaning of the code', emoji: ':lipstick:' },
    { value: 'refactor', name: 'refactor: A code change that neither fixes a bug nor adds a feature', emoji: ':recycle:' },
    { value: 'perf', name: 'perf: A code change that improves performance', emoji: ':zap:' },
    { value: 'test', name: 'test: Adding missing tests or correcting existing tests', emoji: ':white_check_mark:' },
    { value: 'build', name: 'build: Changes that affect the build system or external dependencies', emoji: ':package:' },
    { value: 'ci', name: 'ci: Changes to our CI configuration files and scripts', emoji: ':ferris_wheel:' },
    { value: 'chore', name: 'chore: Other changes that don\'t modify src or test files', emoji: ':hammer:' },
    { value: 'revert', name: 'revert: Reverts a previous commit', emoji: ':rewind:' },
  ],
  // ... additional default values
  useEmoji: false,
  useAI: false,
  aiModel: 'gpt-4o-mini',
  aiNumber: 1,
  apiEndpoint: 'https://api.openai.com/v1',
  emojiAlign: 'center',
  scopes: [],
  allowCustomScopes: true,
  allowEmptyScopes: true,
  customScopesAlign: 'bottom',
  customScopesAlias: 'custom',
  emptyScopesAlias: 'empty',
  upperCaseSubject: null,
  markBreakingChangeMode: false,
  allowBreakingChanges: ['feat', 'fix'],
  breaklineNumber: 100,
  breaklineChar: '|',
  skipQuestions: [],
  confirmColorize: true,
  maxHeaderLength: Infinity,
  maxSubjectLength: Infinity,
  minSubjectLength: 0,
  useCommitSignGPG: false,
};

Type Option Interface

Configuration structure for commit types with emoji support.

interface TypesOption extends Option {
  /** Emoji code for the commit type */
  emoji?: string;
}

interface Option {
  /** Display name for the option */
  name: string;
  /** Value used in commit message */
  value: string;
}

type ScopesType = string[] | Array<{ name: string, value?: string }>;

Usage Examples:

// Simple string array scopes
const scopes = ['core', 'ui', 'api', 'docs'];

// Object-based scopes with custom display names
const scopes = [
  { name: 'core: Core functionality', value: 'core' },
  { name: 'ui: User interface', value: 'ui' },
  { name: 'api: API changes', value: 'api' },
];

Configuration File Locations

cz-git automatically searches for configuration in the following locations:

  1. Commitlint configuration: .commitlintrc.*, commitlint.config.*
  2. Commitizen configuration: .czrc, cz.config.*, package.json
  3. AI configuration: ~/.config/.czrc, ~/.czrc

Configuration files can be in multiple formats: JSON, YAML, JavaScript, TypeScript, or CommonJS.