refactor(commands): share daemon runtime warning helper

This commit is contained in:
Peter Steinberger
2026-02-18 23:08:40 +00:00
parent 3ce615ff06
commit c0c10f42e2
4 changed files with 117 additions and 30 deletions

View File

@@ -0,0 +1,20 @@
import { renderSystemNodeWarning, resolveSystemNodeInfo } from "../daemon/runtime-paths.js";
export type DaemonInstallWarnFn = (message: string, title?: string) => void;
export async function emitNodeRuntimeWarning(params: {
env: Record<string, string | undefined>;
runtime: string;
nodeProgram?: string;
warn?: DaemonInstallWarnFn;
title: string;
}): Promise<void> {
if (params.runtime !== "node") {
return;
}
const systemNode = await resolveSystemNodeInfo({ env: params.env });
const warning = renderSystemNodeWarning(systemNode, params.nodeProgram);
if (warning) {
params.warn?.(warning, params.title);
}
}