feat: colorful progress output with icons and SSH command

Progress callbacks from kickstart now show:
  ◆ 78:55:36:08:35:14  partitioning -- preparing disk layout
  ◆◆◆ 78:55:36:08:35:14  post-install -- configuring system
  ✔ 78:55:36:08:35:14  complete -- ready at 10.0.1.88

    ssh michal@10.0.1.88

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michal
2026-03-17 12:04:52 +00:00
parent 9803817004
commit 520af41a52

View File

@@ -72,7 +72,18 @@ export function registerApiRoutes(
const stageName = stage ?? "unknown"; const stageName = stage ?? "unknown";
const detailStr = detail ?? ""; const detailStr = detail ?? "";
logger.info(`Progress: ${mac} ${stageName}${detailStr ? ` -- ${detailStr}` : ""}`); const GREEN = "\x1b[0;32m";
const YELLOW = "\x1b[1;33m";
const RED = "\x1b[0;31m";
const BOLD = "\x1b[1m";
const RESET = "\x1b[0m";
const icons: Record<string, string> = {
partitioning: "◆", installing: "◆◆", "post-install": "◆◆◆",
complete: "✔", error: "✘",
};
const icon = icons[stageName] ?? "·";
const color = stageName === "complete" ? GREEN : stageName === "error" ? RED : YELLOW;
console.log(` ${color}${icon}${RESET} ${mac} ${BOLD}${stageName}${RESET}${detailStr ? ` -- ${detailStr}` : ""}`);
state.update((s) => { state.update((s) => {
const queueEntry = s.install_queue[mac]; const queueEntry = s.install_queue[mac];
@@ -100,7 +111,8 @@ export function registerApiRoutes(
}; };
s.installed[mac] = installedInfo; s.installed[mac] = installedInfo;
logger.info(`INSTALL COMPLETE: ${mac} -> ${installedInfo.hostname} (${ip})`); const admin = state.load().installed[mac]?.role ? "michal" : "root";
console.log(`\n \x1b[0;32m\x1b[1m ssh ${admin}@${ip}\x1b[0m\n`);
} }
} }
}); });