fix(update): reject openclaw source package targets

This commit is contained in:
Vincent Koc
2026-05-22 07:20:49 +08:00
parent fad1c8a071
commit 15a0156a8c
19 changed files with 254 additions and 36 deletions

View File

@@ -69,6 +69,7 @@ import {
createGlobalInstallEnv,
cleanupGlobalRenameDirs,
globalInstallArgs,
isOpenClawSourcePackageInstallSpec,
resolveGlobalInstallTarget,
resolveGlobalInstallSpec,
resolvePnpmGlobalDirFromGlobalRoot,
@@ -976,6 +977,14 @@ async function resolvePackageRuntimePreflightError(params: {
].join("\n");
}
function formatUnsupportedOpenClawSourcePackageTargetMessage(target: string): string {
return [
`Unsupported package update target: ${target}.`,
"OpenClaw package updates use published npm artifacts or built tarballs; npm GitHub source installs for openclaw/openclaw do not reliably produce an installable package.",
"Use `openclaw update --channel dev` for the moving main checkout, or target `latest`, `beta`, an exact version, or a built `.tgz` package spec.",
].join("\n");
}
async function resolvePackageRuntimeForPreflight(params: {
nodeRunner?: string;
timeoutMs?: number;
@@ -3080,6 +3089,11 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
tag,
env: process.env,
});
if (isOpenClawSourcePackageInstallSpec(packageInstallSpec)) {
defaultRuntime.error(formatUnsupportedOpenClawSourcePackageTargetMessage(packageInstallSpec));
defaultRuntime.exit(1);
return;
}
}
if (opts.dryRun) {