Files
openclaw/src/cli/command-execution-startup.ts
Peter Steinberger 250376f885 fix: simplify bundled runtime dependency repair (#75183)
Summary:
- Merged fix: simplify bundled runtime dependency repair after ClawSweeper review.

ClawSweeper fixups:
- Included follow-up commit: fix: verify cached bundled runtime roots
- Included follow-up commit: refactor: simplify plugin runtime startup paths
- Included follow-up commit: refactor: trim plugin startup policy helpers
- Included follow-up commit: refactor: trust package manager runtime deps materialization
- Included follow-up commit: fix: narrow channel runtime deps skip policy
- Included follow-up commit: refactor: defer startup plugin runtime deps
- Ran the ClawSweeper repair loop before final review.

Validation:
- ClawSweeper review passed for head 04dc566534.
- Required merge gates passed before the squash merge.

Prepared head SHA: 04dc566534
Review: https://github.com/openclaw/openclaw/pull/75183#issuecomment-4358383786

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Shakker <shakkerdroid@gmail.com>
Co-authored-by: clawsweeper-repair <clawsweeper-repair@users.noreply.github.com>
2026-05-01 07:49:02 +00:00

69 lines
2.1 KiB
TypeScript

import { routeLogsToStderr } from "../logging/console.js";
import type { RuntimeEnv } from "../runtime.js";
import { resolveCliArgvInvocation } from "./argv-invocation.js";
import { ensureCliCommandBootstrap } from "./command-bootstrap.js";
import { resolveCliStartupPolicy } from "./command-startup-policy.js";
type CliStartupPolicy = ReturnType<typeof resolveCliStartupPolicy>;
export function resolveCliExecutionStartupContext(params: {
argv: string[];
jsonOutputMode: boolean;
env?: NodeJS.ProcessEnv;
routeMode?: boolean;
}) {
const invocation = resolveCliArgvInvocation(params.argv);
const { commandPath } = invocation;
return {
invocation,
commandPath,
startupPolicy: resolveCliStartupPolicy({
argv: params.argv,
commandPath,
jsonOutputMode: params.jsonOutputMode,
env: params.env,
routeMode: params.routeMode,
}),
};
}
export async function applyCliExecutionStartupPresentation(params: {
argv?: string[];
routeLogsToStderrOnSuppress?: boolean;
startupPolicy: CliStartupPolicy;
showBanner?: boolean;
version?: string;
}) {
if (params.startupPolicy.suppressDoctorStdout && params.routeLogsToStderrOnSuppress !== false) {
routeLogsToStderr();
}
if (params.startupPolicy.hideBanner || params.showBanner === false || !params.version) {
return;
}
const { emitCliBanner } = await import("./banner.js");
if (params.argv) {
emitCliBanner(params.version, { argv: params.argv });
return;
}
emitCliBanner(params.version);
}
export async function ensureCliExecutionBootstrap(params: {
runtime: RuntimeEnv;
commandPath: string[];
startupPolicy: CliStartupPolicy;
allowInvalid?: boolean;
loadPlugins?: boolean;
skipConfigGuard?: boolean;
}) {
await ensureCliCommandBootstrap({
runtime: params.runtime,
commandPath: params.commandPath,
suppressDoctorStdout: params.startupPolicy.suppressDoctorStdout,
allowInvalid: params.allowInvalid,
loadPlugins: params.loadPlugins ?? params.startupPolicy.loadPlugins,
pluginRegistry: params.startupPolicy.pluginRegistry,
skipConfigGuard: params.skipConfigGuard ?? params.startupPolicy.skipConfigGuard,
});
}