/** * Path encoding utility for converting working directory paths to filesystem-safe names * Handles cross-platform directory name encoding for project-based session organization */ /** * Project directory information */ export interface ProjectDirectory { readonly originalPath: string; readonly encodedName: string; readonly encodedPath: string; readonly pathHash?: string; readonly isSymbolicLink: boolean; } /** * Path encoding configuration options */ export interface PathEncodingOptions { maxLength?: number; pathSeparatorReplacement?: string; spaceReplacement?: string; invalidCharReplacement?: string; hashLength?: number; } /** * Platform-specific filesystem constraints */ export interface FilesystemConstraints { readonly maxDirectoryNameLength: number; readonly maxPathLength: number; readonly invalidCharacters: string[]; readonly reservedNames: string[]; readonly caseSensitive: boolean; } /** * Path validation result */ export interface PathValidationResult { readonly isValid: boolean; readonly errors: string[]; readonly warnings: string[]; readonly suggestedFix?: string; } /** * PathEncoder class for converting working directory paths to filesystem-safe names */ export declare class PathEncoder { private readonly options; private readonly constraints; constructor(options?: PathEncodingOptions); /** * Encode a working directory path to a filesystem-safe directory name */ encode(originalPath: string): Promise; /** * Synchronously encode a path to a filesystem-safe directory name * Note: Does not resolve symbolic links - use encode() for full path resolution */ encodeSync(pathToEncode: string): string; /** * Decode an encoded directory name back to original path (limited functionality) * Note: This is best-effort as encoding is lossy */ decode(encodedName: string): Promise; /** * Synchronously decode an encoded directory name back to original path (limited functionality) * Note: This is best-effort as encoding is lossy */ decodeSync(encodedName: string): string | null; /** * Resolve symbolic links and normalize path before encoding */ resolvePath(path: string): Promise; /** * Get project directory info without creating the directory */ getProjectDirectory(originalPath: string, baseSessionDir: string): Promise; /** * Create project directory entity from original path */ createProjectDirectory(originalPath: string, baseSessionDir: string): Promise; /** * Validate that an encoded name is filesystem-safe */ validateEncodedName(encodedName: string): boolean; /** * Handle encoding collisions by generating unique names */ resolveCollision(baseName: string, existingNames: Set): string; /** * Get platform-specific filesystem constraints */ private getFilesystemConstraints; /** * Generate hash for collision resolution */ private generateHash; /** * Expand tilde (~) to home directory */ private expandTilde; } /** * Default PathEncoder instance */ export declare const pathEncoder: PathEncoder;