mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 18:01:46 +00:00
fix: harden update dev switch and refresh changelog
This commit is contained in:
@@ -385,10 +385,12 @@ async function runGitUpdate(params: {
|
||||
}): Promise<UpdateRunResult> {
|
||||
const updateRoot = params.switchToGit ? resolveGitInstallDir() : params.root;
|
||||
const effectiveTimeout = params.timeoutMs ?? 20 * 60_000;
|
||||
const installEnv = await createGlobalInstallEnv();
|
||||
|
||||
const cloneStep = params.switchToGit
|
||||
? await ensureGitCheckout({
|
||||
dir: updateRoot,
|
||||
env: installEnv,
|
||||
timeoutMs: effectiveTimeout,
|
||||
progress: params.progress,
|
||||
})
|
||||
@@ -429,7 +431,7 @@ async function runGitUpdate(params: {
|
||||
name: "global install",
|
||||
argv: globalInstallArgs(manager, updateRoot),
|
||||
cwd: updateRoot,
|
||||
env: await createGlobalInstallEnv(),
|
||||
env: installEnv,
|
||||
timeoutMs: effectiveTimeout,
|
||||
progress: params.progress,
|
||||
});
|
||||
@@ -859,20 +861,6 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
if (requestedChannel && configSnapshot.valid) {
|
||||
const next = {
|
||||
...configSnapshot.config,
|
||||
update: {
|
||||
...configSnapshot.config.update,
|
||||
channel: requestedChannel,
|
||||
},
|
||||
};
|
||||
await writeConfigFile(next);
|
||||
if (!opts.json) {
|
||||
defaultRuntime.log(theme.muted(`Update channel set to ${requestedChannel}.`));
|
||||
}
|
||||
}
|
||||
|
||||
const showProgress = !opts.json && process.stdout.isTTY;
|
||||
if (!opts.json) {
|
||||
defaultRuntime.log(theme.heading("Updating OpenClaw..."));
|
||||
@@ -956,10 +944,31 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
let postUpdateConfigSnapshot = configSnapshot;
|
||||
if (requestedChannel && configSnapshot.valid && requestedChannel !== storedChannel) {
|
||||
const next = {
|
||||
...configSnapshot.config,
|
||||
update: {
|
||||
...configSnapshot.config.update,
|
||||
channel: requestedChannel,
|
||||
},
|
||||
};
|
||||
await writeConfigFile(next);
|
||||
postUpdateConfigSnapshot = {
|
||||
...configSnapshot,
|
||||
parsed: next,
|
||||
resolved: next,
|
||||
config: next,
|
||||
};
|
||||
if (!opts.json) {
|
||||
defaultRuntime.log(theme.muted(`Update channel set to ${requestedChannel}.`));
|
||||
}
|
||||
}
|
||||
|
||||
await updatePluginsAfterCoreUpdate({
|
||||
root,
|
||||
channel,
|
||||
configSnapshot,
|
||||
configSnapshot: postUpdateConfigSnapshot,
|
||||
opts,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user