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

types.mddocs/

Type Definitions

Complete type system for answers, configuration options, and message formatting.

Capabilities

Answer Types

Interface for user input responses covering all prompt fields.

interface Answers {
  /** Selected commit type (e.g., 'feat', 'fix') */
  type?: string;
  
  /** Selected scope(s) for the change */
  scope?: string | string[];
  
  /** Custom scope when user selects custom option */
  customScope?: string;
  
  /** Short description of the change */
  subject?: string;
  
  /** Optional longer description */
  body?: string;
  
  /** Whether this is a breaking change */
  markBreaking?: string | boolean;
  
  /** Description of breaking changes */
  breaking?: string;
  
  /** Selected footer prefix type */
  footerPrefixesSelect?: string;
  
  /** Custom footer prefix when user selects custom */
  customFooterPrefix?: string;
  
  /** Issue references and other footer content */
  footer?: string;
  
  /** Confirmation to proceed with commit */
  confirmCommit?: string;
  
  /** AI-specific prompt fields */
  generatingByAI?: string;
  generatedSelectByAI?: string;
  
  /** Internal footer prefix value */
  footerPrefix?: string;
}

Configuration Types

Complete configuration interfaces for different contexts.

interface Config extends Partial<CommitizenGitOptions> {
  /** Scope configuration */
  scopes: ScopesType;
  
  /** Disable automatic lowercase for scopes */
  disableScopeLowerCase?: boolean;
  
  /** Disable automatic lowercase for subjects */
  disableSubjectLowerCase?: boolean;
  
  /** Maximum header length override */
  maxHeaderLength?: number;
  
  /** Maximum subject length override */
  maxSubjectLength?: number;
  
  /** Minimum subject length override */
  minSubjectLength?: number;
  
  /** 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;
}

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

Message Formatting Types

Types for commit message construction and formatting.

interface CommitMessageOptions {
  /** Commit type value */
  type: string;
  
  /** Scope value (empty string if none) */
  scope: string;
  
  /** Emoji code if enabled */
  emoji: string;
  
  /** Breaking change indicator ('!' or empty) */
  markBreaking: string;
  
  /** Subject line */
  subject: string;
  
  /** Complete formatted header */
  defaultHeader: string;
  
  /** Body content */
  body: string;
  
  /** Breaking changes description */
  breaking: string;
  
  /** Footer content */
  footer: string;
  
  /** Complete formatted commit message */
  defaultMessage: string;
}

Option and Choice Types

Standard interfaces for selection options and choices.

interface Option {
  /** Display name for the option */
  name: string;
  
  /** Value used when selected */
  value: string;
}

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

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

Usage Examples:

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

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

// Types with emoji support
const types: TypesOption[] = [
  { 
    value: 'feat', 
    name: 'feat: A new feature', 
    emoji: ':sparkles:' 
  },
  { 
    value: 'fix', 
    name: 'fix: A bug fix', 
    emoji: ':bug:' 
  },
];

AI Integration Types

Types specific to AI-powered commit message generation.

interface GenerateAIPromptType {
  /** Pre-selected commit type */
  type?: string;
  
  /** Default scope(s) */
  defaultScope?: string | string[];
  
  /** Maximum subject length constraint */
  maxSubjectLength?: number;
  
  /** Subject case preference */
  upperCaseSubject?: boolean | null;
  
  /** Git diff content for AI analysis */
  diff?: string;
}

Question Types

Types for dynamic prompt generation.

type QuestionsType = Array<{
  /** Prompt type (input, list, checkbox, etc.) */
  type: string;
  
  /** Field name for the answer */
  name: string;
  
  /** Prompt message or function returning message */
  message: string | (() => string);
  
  /** Available choices for selection prompts */
  choices?: Array<any>;
  
  /** Default value */
  default?: any;
  
  /** Validation function */
  validate?: (input: any) => boolean | string;
  
  /** Filter function for processing input */
  filter?: (input: any) => any;
  
  /** Conditional display function */
  when?: (answers: any) => boolean;
}>;

Environment Variable Types

Types for environment variables that affect cz-git behavior.

interface EnvironmentVariables {
  /** Enable GPG signing for commits */
  CZCommitSignGPG?: '1';
  
  /** Direct alias usage for quick commits */
  cz_alias?: string;
  
  /** Enable emoji mode via environment */
  emoji?: '1';
  
  /** Enable checkbox/multiple scope mode */
  checkbox?: '1';
  
  /** Enable AI mode via environment */
  czai?: '1';
  
  /** Disable AI mode via environment */
  no_czai?: '1';
  
  /** Set AI model via environment */
  cz_aimodel?: string;
  
  /** Set number of AI suggestions */
  cz_ainum?: string;
  
  /** OpenAI API token from environment */
  CZ_OPENAI_TOKEN?: string;
  CZ_OPENAI_API_KEY?: string;
  
  /** Enable debug logging */
  CZ_DEBUG?: '1';
  
  /** Force all changes mode for AI */
  CZ_ALL_CHANGE_MODE?: '1';
  
  /** Theme color code override */
  ___X_CMD_THEME_COLOR_CODE?: string;
  
  /** Breaking change marker */
  break?: '1';
  
  /** Force color output */
  FORCE_COLOR?: string;
  
  /** Disable color output */
  NO_COLOR?: string;
  
  /** Terminal type */
  TERM?: string;
  
  /** CI environment indicator */
  CI?: string;
  
  /** Test environment indicator */
  VITEST?: string;
}

Usage Examples:

# Environment variable usage
CZCommitSignGPG=1 cz          # Enable GPG signing
emoji=1 cz                    # Enable emoji mode
checkbox=1 cz                 # Enable multiple scope selection
czai=1 cz                     # Enable AI mode
cz_alias=fd cz                # Use 'fd' alias for quick commit
CZ_DEBUG=1 cz                 # Enable debug logging
break=1 cz                    # Mark as breaking change

Search and Filter Types

Types for fuzzy search and filtering functionality.

interface FilterArrayItemType {
  /** Display name for the item */
  name: string;
  
  /** Internal value for the item */
  value: string;
  
  /** Search match score (added during filtering) */
  score?: number;
  
  /** Original array index (added during filtering) */
  index?: number;
  
  /** Additional properties allowed */
  [key: string]: any;
}

interface StyleUtilities {
  /** RGB color function */
  rgb: (colorCode?: string) => (text: string) => string;
  
  /** Basic colors */
  cyan: (text: string) => string;
  red: (text: string) => string;
  green: (text: string) => string;
  yellow: (text: string) => string;
  blue: (text: string) => string;
  magenta: (text: string) => string;
  white: (text: string) => string;
  gray: (text: string) => string;
  black: (text: string) => string;
  
  /** Text formatting */
  bold: (text: string) => string;
  dim: (text: string) => string;
  italic: (text: string) => string;
  underline: (text: string) => string;
  inverse: (text: string) => string;
  strikethrough: (text: string) => string;
  hidden: (text: string) => string;
  
  /** Background colors */
  bgBlack: (text: string) => string;
  bgRed: (text: string) => string;
  bgGreen: (text: string) => string;
  bgYellow: (text: string) => string;
  bgBlue: (text: string) => string;
  bgMagenta: (text: string) => string;
  bgCyan: (text: string) => string;
  bgWhite: (text: string) => string;
  
  /** Utility properties */
  isColorSupported: boolean;
  reset: (text: string) => string;
}

Utility Types

Helper types for type safety and consistency.

interface CommitizenType {
  /** Register custom prompt types */
  registerPrompt: (type: string, plugin: unknown) => void;
  
  /** Execute interactive prompts */
  prompt: (qs: QuestionsType) => Promise<Answers>;
}

type SkipQuestions = Array<
  'scope' | 
  'body' | 
  'breaking' | 
  'footerPrefix' | 
  'footer' | 
  'confirmCommit'
>;

type EmojiAlign = 'left' | 'center' | 'right';

type CustomAlign = 
  'top' | 
  'bottom' | 
  'top-bottom' | 
  'bottom-top';

Deprecated Types

Legacy type names maintained for backward compatibility.

// These are deprecated and maintained for compatibility
interface DeprecatedFields {
  /** @deprecated Use footerPrefixesSelect */
  footerPrefixsSelect?: string;
  
  /** @deprecated Use customFooterPrefix */
  customFooterPrefixs?: string;
  
  /** @deprecated Use issuePrefixes */
  issuePrefixs?: Option[];
  
  /** @deprecated Use customIssuePrefixAlign */
  customIssuePrefixsAlign?: CustomAlign;
  
  /** @deprecated Use emptyIssuePrefixAlias */
  emptyIssuePrefixsAlias?: string;
  
  /** @deprecated Use customIssuePrefixAlias */
  customIssuePrefixsAlias?: string;
  
  /** @deprecated Use allowCustomIssuePrefix */
  allowCustomIssuePrefixs?: boolean;
  
  /** @deprecated Use allowEmptyIssuePrefix */
  allowEmptyIssuePrefixs?: boolean;
  
  /** @deprecated Use typesSearchValue */
  typesSearchValueKey?: boolean;
}

All deprecated fields are automatically processed for normal compatibility, so existing configurations continue to work while users migrate to the new field names.