* copy — the caller re-verifies completeness afterwards. Exported for tests.
*/
export async function promoteDir(from: string, to: string): Promise<void> {
foundryLocalRuntime.ts
await fs.promises.mkdir(dirname(to), { recursive: true });
try {
await fs.promises.rename(from, to);
} catch (err) {
// A concurrent winner already created `to` (EEXIST/ENOTEMPTY), or the
// staging dir is on a different filesystem. If a copy is already present,