declare function setDryRun(value: boolean): void; declare function isDryRun(): boolean; /** Snapshot of the files that would have been written during the current dry run. */ declare function getDryRunLog(): { filePath: string; bytes: number; }[]; /** * Atomic, backup-protected write for any project file. Honors dry-run. * * Ordering guarantees: * 1. In dry-run, records the intent and returns without touching disk. * 2. Rotates a timestamped backup of the current file (keeps the last N). * 3. Writes to a `.tmp` sibling, then renames it over the target. rename() is * atomic on the same volume, so an interrupted write can never leave a * half-written JSON in place — the old file survives until the rename. * The legacy single-level `.bak` is still produced for backward compatibility. */ declare function safeWrite(filePath: string, content: string): Promise; /** * Get the full path to a data file in the RPG Maker MV project. * All data files live under {projectPath}/data/ */ declare function getDataPath(projectPath: string, filename: string): string; /** * Get the full path to a map file. * Map files are named Map001.json, Map002.json, etc. */ declare function getMapPath(projectPath: string, mapId: number): string; /** * Read and parse a JSON file from the RPG Maker MV data directory. * @param {string} projectPath - The project root path * @param {string} filename - The filename within data/ (e.g. "Actors.json") * @returns {Promise} Parsed JSON content */ declare function readJson(projectPath: string, filename: string): Promise; /** * Write JSON data to a file in the RPG Maker MV data directory. * Creates a .bak backup before writing. Logs write to stderr. * @param {string} projectPath - The project root path * @param {string} filename - The filename within data/ (e.g. "Actors.json") * @param {any} data - The data to serialize and write */ declare function writeJson(projectPath: string, filename: string, data: unknown): Promise; /** * Ensure a JSON array handles RPG Maker MV's convention of null at index 0. * MV stores data arrays where index 0 is always null and real data starts at index 1. * This function guarantees the array has the null padding. * @param {any[]} json - The parsed JSON array * @returns {any[]} The array with null at index 0 guaranteed */ declare function ensureArray(json: unknown): unknown[]; /** * Find the next available ID in a RPG Maker MV data array. * MV arrays have null at index 0, and IDs correspond to array indices. * Skips null entries and finds the highest existing ID, then returns max+1. * @param {any[]} array - The data array (e.g. from Actors.json) * @returns {number} The next available ID */ declare function nextId(array: unknown[]): number; /** * Validate that the RPG Maker MV project path is valid. * Checks that data/System.json exists (essential project file). * @param {string} projectPath - The project root path to validate * @returns {Promise} True if valid project path */ declare function validateProjectPath(projectPath: string): Promise; export { getDataPath }; export { getMapPath }; export { readJson }; export { writeJson }; export { safeWrite }; export { setDryRun }; export { isDryRun }; export { getDryRunLog }; export { ensureArray }; export { nextId }; export { validateProjectPath };