openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
34 lines (33 loc) • 1.48 kB
JavaScript
import { n as isTruthyEnvValue } from "./env-DpEiW8Oq.js";
import { t as resolveCliCommandPathPolicy } from "./command-path-policy-Cc8RHm5e.js";
//#region src/cli/command-startup-policy.ts
function shouldBypassConfigGuardForCommandPath(commandPath) {
return resolveCliCommandPathPolicy(commandPath).bypassConfigGuard;
}
function shouldLoadPlugins(params) {
const loadPlugins = params.loadPlugins;
if (typeof loadPlugins === "function") return loadPlugins({
argv: params.argv ?? [],
commandPath: params.commandPath,
jsonOutputMode: params.jsonOutputMode
});
return loadPlugins === "always" || loadPlugins === "text-only" && !params.jsonOutputMode;
}
function resolveCliStartupPolicy(params) {
const suppressDoctorStdout = params.jsonOutputMode;
const commandPolicy = resolveCliCommandPathPolicy(params.commandPath);
return {
suppressDoctorStdout,
hideBanner: isTruthyEnvValue((params.env ?? process.env).OPENCLAW_HIDE_BANNER) || commandPolicy.hideBanner,
skipConfigGuard: params.routeMode ? commandPolicy.routeConfigGuard === "always" || commandPolicy.routeConfigGuard === "when-suppressed" && suppressDoctorStdout : false,
loadPlugins: shouldLoadPlugins({
argv: params.argv,
commandPath: params.commandPath,
jsonOutputMode: params.jsonOutputMode,
loadPlugins: commandPolicy.loadPlugins
}),
pluginRegistry: commandPolicy.pluginRegistry
};
}
//#endregion
export { shouldBypassConfigGuardForCommandPath as n, resolveCliStartupPolicy as t };