From eb1e2c7a3b0be4dad000547f4e0c365dfbb2cf06 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 21 Jan 2026 03:46:11 +0000 Subject: [PATCH] fix: suppress node warnings unless verbose --- src/cli/program/command-registry.ts | 4 ---- src/cli/program/preaction.ts | 8 +++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cli/program/command-registry.ts b/src/cli/program/command-registry.ts index 7c538362e..122cacdb6 100644 --- a/src/cli/program/command-registry.ts +++ b/src/cli/program/command-registry.ts @@ -4,7 +4,6 @@ import { agentsListCommand } from "../../commands/agents.js"; import { healthCommand } from "../../commands/health.js"; import { sessionsCommand } from "../../commands/sessions.js"; import { statusCommand } from "../../commands/status.js"; -import { setVerbose } from "../../globals.js"; import { defaultRuntime } from "../../runtime.js"; import { getFlagValue, getPositiveIntFlagValue, getVerboseFlag, hasFlag } from "../argv.js"; import { registerBrowserCli } from "../browser-cli.js"; @@ -46,7 +45,6 @@ const routeHealth: RouteSpec = { const verbose = getVerboseFlag(argv, { includeDebug: true }); const timeoutMs = getPositiveIntFlagValue(argv, "--timeout"); if (timeoutMs === null) return false; - setVerbose(verbose); await healthCommand({ json, timeoutMs, verbose }, defaultRuntime); return true; }, @@ -63,7 +61,6 @@ const routeStatus: RouteSpec = { const verbose = getVerboseFlag(argv, { includeDebug: true }); const timeoutMs = getPositiveIntFlagValue(argv, "--timeout"); if (timeoutMs === null) return false; - setVerbose(verbose); await statusCommand({ json, deep, all, usage, timeoutMs, verbose }, defaultRuntime); return true; }, @@ -78,7 +75,6 @@ const routeSessions: RouteSpec = { if (store === null) return false; const active = getFlagValue(argv, "--active"); if (active === null) return false; - setVerbose(verbose); await sessionsCommand({ json, store, active }, defaultRuntime); return true; }, diff --git a/src/cli/program/preaction.ts b/src/cli/program/preaction.ts index 6ebf7c880..021e9ea72 100644 --- a/src/cli/program/preaction.ts +++ b/src/cli/program/preaction.ts @@ -1,9 +1,10 @@ import type { Command } from "commander"; import { defaultRuntime } from "../../runtime.js"; import { emitCliBanner } from "../banner.js"; -import { getCommandPath, hasHelpOrVersion } from "../argv.js"; +import { getCommandPath, getVerboseFlag, hasHelpOrVersion } from "../argv.js"; import { ensureConfigReady } from "./config-guard.js"; import { ensurePluginRegistryLoaded } from "../plugin-registry.js"; +import { setVerbose } from "../../globals.js"; function setProcessTitleForCommand(actionCommand: Command) { let current: Command = actionCommand; @@ -24,6 +25,11 @@ export function registerPreActionHooks(program: Command, programVersion: string) emitCliBanner(programVersion); const argv = process.argv; if (hasHelpOrVersion(argv)) return; + const verbose = getVerboseFlag(argv, { includeDebug: true }); + setVerbose(verbose); + if (!verbose) { + process.env.NODE_NO_WARNINGS ??= "1"; + } const commandPath = getCommandPath(argv, 2); if (commandPath[0] === "doctor") return; await ensureConfigReady({ runtime: defaultRuntime, commandPath });