@ooples/token-optimizer-mcp
Version:
Intelligent context window optimization for Claude Code - store content externally via caching and compression, freeing up your context window for what matters
38 lines • 1.29 kB
TypeScript
/**
* Diff utilities for smart file operations
* Provides efficient diff generation with token optimization
*/
export interface DiffResult {
added: string[];
removed: string[];
unchanged: number;
totalLines: number;
diffText: string;
compressionRatio: number;
}
export interface DiffOptions {
contextLines?: number;
ignoreWhitespace?: boolean;
wordLevel?: boolean;
}
/**
* Generate a compact diff between two strings
*/
export declare function generateDiff(oldContent: string, newContent: string, options?: DiffOptions): DiffResult;
/**
* Generate a unified diff format with context
*/
export declare function generateUnifiedDiff(oldContent: string, newContent: string, oldPath: string, newPath: string, _contextLines?: number): string;
/**
* Check if content has meaningful changes (ignores whitespace-only changes)
*/
export declare function hasMeaningfulChanges(oldContent: string, newContent: string): boolean;
/**
* Apply a diff to reconstruct the new content
*/
export declare function applyDiff(originalContent: string, diffText: string): string;
/**
* Calculate similarity ratio between two strings (0-1)
*/
export declare function calculateSimilarity(str1: string, str2: string): number;
//# sourceMappingURL=diff-utils.d.ts.map