refactor(status): share update channel display + one-liner

This commit is contained in:
Peter Steinberger
2026-02-17 00:29:15 +00:00
parent 1dc9bb8d62
commit ed74f48bd5
4 changed files with 40 additions and 96 deletions

View File

@@ -6,11 +6,7 @@ import { info } from "../globals.js";
import { formatTimeAgo } from "../infra/format-time/format-relative.ts";
import type { HeartbeatEventPayload } from "../infra/heartbeat-events.js";
import { formatUsageReportLines, loadProviderUsageSummary } from "../infra/provider-usage.js";
import {
formatUpdateChannelLabel,
normalizeUpdateChannel,
resolveEffectiveUpdateChannel,
} from "../infra/update-channels.js";
import { normalizeUpdateChannel, resolveUpdateChannelDisplay } from "../infra/update-channels.js";
import { formatGitInstallLabel } from "../infra/update-check.js";
import {
resolveMemoryCacheSummary,
@@ -132,10 +128,11 @@ export async function statusCommand(
: null;
const configChannel = normalizeUpdateChannel(cfg.update?.channel);
const channelInfo = resolveEffectiveUpdateChannel({
const channelInfo = resolveUpdateChannelDisplay({
configChannel,
installKind: update.installKind,
git: update.git ? { tag: update.git.tag, branch: update.git.branch } : undefined,
gitTag: update.git?.tag ?? null,
gitBranch: update.git?.branch ?? null,
});
if (opts.json) {
@@ -352,12 +349,7 @@ export async function statusCommand(
const updateAvailability = resolveUpdateAvailability(update);
const updateLine = formatUpdateOneLiner(update).replace(/^Update:\s*/i, "");
const channelLabel = formatUpdateChannelLabel({
channel: channelInfo.channel,
source: channelInfo.source,
gitTag: update.git?.tag ?? null,
gitBranch: update.git?.branch ?? null,
});
const channelLabel = channelInfo.label;
const gitLabel = formatGitInstallLabel(update);
const overviewRows = [