export { expandTildePath } from "./path-helpers"; export interface FileOverride { /** * Path where the file should be written. * - Absolute paths: "/app/.env", "/etc/config/app.conf" * - Tilde expansion: "~/.config/app.json" (expands to home directory) * - Relative paths: "./file.txt", "config.json" (resolved against working directory) */ path: string; /** * Plain text content to write to the file. * Mutually exclusive with `base64`. */ content?: string; /** * Base64-encoded binary content to write to the file. * Mutually exclusive with `content`. */ base64?: string; } export interface SentryLike { captureException: (error: unknown) => void; } export interface AppliedFile { path: string; size: number; md5: string; } export interface FailedFile { path: string; error: string; size: number; md5: string; } export interface ApplyFileOverridesResult { success: boolean; appliedFiles: AppliedFile[]; failedFiles: FailedFile[]; } /** * Resolve a file path to an absolute path. * Handles tilde expansion, relative paths, and absolute paths. * @param filePath - The file path to resolve * @param workingDirectory - Optional working directory for resolving relative paths * @returns Resolved absolute path */ export declare function resolveFilePath(filePath: string, workingDirectory?: string): string; /** * Validate that a file path can be resolved to an absolute path * Supports tilde (~) expansion and relative paths (when workingDirectory is provided) * @param filePath - The file path to validate * @param workingDirectory - Optional working directory for resolving relative paths * @returns true if valid, false otherwise */ export declare function isValidFilePath(filePath: string, workingDirectory?: string): boolean; /** * Apply multiple file overrides to the filesystem. * This function will: * 1. Validate each file path * 2. Resolve relative paths against working directory * 3. Create directories as needed * 4. Write files with the provided content * 5. Return detailed results for success/failure of each file * * @param overrides - Array of file overrides to apply * @param workingDirectory - Optional working directory for resolving relative paths * @param sentry - Optional Sentry instance for error logging * @returns Object with overall success status and details for each file */ export declare function applyFileOverrides(overrides: FileOverride[], workingDirectory?: string, sentry?: SentryLike): ApplyFileOverridesResult; /** * Read a file and return its content * Supports tilde (~) expansion and relative paths. * @param filePath - The path to the file to read * @param workingDirectory - Optional working directory for resolving relative paths * @returns The file content or null if it cannot be read */ export declare function readFileOverride(filePath: string, workingDirectory?: string): string | null; /** * Check if a file exists at the given path * Supports tilde (~) expansion and relative paths. * @param filePath - The path to check * @param workingDirectory - Optional working directory for resolving relative paths * @returns true if the file exists, false otherwise */ export declare function fileOverrideExists(filePath: string, workingDirectory?: string): boolean;