diff --git a/src/commands/list.ts b/src/commands/list.ts index e447431..1dac6e3 100644 --- a/src/commands/list.ts +++ b/src/commands/list.ts @@ -39,17 +39,25 @@ export async function run(flags: { return styleText("yellow", "pre-v1.15 ⚠"); // pre-v1.14 knots silently drop pushes/prs/issues }; + const latencyLabel = (k: (typeof shown)[number]) => { + const ms = k.probe?.latencyMs; + if (ms === undefined) return dim("—"); + const color = ms < 500 ? "green" : ms < 2000 ? "yellow" : "red"; + return styleText(color, `${ms}ms`); + }; + const rows = shown.map((k) => [ k.host, String(k.repoCount), versionLabel(k), + latencyLabel(k), k.local ? dim("—") : k.managed ? "managed" : "self-hosted", k.owners[0] ? `@${k.owners[0].handle}${k.owners.length > 1 ? dim(` +${k.owners.length - 1}`) : ""}` : dim("—"), ]); - const header = ["HOST", "REPOS", "VERSION", "TYPE", "OWNER"]; + const header = ["HOST", "REPOS", "VERSION", "MS", "TYPE", "OWNER"]; // biome-ignore lint/suspicious/noControlCharactersInRegex: stripping our own ansi colors for width math const visible = (s: string) => s.replace(/\x1b\[\d+m/g, "").length; const widths = header.map((h, i) =>