/**
 * Checkpoint Versioning System
 *
 * Extends checkpoint management with version control features:
 * - Named versions (tags)
 * - Version branches
 * - Version history with metadata
 * - Diff between versions
 * - Merge capabilities
 */
import { EventEmitter } from 'events';
import { Checkpoint } from './checkpoint-manager.js';
export interface Version {
    id: string;
    name?: string;
    description: string;
    parentId: string | null;
    branchName: string;
    checkpoint: Checkpoint;
    metadata: VersionMetadata;
    createdAt: Date;
}
export interface VersionMetadata {
    author?: string;
    sessionId?: string;
    toolName?: string;
    tags: string[];
    custom: Record<string, unknown>;
}
export interface Branch {
    name: string;
    headVersionId: string;
    createdAt: Date;
    description?: string;
}
export interface VersionDiff {
    added: string[];
    modified: string[];
    deleted: string[];
    unchanged: string[];
    details: Array<{
        path: string;
        type: 'added' | 'modified' | 'deleted';
        oldContent?: string;
        newContent?: string;
        hunks?: DiffHunk[];
    }>;
}
export interface DiffHunk {
    oldStart: number;
    oldLines: number;
    newStart: number;
    newLines: number;
    lines: string[];
}
export interface VersioningConfig {
    storageDir?: string;
    maxVersionsPerBranch?: number;
    defaultBranch?: string;
    autoSave?: boolean;
}
/**
 * Checkpoint Versioning Manager
 */
export declare class CheckpointVersioning extends EventEmitter {
    private config;
    private versions;
    private branches;
    private currentBranch;
    private tags;
    private workingDirectory;
    constructor(config?: VersioningConfig);
    /**
     * Create a new version from a checkpoint
     */
    createVersion(checkpoint: Checkpoint, options?: {
        name?: string;
        description?: string;
        metadata?: Partial<VersionMetadata>;
    }): Version;
    /**
     * Generate a unique version ID based on content hash
     */
    private generateVersionId;
    /**
     * Create a tag for a version
     */
    createTag(versionId: string, tagName: string): void;
    /**
     * Delete a tag
     */
    deleteTag(tagName: string): boolean;
    /**
     * Get version by tag name
     */
    getVersionByTag(tagName: string): Version | undefined;
    /**
     * Create a new branch
     */
    createBranch(name: string, fromVersionId?: string, description?: string): Branch;
    /**
     * Switch to a different branch
     */
    switchBranch(name: string): Branch;
    /**
     * Delete a branch
     */
    deleteBranch(name: string): boolean;
    /**
     * Get the current version (head of current branch)
     */
    getCurrentVersion(): Version | undefined;
    /**
     * Get version history for current branch
     */
    getVersionHistory(options?: {
        limit?: number;
        branch?: string;
    }): Version[];
    /**
     * Checkout a specific version
     */
    checkout(versionId: string): Promise<{
        success: boolean;
        restored: string[];
        errors: string[];
    }>;
    /**
     * Diff between two versions
     */
    diff(fromVersionId: string, toVersionId: string): VersionDiff;
    /**
     * Compute diff hunks between two file contents
     */
    private computeDiffHunks;
    /**
     * Find common ancestor of two versions
     */
    findCommonAncestor(versionId1: string, versionId2: string): Version | undefined;
    /**
     * Save versioning state to disk
     */
    save(): Promise<void>;
    /**
     * Load versioning state from disk
     */
    load(): Promise<void>;
    /**
     * Get all branches
     */
    getBranches(): Branch[];
    /**
     * Get current branch name
     */
    getCurrentBranch(): string;
    /**
     * Get all tags
     */
    getTags(): Map<string, string>;
    /**
     * Get a version by ID
     */
    getVersion(id: string): Version | undefined;
    /**
     * Format version for display
     */
    formatVersion(version: Version): string;
    /**
     * Get statistics
     */
    getStats(): {
        totalVersions: number;
        totalBranches: number;
        totalTags: number;
        versionsPerBranch: Record<string, number>;
    };
    /**
     * Clean up old versions
     */
    prune(keepCount?: number): number;
    /**
     * Dispose and cleanup resources
     */
    dispose(): void;
}
/**
 * Get the checkpoint versioning instance
 */
export declare function getCheckpointVersioning(config?: VersioningConfig): CheckpointVersioning;
/**
 * Reset the versioning instance
 */
export declare function resetCheckpointVersioning(): void;
export default CheckpointVersioning;
