export function sleepWithCountdown(seconds: number): Promise { return new Promise((resolve) => { let remaining = seconds; const update = () => { const msg = `⏳ Waiting ${remaining}s...`; const padded = msg.padEnd(30, " "); // make sure old content is erased process.stdout.write(`\r${padded}`); }; update(); // initial print const interval = setInterval(() => { remaining--; if (remaining > 0) { update(); } else { clearInterval(interval); process.stdout.write(`\r✅ Resuming now \n`); resolve(); } }, 1000); }); }