/**
 * Write updates to `.env` files while preserving formatting.
 *
 * @module
 */
/**
 * Options for updating environment variables in a .env file.
 */
export interface UpdateEnvVariableOptions {
    /** Path to the .env file. */
    env_file_path: string;
    /** Function to read file contents (defaults to `node:fs/promises` `readFile`). */
    read_file?: (path: string, encoding: string) => Promise<string>;
    /** Function to write file contents (defaults to `node:fs/promises` `writeFile`). */
    write_file?: (path: string, content: string, encoding: string) => Promise<void>;
}
/**
 * Updates or adds an environment variable in the .env file.
 * Preserves existing formatting, comments, and other variables.
 *
 * Behavior:
 * - **Duplicate keys**: updates the LAST occurrence (matches dotenv behavior)
 * - **Inline comments**: preserved after the value (e.g., `KEY=value # comment`)
 * - **Quote style**: preserved from original (quoted/unquoted)
 *
 * @warning Not atomic; not safe for concurrent writers. Reads the file, mutates
 * in memory, then writes it back — a crash or concurrent write can corrupt
 * the file. Acceptable for single-user, infrequent edits; revisit if a
 * concurrent-writer consumer emerges.
 *
 * @param key - the environment variable name (e.g., `'SOME_CONFIGURATION_KEY'`)
 * @param value - the new value for the environment variable
 * @param options - file path and optional read/write overrides
 * @mutates filesystem - writes the updated content back to `options.env_file_path`
 * @throws Error if the file read fails for any reason other than `ENOENT`, or if the write fails
 */
export declare const update_env_variable: (key: string, value: string, options: UpdateEnvVariableOptions) => Promise<void>;
//# sourceMappingURL=update_env_variable.d.ts.map