@iyulab/oops
Version:
Core SDK for Oops - Safe text file editing with automatic backup
74 lines • 1.91 kB
TypeScript
/**
* VersionManager - Git-style version management system
* Implements semantic versioning with branching (1.0 → 1.1 → 1.1.1)
*/
export interface VersionInfo {
version: string;
message: string;
timestamp: Date;
checksum: string;
parentVersions: string[];
}
export interface CommitResult {
filePath: string;
version: string;
message?: string;
previousVersion?: string;
}
export interface VersionTree {
version: string;
message: string;
timestamp: Date;
checksum: string;
children: VersionTree[];
}
export declare class VersionManager {
private git;
private repoPath;
private filePath;
constructor(repoPath: string, filePath: string);
/**
* Initialize version system for a file
*/
initialize(): Promise<void>;
/**
* Create a new version from current file state
*/
commit(message?: string): Promise<CommitResult | null>;
/**
* Checkout a specific version
*/
checkout(version: string): Promise<void>;
/**
* Get diff between versions
*/
getDiff(fromVersion?: string, toVersion?: string): Promise<string>;
/**
* Check if file has changes since last version
*/
hasChanges(): Promise<boolean>;
/**
* Get all versions in chronological order
*/
getAllVersions(): Promise<VersionInfo[]>;
/**
* Get current version (latest tag)
*/
getCurrentVersion(): Promise<string | null>;
/**
* Get version history as a tree structure
*/
getVersionTree(): Promise<VersionTree[]>;
/**
* Remove all version data
*/
cleanup(): Promise<void>;
private createTag;
private getNextVersion;
private getVersionChecksum;
private getParentVersions;
private compareVersions;
private insertVersionInTree;
private findVersionInTree;
}
//# sourceMappingURL=version-manager.d.ts.map