claudes-office
Version:
CLI tool to initialize Claude's office in your project
86 lines (85 loc) • 2.79 kB
TypeScript
/**
* File comparison utilities for the update command
* These utilities help detect differences between files and directories
*/
import * as diff from 'diff';
/**
* Options for file comparison
*/
export interface FileComparisonOptions {
/** Whether to ignore whitespace differences */
ignoreWhitespace?: boolean;
/** Whether to ignore case differences */
ignoreCase?: boolean;
/** Patterns to ignore during comparison (glob patterns) */
ignorePatterns?: string[];
}
/**
* Result of a file comparison
*/
export interface FileComparisonResult {
/** Whether the files are identical */
identical: boolean;
/** Differences between the files */
differences: diff.Change[];
/** Statistics about the differences */
stats: {
/** Number of lines added */
additions: number;
/** Number of lines deleted */
deletions: number;
/** Number of lines changed */
changes: number;
};
}
/**
* Compare two files and return the differences
* @param filePath1 - Path to the first file
* @param filePath2 - Path to the second file
* @param options - Comparison options
* @returns The comparison result
*/
export declare function compareFiles(filePath1: string, filePath2: string, options?: FileComparisonOptions): Promise<FileComparisonResult>;
/**
* Information about a directory item (file or subdirectory)
*/
export interface DirectoryItem {
/** Path to the item */
path: string;
/** Whether the item is a directory */
isDirectory: boolean;
/** Relative path from the base directory */
relativePath: string;
}
/**
* Result of a directory comparison
*/
export interface DirectoryComparisonResult {
/** Items that exist only in the first directory */
onlyInDir1: DirectoryItem[];
/** Items that exist only in the second directory */
onlyInDir2: DirectoryItem[];
/** Items that exist in both directories */
inBothDirs: DirectoryItem[];
/** Files that have differences */
differentFiles: {
/** Relative path of the file */
relativePath: string;
/** Comparison result */
comparison: FileComparisonResult;
}[];
}
/**
* Compare two directories and return the differences
* @param dir1 - Path to the first directory
* @param dir2 - Path to the second directory
* @param options - Comparison options
* @returns The comparison result
*/
export declare function compareDirectories(dir1: string, dir2: string, options?: FileComparisonOptions): Promise<DirectoryComparisonResult>;
/**
* Format differences for human-readable output
* @param differences - Array of diff changes
* @returns Formatted string with differences
*/
export declare function formatDifferences(differences: diff.Change[]): string;