refactor: dedupe config cli command trimmed readers

This commit is contained in:
Peter Steinberger
2026-04-08 00:47:02 +01:00
parent 3ff56020b1
commit 63e00b811e
43 changed files with 216 additions and 151 deletions
+4 -1
View File
@@ -1,6 +1,7 @@
import type { Command } from "commander";
import { loadNodeHostConfig } from "../../node-host/config.js";
import { runNodeHost } from "../../node-host/runner.js";
import { normalizeOptionalString } from "../../shared/string-coerce.js";
import { formatDocsLink } from "../../terminal/links.js";
import { theme } from "../../terminal/theme.js";
import { parsePort } from "../daemon-cli/shared.js";
@@ -48,7 +49,9 @@ export function registerNodeCli(program: Command) {
.action(async (opts) => {
const existing = await loadNodeHostConfig();
const host =
(opts.host as string | undefined)?.trim() || existing?.gateway?.host || "127.0.0.1";
normalizeOptionalString(opts.host as string | undefined) ||
existing?.gateway?.host ||
"127.0.0.1";
const port = parsePortWithFallback(opts.port, existing?.gateway?.port ?? 18789);
await runNodeHost({
gatewayHost: host,