import { type VersionGuardConfig } from '../types'; /** * Tag management helpers for reading, validating, and creating release tags. * * @packageDocumentation * @public */ /** * Tag entry point exports for release-tag management helpers. * * @packageDocumentation * @public * @since 0.1.0 * @forgeIgnore E020 */ export interface TagInfo { /** * Full git tag name, including any prefix such as `v`. */ name: string; /** * Normalized version string derived from the tag name. */ version: string; /** * Annotated tag message when one is available. * * @defaultValue `undefined` */ message?: string; /** * Timestamp associated with the tag lookup result. */ date: Date; } /** * Returns the most recent reachable git tag for a repository. * * @public * @since 0.1.0 * @remarks * This helper reads the most recent annotated or lightweight tag that `git describe` * can resolve from the current HEAD. It returns `null` when no tags are available * or when git metadata cannot be read. * * @param cwd - Repository directory to inspect. * @returns The latest tag details, or `null` when no tag can be resolved. * * @example * ```typescript * const latestTag = getLatestTag(process.cwd()); * * if (latestTag) { * console.log(latestTag.version); * } * ``` */ export declare function getLatestTag(cwd?: string): TagInfo | null; /** * Lists all tags in a repository. * * @public * @since 0.1.0 * @remarks * This helper returns tag names in the order provided by `git tag --list`. The * `date` field is populated with the current time because the implementation does * not perform per-tag date lookups. * * @param cwd - Repository directory to inspect. * @returns A list of discovered tags, or an empty array when tags cannot be read. * * @example * ```typescript * const tags = getAllTags(process.cwd()); * console.log(tags.map((tag) => tag.name)); * ``` */ export declare function getAllTags(cwd?: string): TagInfo[]; /** * Creates a release tag and optionally fixes version state first. * * @public * @since 0.1.0 * @remarks * When `autoFix` is enabled, this helper updates versioned files, stages the * changes, and creates a release commit before creating the annotated tag. It * returns a structured result instead of throwing for most expected failures. * * @param version - Version to embed in the new tag name. * @param message - Custom annotated tag message. * @param autoFix - Whether to auto-fix version mismatches before tagging. * @param config - Loaded VersionGuard configuration used for validation and fixes. * @param cwd - Repository directory where git commands should run. * @returns The tagging outcome and any actions performed along the way. * * @example * ```typescript * const result = createTag('1.2.3', 'Release 1.2.3', true, config, process.cwd()); * * if (!result.success) { * console.error(result.message); * } * ``` */ export declare function createTag(version: string, message?: string, autoFix?: boolean, config?: VersionGuardConfig, cwd?: string): { success: boolean; message: string; actions: string[]; }; /** * Runs post-tag validation and sync checks. * * @public * @since 0.1.0 * @remarks * This helper is intended for the `post-tag` git hook flow. It validates the * latest tag against the configured versioning rules and reports any required * follow-up actions without mutating git history. * * @param config - Loaded VersionGuard configuration used during validation. * @param cwd - Repository directory where validation should run. * @returns The post-tag workflow result and any follow-up actions. * * @example * ```typescript * const result = handlePostTag(config, process.cwd()); * console.log(result.success); * ``` */ export declare function handlePostTag(config: VersionGuardConfig, cwd?: string): { success: boolean; message: string; actions: string[]; }; /** * Validates that a local tag is safe to push to the default remote. * * @public * @since 0.1.0 * @remarks * This helper checks that the tag exists locally and, when the tag also exists on * `origin`, verifies that both references point to the same commit. * * @param tagName - Name of the tag to validate. * @param cwd - Repository directory where git commands should run. * @returns A validation result with an optional suggested fix command. * * @example * ```typescript * const result = validateTagForPush('v1.2.3', process.cwd()); * console.log(result.valid); * ``` */ export declare function validateTagForPush(tagName: string, cwd?: string): { valid: boolean; message: string; fix?: string; }; /** * Suggests an annotated tag message from changelog content. * * @public * @since 0.1.0 * @remarks * When a matching changelog entry exists, this helper uses the first bullet point * as a concise release summary. It falls back to a generic `Release {version}` * message when no changelog context is available. * * @param version - Version that the tag will represent. * @param cwd - Repository directory containing the changelog file. * @returns A suggested annotated tag message. * * @example * ```typescript * const message = suggestTagMessage('1.2.3', process.cwd()); * console.log(message); * ``` */ export declare function suggestTagMessage(version: string, cwd?: string): string; //# sourceMappingURL=index.d.ts.map