fix(cli): reduce plugin hook fallback noise (#100554)

* fix(cli): reduce plugin hook fallback noise

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>

* docs(changelog): defer plugin diagnostic note

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
Peter Steinberger
2026-07-06 05:26:37 +01:00
committed by GitHub
parent e9a5dc9bf6
commit a0e591c863
6 changed files with 97 additions and 19 deletions

View File

@@ -2,6 +2,7 @@
import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";
import { theme } from "../../packages/terminal-core/src/theme.js";
import type { OpenClawConfig } from "../config/types.openclaw.js";
import { HOOK_INSTALL_ERROR_CODE } from "../hooks/install.js";
import type { PluginKind } from "../plugins/plugin-kind.types.js";
import { loadPluginMetadataSnapshot } from "../plugins/plugin-metadata-snapshot.js";
import { applyExclusiveSlotSelection } from "../plugins/slots.js";
@@ -169,10 +170,10 @@ export function enableInternalHookEntries(
export function formatPluginInstallWithHookFallbackError(
pluginError: string,
hookError: string,
hookFallback: { error: string; code?: string },
): string {
const formattedPluginError = formatPluginInstallAttemptError(pluginError);
const formattedHookError = formatPluginInstallAttemptError(hookError);
const formattedHookError = formatPluginInstallAttemptError(hookFallback.error);
if (/plugin already exists: .+ \(delete it first\)/.test(pluginError)) {
return `${formattedPluginError}\nUse \`openclaw plugins update <id-or-npm-spec>\` to upgrade the tracked plugin, or rerun install with \`--force\` to replace it.`;
}
@@ -182,6 +183,9 @@ export function formatPluginInstallWithHookFallbackError(
) {
return formattedPluginError;
}
if (hookFallback.code === HOOK_INSTALL_ERROR_CODE.MISSING_OPENCLAW_HOOKS) {
return formattedPluginError;
}
return `${formattedPluginError}\nAlso not a valid hook pack: ${formattedHookError}`;
}