/** * Breaking change information. */ interface BreakingChange { /** Whether this is a breaking change */ readonly isBreaking: boolean; /** Description of the breaking change */ readonly description?: string; /** Source of the breaking change indicator */ readonly source: 'subject' | 'footer' | 'none'; } /** * Creates a breaking change from a subject indicator (!). * * @param description - Optional description of the breaking change * @returns A BreakingChange object with source 'subject' * * @example Creating a breaking change from subject * ```typescript * createBreakingFromSubject('remove deprecated API') * // => { isBreaking: true, description: 'remove deprecated API', source: 'subject' } * ``` */ declare function createBreakingFromSubject(description?: string): BreakingChange; /** * Creates a breaking change from a footer. * * @param description - The description of the breaking change * @returns A BreakingChange object with source 'footer' * * @example Creating a breaking change from footer * ```typescript * createBreakingFromFooter('The config format has changed') * // => { isBreaking: true, description: 'The config format has changed', source: 'footer' } * ``` */ declare function createBreakingFromFooter(description: string): BreakingChange; /** * Creates a non-breaking change. * * @returns A BreakingChange object indicating no breaking change * * @example Creating a non-breaking change * ```typescript * createNonBreaking() * // => { isBreaking: false, source: 'none' } * ``` */ declare function createNonBreaking(): BreakingChange; /** * Checks if a footer key indicates a breaking change. * * @param key - The footer key to check * @returns True if the key indicates a breaking change * * @example Checking if a footer key indicates breaking change * ```typescript * isBreakingFooterKey('BREAKING CHANGE') * // => true * * isBreakingFooterKey('BREAKING-CHANGE') * // => true * * isBreakingFooterKey('Refs') * // => false * ``` */ declare function isBreakingFooterKey(key: string): boolean; /** Conventional commit type identifier (e.g., 'feat', 'fix', 'docs'). */ type CommitType = 'feat' | 'fix' | 'docs' | 'style' | 'refactor' | 'perf' | 'test' | 'build' | 'ci' | 'chore' | 'revert' | string; declare const COMMIT_TYPES: { readonly feat: { readonly description: "A new feature"; readonly semverBump: "minor"; }; readonly fix: { readonly description: "A bug fix"; readonly semverBump: "patch"; }; readonly docs: { readonly description: "Documentation only changes"; readonly semverBump: "none"; }; readonly style: { readonly description: "Code style changes (formatting, etc.)"; readonly semverBump: "none"; }; readonly refactor: { readonly description: "Code refactoring without feature or fix"; readonly semverBump: "none"; }; readonly perf: { readonly description: "Performance improvements"; readonly semverBump: "patch"; }; readonly test: { readonly description: "Adding or updating tests"; readonly semverBump: "none"; }; readonly build: { readonly description: "Build system or dependencies"; readonly semverBump: "none"; }; readonly ci: { readonly description: "CI/CD configuration"; readonly semverBump: "none"; }; readonly chore: { readonly description: "Other changes"; readonly semverBump: "none"; }; readonly revert: { readonly description: "Revert a previous commit"; readonly semverBump: "patch"; }; }; declare const RELEASE_TYPES: readonly ["feat", "fix", "perf", "revert"]; declare const MINOR_TYPES: readonly ["feat"]; declare const PATCH_TYPES: readonly ["fix", "perf", "revert"]; /** * Checks if a commit type is a standard type. * * @param type - The commit type to check * @returns True if the type is a standard conventional commit type * * @example Checking for standard commit types * ```typescript * isStandardType('feat') * // => true * * isStandardType('custom') * // => false * ``` */ declare function isStandardType(type: string): type is CommitType; /** * Checks if a commit type triggers a release. * * @param type - The commit type to check * @returns True if the type triggers a release * * @example Checking for release-triggering types * ```typescript * isReleaseType('feat') * // => true * * isReleaseType('chore') * // => false * ``` */ declare function isReleaseType(type: string): boolean; /** * Gets the semver bump level for a commit type. * Returns 'none' for types that don't trigger a bump. * * @param type - The commit type * @param breaking - Whether this is a breaking change * @returns The semver bump level ('major', 'minor', 'patch', or 'none') * * @example Determining semver bump level * ```typescript * getSemverBump('feat', false) * // => 'minor' * * getSemverBump('fix', true) * // => 'major' * * getSemverBump('docs', false) * // => 'none' * ``` */ declare function getSemverBump(type: string, breaking: boolean): 'major' | 'minor' | 'patch' | 'none'; /** Footer trailer in a conventional commit message */ interface CommitFooter { /** Footer key (e.g., "BREAKING CHANGE", "Refs", "Fixes") */ readonly key: string; /** Footer value */ readonly value: string; /** Whether key used `:` or ` #` separator */ readonly separator: ':' | ' #'; } /** Parsed conventional commit message per https://www.conventionalcommits.org/en/v1.0.0/ */ interface ConventionalCommit { /** Commit type (feat, fix, docs, etc.) */ readonly type: CommitType; /** Scopes in parentheses (empty array when header has no scope) */ readonly scope: readonly string[]; /** Subject line (after colon) */ readonly subject: string; /** Full commit body */ readonly body?: string; /** Parsed footer trailers */ readonly footers: readonly CommitFooter[]; /** Whether this is a breaking change */ readonly breaking: boolean; /** Breaking change description (from footer or subject !) */ readonly breakingDescription?: string; /** Original raw message */ readonly raw: string; } /** * Creates a commit footer. * * @param key - Footer identifier such as 'Refs', 'Fixes', or 'BREAKING CHANGE' * @param value - Associated content for the footer entry * @param separator - Delimiter between key and value (':' or ' #') * @returns A new CommitFooter object * * @example Creating commit footers * ```typescript * createCommitFooter('Refs', '#123') * // => { key: 'Refs', value: '#123', separator: ':' } * * createCommitFooter('Fixes', '456', ' #') * // => { key: 'Fixes', value: '456', separator: ' #' } * ``` */ declare function createCommitFooter(key: string, value: string, separator?: ':' | ' #'): CommitFooter; /** * Allows callers to bypass the `type`/`subject`/`scope` formatter and pass a * pre-built raw commit string. */ type RawCommitOverride = { /** Raw commit message string override */ raw?: string; }; /** * Optional inputs accepted by {@link createConventionalCommit} on top of `type` and `subject`. */ type CreateConventionalCommitOptions = Partial> & RawCommitOverride; /** * Creates a conventional commit. * * @param type - The commit type (e.g., 'feat', 'fix') * @param subject - The commit subject line * @param options - Optional configuration for scope, body, footers, etc. * @returns A new ConventionalCommit object * * @example Creating conventional commits * ```typescript * createConventionalCommit('feat', 'add user authentication') * // => { type: 'feat', subject: 'add user authentication', scope: [], footers: [], breaking: false, raw: 'feat: add user authentication' } * * createConventionalCommit('fix', 'resolve memory leak', { scope: ['core'], breaking: true }) * // => { type: 'fix', subject: 'resolve memory leak', scope: ['core'], breaking: true, ... } * * createConventionalCommit('feat', 'add x', { scope: ['versioning', 'questions'] }) * // => { ..., scope: ['versioning', 'questions'], raw: 'feat(versioning,questions): add x' } * ``` */ declare function createConventionalCommit(type: CommitType, subject: string, options?: CreateConventionalCommitOptions): ConventionalCommit; export { COMMIT_TYPES, MINOR_TYPES, PATCH_TYPES, RELEASE_TYPES, createBreakingFromFooter, createBreakingFromSubject, createCommitFooter, createConventionalCommit, createNonBreaking, getSemverBump, isBreakingFooterKey, isReleaseType, isStandardType }; export type { BreakingChange, CommitFooter, CommitType, ConventionalCommit };