fix: CLI harden update restart imports and fix nested bundle version resolution

This commit is contained in:
Gustavo Madeira Santana
2026-02-06 00:09:48 -05:00
parent 8a352c8f9d
commit 4a59b7786b
3 changed files with 134 additions and 20 deletions

View File

@@ -8,6 +8,7 @@ import {
checkShellCompletionStatus,
ensureCompletionCacheExists,
} from "../commands/doctor-completion.js";
import { doctorCommand } from "../commands/doctor.js";
import {
formatUpdateAvailableHint,
formatUpdateOneLiner,
@@ -56,6 +57,7 @@ import { theme } from "../terminal/theme.js";
import { replaceCliName, resolveCliName } from "./cli-name.js";
import { formatCliCommand } from "./command-format.js";
import { installCompletion } from "./completion-cli.js";
import { runDaemonRestart } from "./daemon-cli.js";
import { formatHelpExamples } from "./help-format.js";
export type UpdateCommandOptions = {
@@ -1064,14 +1066,12 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
defaultRuntime.log(theme.heading("Restarting service..."));
}
try {
const { runDaemonRestart } = await import("./daemon-cli.js");
const restarted = await runDaemonRestart();
if (!opts.json && restarted) {
defaultRuntime.log(theme.success("Daemon restarted successfully."));
defaultRuntime.log("");
process.env.OPENCLAW_UPDATE_IN_PROGRESS = "1";
try {
const { doctorCommand } = await import("../commands/doctor.js");
const interactiveDoctor = Boolean(process.stdin.isTTY) && !opts.json && opts.yes !== true;
await doctorCommand(defaultRuntime, {
nonInteractive: !interactiveDoctor,