@iyulab/oops
Version:
Core SDK for Oops - Safe text file editing with automatic backup
69 lines • 2.24 kB
TypeScript
/**
* Version management for Oops file tracking
* Implements semantic versioning (1.0 → 1.1 → 1.2) with branching support
*/
import { VersionInfo, VersionHistory } from './types';
export declare class VersionManager {
private workspacePath;
constructor(workspacePath: string);
/**
* Initialize version tracking for a file (creates version 1)
*/
initializeVersioning(filePath: string, message?: string): Promise<VersionInfo>;
/**
* Create a new version (commit) of the file
*/
createCommit(filePath: string, message?: string): Promise<VersionInfo>;
/**
* Checkout a specific version
*/
checkout(filePath: string, version: string): Promise<void>;
/**
* Get version history for a file
*/
getVersionHistory(filePath: string): Promise<VersionHistory>;
/**
* Get diff between two versions
*/
diff(filePath: string, fromVersion: string, toVersion?: string): Promise<string>;
/**
* List all versions for a file
*/
listVersions(filePath: string): Promise<VersionInfo[]>;
/**
* Check if file has changes compared to current version
*/
hasChanges(filePath: string): Promise<boolean>;
/**
* Remove version tracking for a file
*/
removeVersioning(filePath: string): Promise<void>;
private createVersion;
/**
* Calculate next version number with branching support
* Sequential: 1.0 → 1.1 → 1.2
* Branching: 1.1 → 1.1.1 → 1.1.2 (when editing past versions)
* Sub-branching: 1.1.1 → 1.1.1.1 → 1.1.1.2
*/
private calculateNextVersion;
/**
* Increment sequential version (1.0 → 1.1, 1.1 → 1.2)
*/
private incrementSequentialVersion;
/**
* Create a branch version (1.1 → 1.1.1, 1.1.1 → 1.1.1.1)
*/
private createBranchVersion;
/**
* Get the latest sequential version (highest major.minor without branch suffix)
*/
private getLatestSequentialVersion;
private compareVersions;
private generateSimpleDiff;
private getVersionPath;
private getVersionFilePath;
private getHistoryPath;
private saveVersionHistory;
private hashPath;
}
//# sourceMappingURL=version.d.ts.map