feat(status): improve status output

This commit is contained in:
Peter Steinberger
2026-01-10 23:31:24 +01:00
parent 67b7877bbf
commit 1eb50ffac4
25 changed files with 2382 additions and 40 deletions

31
src/infra/os-summary.ts Normal file
View File

@@ -0,0 +1,31 @@
import { spawnSync } from "node:child_process";
import os from "node:os";
export type OsSummary = {
platform: NodeJS.Platform;
arch: string;
release: string;
label: string;
};
function safeTrim(value: unknown): string {
return typeof value === "string" ? value.trim() : "";
}
function macosVersion(): string {
const res = spawnSync("sw_vers", ["-productVersion"], { encoding: "utf-8" });
const out = safeTrim(res.stdout);
return out || os.release();
}
export function resolveOsSummary(): OsSummary {
const platform = os.platform();
const release = os.release();
const arch = os.arch();
const label = (() => {
if (platform === "darwin") return `macos ${macosVersion()} (${arch})`;
if (platform === "win32") return `windows ${release} (${arch})`;
return `${platform} ${release} (${arch})`;
})();
return { platform, arch, release, label };
}