fix: quiet update banner and skip duplicate plugin CLI

This commit is contained in:
Peter Steinberger
2026-01-21 07:36:39 +00:00
parent bc8a59faa4
commit fe860de148
4 changed files with 70 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import { emitCliBanner } from "../banner.js";
import { getCommandPath, getVerboseFlag, hasHelpOrVersion } from "../argv.js";
import { ensureConfigReady } from "./config-guard.js";
import { ensurePluginRegistryLoaded } from "../plugin-registry.js";
import { isTruthyEnvValue } from "../../infra/env.js";
import { setVerbose } from "../../globals.js";
function setProcessTitleForCommand(actionCommand: Command) {
@@ -22,15 +23,21 @@ const PLUGIN_REQUIRED_COMMANDS = new Set(["message", "channels", "directory"]);
export function registerPreActionHooks(program: Command, programVersion: string) {
program.hook("preAction", async (_thisCommand, actionCommand) => {
setProcessTitleForCommand(actionCommand);
emitCliBanner(programVersion);
const argv = process.argv;
if (hasHelpOrVersion(argv)) return;
const commandPath = getCommandPath(argv, 2);
const hideBanner =
isTruthyEnvValue(process.env.CLAWDBOT_HIDE_BANNER) ||
commandPath[0] === "update" ||
(commandPath[0] === "plugins" && commandPath[1] === "update");
if (!hideBanner) {
emitCliBanner(programVersion);
}
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 });
// Load plugins for commands that need channel access

View File

@@ -19,7 +19,6 @@ import {
type UpdateStepInfo,
type UpdateStepResult,
type UpdateStepProgress,
type UpdateStepResult,
} from "../infra/update-runner.js";
import {
detectGlobalInstallManagerByPresence,