/** * Baseline versioning using CLI package version. * * Compatibility Rules: * - Same CLI major version = COMPATIBLE (can compare baselines) * - Different CLI major version = INCOMPATIBLE (requires migration) * * This aligns with semantic versioning: major version changes signal * breaking changes, including baseline format changes. */ /** * Get the current CLI version for baseline creation. */ export declare function getBaselineVersion(): string; /** * Parsed semantic version components. */ export interface FormatVersion { /** Major version - breaking changes require new major version */ major: number; /** Minor version - additive/backwards-compatible changes */ minor: number; /** Patch version - bug fixes */ patch: number; /** Original raw version string */ raw: string; } /** * Result of a version compatibility check. */ export interface VersionCompatibility { /** Whether the versions are compatible for comparison */ compatible: boolean; /** Warning message if versions differ (null if identical) */ warning: string | null; /** Source baseline version */ sourceVersion: string; /** Target baseline version */ targetVersion: string; } /** * Error thrown when baseline versions are incompatible. */ export declare class BaselineVersionError extends Error { readonly sourceVersion: string; readonly targetVersion: string; constructor(message: string, sourceVersion: string, targetVersion: string); } /** * Parse a version string into its semantic components. * * Handles: * - Full semver: "1.0.0" -> { major: 1, minor: 0, patch: 0 } * - Partial semver: "1.0" -> { major: 1, minor: 0, patch: 0 } * - Legacy numeric: 1 -> { major: 1, minor: 0, patch: 0 } * * @param version - Version string or number to parse * @returns Parsed version components */ export declare function parseVersion(version: string | number | undefined): FormatVersion; /** * Check if two versions are compatible for baseline comparison. * * Versions are compatible if they share the same major version. * * @param v1 - First version * @param v2 - Second version * @returns true if compatible, false otherwise */ export declare function areVersionsCompatible(v1: FormatVersion, v2: FormatVersion): boolean; /** * Compare two versions and return -1, 0, or 1. * * @param v1 - First version * @param v2 - Second version * @returns -1 if v1 < v2, 0 if equal, 1 if v1 > v2 */ export declare function compareVersions(v1: FormatVersion, v2: FormatVersion): -1 | 0 | 1; /** * Get a warning message for version differences, or null if versions are identical. * * @param v1 - First version (source/baseline) * @param v2 - Second version (target/current) * @returns Warning message or null */ export declare function getCompatibilityWarning(v1: FormatVersion, v2: FormatVersion): string | null; /** * Check version compatibility and return detailed result. * * @param sourceVersion - Version of the source/baseline * @param targetVersion - Version of the target/current * @returns Compatibility result with details */ export declare function checkVersionCompatibility(sourceVersion: string | number | undefined, targetVersion: string | number | undefined): VersionCompatibility; /** * Assert that two versions are compatible, throwing an error if not. * * @param sourceVersion - Version of the source/baseline * @param targetVersion - Version of the target/current * @throws BaselineVersionError if versions are incompatible */ export declare function assertVersionCompatibility(sourceVersion: string | number | undefined, targetVersion: string | number | undefined): void; /** * Format a version for display. * * @param version - Version to format * @returns Formatted version string like "v1.0.0" */ export declare function formatVersion(version: string | number | undefined): string; /** * Check if a version is the current CLI version. * * @param version - Version to check * @returns true if version matches current CLI version */ export declare function isCurrentVersion(version: string | number | undefined): boolean; /** * Check if a version is older than the current CLI version. * * @param version - Version to check * @returns true if version is older than current */ export declare function isOlderVersion(version: string | number | undefined): boolean; /** * Check if a version is newer than the current CLI version. * * @param version - Version to check * @returns true if version is newer than current */ export declare function isNewerVersion(version: string | number | undefined): boolean; /** * Check if a baseline version requires migration (different major version). * * @param version - Version to check * @returns true if baseline needs migration to be compatible */ export declare function requiresMigration(version: string | number | undefined): boolean; //# sourceMappingURL=version.d.ts.map