/** * .env File Read/Write Helpers * Pure fs helpers for creating and upserting KEY=value lines in dotenv-style * files. Used by `pop init` (and available to any command that needs to * persist config). Deliberately NOT a dotenv wrapper — env-load.ts owns * LOADING; this module owns WRITING. * * Format contract: * - one `KEY=value` per line, values written verbatim (no quoting) so a * round-trip through readEnvFile is byte-stable for simple values * - files are chmod 0600 by default (they hold private keys); the parent * directory is created if missing * - updateEnvVar preserves every other line INCLUDING comments and blanks, * touching only the target key (or appending it when absent) */ /** * Write `vars` as KEY=value lines to `filePath`, creating the parent directory * if needed and chmod-ing the file to `opts.mode` (default 0600). Overwrites * any existing file — callers that must not clobber should check existence * first (see `pop init`'s --force gate). */ export declare function writeEnvFile(filePath: string, vars: Record, opts?: { mode?: number; }): void; /** * Upsert a single `key=value` pair in `filePath`, preserving every other line * (comments and blanks included). Creates the file (chmod 0600) with just this * one line when it does not exist. Only the FIRST occurrence of the key is * rewritten; the value is written verbatim. */ export declare function updateEnvVar(filePath: string, key: string, value: string): void; /** * Parse `filePath` into a plain object of KEY→value. Blank lines and comment * lines (leading #) are skipped; the value is everything after the first `=`, * with a single layer of surrounding single/double quotes stripped so files * written by other tools still read cleanly. Returns {} when the file is * absent. */ export declare function readEnvFile(filePath: string): Record;