From 19d9b7242aa9a573358b0588c8172e075fc6d677 Mon Sep 17 00:00:00 2001 From: Paul Valladares Date: Tue, 21 Jul 2026 22:19:44 -0600 Subject: [PATCH] fix: give watch the banner and loading frame --- src/cli.ts | 4 ++-- src/commands/watch.ts | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 18d1d03..9836152 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -81,8 +81,8 @@ if (args.version) { } const [command] = args._; -// keep --json pipe-clean; watch takes the whole screen immediately -if (!args.json && command !== "watch") await animateBanner(); +// keep --json pipe-clean +if (!args.json) await animateBanner(); if (args.help) { console.log(colorUsage(usage)); diff --git a/src/commands/watch.ts b/src/commands/watch.ts index 160498d..6abcfd0 100644 --- a/src/commands/watch.ts +++ b/src/commands/watch.ts @@ -1,4 +1,6 @@ +import { styleText } from "node:util"; import { alternateBuffer, createInput, createTerm, cursor } from "@bomb.sh/tty"; +import * as p from "@clack/prompts"; import { getProfile, type ActorProfile } from "../api/bobbin.js"; import { fetchMotd, probeKnot } from "../api/knot.js"; import { loadNetwork } from "../core/network.js"; @@ -20,18 +22,18 @@ export async function run(flags: { json?: boolean; fresh?: boolean }) { process.exit(1); } - process.stdout.write("assembling the network…"); + p.intro(styleText("green", "fiddling with knots")); + const spin = p.spinner(); + spin.start("assembling the network"); let network: Awaited>; try { - network = await loadNetwork(!!flags.fresh, (msg) => - process.stdout.write(`\r\x1b[K${msg}`), - ); + network = await loadNetwork(!!flags.fresh, (msg) => spin.message(msg)); } catch (err) { - process.stdout.write("\r\x1b[K"); + spin.stop("upstream failure", 1); console.error(err instanceof Error ? err.message : err); process.exit(2); } - process.stdout.write("\r\x1b[K"); + spin.stop("network assembled — entering the board"); const state: WatchState = { network, -- 2.51.2