/** * Represents a Git commit with its SHA, message, and optional tag. */ export interface Commit { /** The full SHA hash of the commit. */ sha: string; /** The commit message (first line / subject). */ message: string; /** The tag associated with this commit, if any. */ tag?: string; } /** * Conventional commit types and their display labels */ export declare const COMMIT_TYPES: { readonly feat: "Features"; readonly fix: "Bug Fixes"; readonly docs: "Documentation"; readonly style: "Styles"; readonly refactor: "Code Refactoring"; readonly perf: "Performance Improvements"; readonly test: "Tests"; readonly build: "Build System"; readonly ci: "CI/CD"; readonly chore: "Chores"; readonly revert: "Reverts"; }; export type CommitType = keyof typeof COMMIT_TYPES; /** * Represents a parsed conventional commit */ export interface ParsedCommit extends Commit { /** The conventional commit type (feat, fix, etc.) */ type?: CommitType; /** The scope of the change (e.g., "api" in "feat(api): add endpoint") */ scope?: string; /** The commit description without the type/scope prefix */ description: string; /** Whether this is a breaking change */ breaking: boolean; } /** * Parses a commit message according to the Conventional Commits specification. * @see https://www.conventionalcommits.org/ * * @param commit - The commit to parse * @returns A ParsedCommit with type, scope, description, and breaking change info */ export declare function parseConventionalCommit(commit: Commit): ParsedCommit; /** * Determines the suggested semver bump based on parsed commits. * - Breaking changes -> major * - Features -> minor * - Everything else -> patch * * @param commits - Array of parsed commits * @returns The suggested bump type: 'major', 'minor', or 'patch' */ export declare function getSuggestedBump(commits: ParsedCommit[]): 'major' | 'minor' | 'patch'; /** * Extracts a canonical GitHub repository URL from a package.json `repository` field. * Accepts string shorthand ("owner/repo", "github:owner/repo"), full URLs * (with or without `git+` prefix and `.git` suffix), and the object form. * * @param repository - The value of the `repository` field from package.json. * @returns A URL like "https://github.com/owner/repo", or undefined if it can't be parsed. */ export declare function extractGitHubRepoUrl(repository: unknown): string | undefined; /** * Groups parsed commits by their type for release notes. * * @param commits - Array of parsed commits * @returns A Map of commit type to array of commits, plus 'other' for non-conventional commits */ export declare function groupCommitsByType(commits: ParsedCommit[]): Map; /** * Interface for Git operations used by the release tool. */ export interface Git { /** * Gets the most recent semver tag from the repository. * @returns The SHA and version string of the last tag, or undefined if no semver tags exist. */ getLastGitHubTag: () => Promise<{ sha: string; version: string; } | undefined>; /** * Gets the current (most recent) commit. * @returns The current commit object. */ getCurrentGitHubCommit: () => Promise; /** * Gets all commits between two commit SHAs. * @param shaLast - The older commit SHA (exclusive). * @param shaCurrent - The newer commit SHA (inclusive). * @returns Array of commits between the two SHAs. */ getCommitsBetween: (shaLast?: string, shaCurrent?: string) => Promise; } /** * Creates a Git interface for the specified directory. * Provides methods to query commit history and tags. * * @param cwd - The working directory of the Git repository. * @returns An object with methods to interact with the Git repository. * * @example * ```ts * const git = getGit('/path/to/repo'); * const lastTag = await git.getLastGitHubTag(); * const commits = await git.getCommitsBetween(lastTag?.sha, 'HEAD'); * ``` */ export declare function getGit(cwd: string): Git;