export function sleepWithCountdown(seconds: number): Promise { return new Promise((resolve) => { let remaining = seconds; const update = () => { const msg = `⏳ Waiting ${remaining}s...`; process.stdout.clearLine(0); // Clear current line process.stdout.cursorTo(0); // Move cursor to start of line process.stdout.write(msg); // Write message }; update(); // Initial message const interval = setInterval(() => { remaining--; if (remaining > 0) { update(); } else { clearInterval(interval); process.stdout.clearLine(0); process.stdout.cursorTo(0); process.stdout.write(`✅ Resuming now\n`); resolve(); } }, 1000); }); }