import { formatCliCommand } from "../cli/command-format.js"; import { isTruthyEnvValue } from "../infra/env.js"; import { runGatewayUpdate } from "../infra/update-runner.js"; import { runCommandWithTimeout } from "../process/exec.js"; import type { RuntimeEnv } from "../runtime.js"; import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js"; import { note } from "../terminal/note.js"; import type { DoctorOptions } from "./doctor-prompter.js";
async function detectOpenClawGitCheckout(root: string): Promise<"git" | "not-git" | "unknown"> { const res = await runCommandWithTimeout(["git", "-C", root, "rev-parse", "--show-toplevel"], {
timeoutMs: 5000,
}).catch(() => null); if (!res) { return"unknown";
} if (res.code !== 0) { // Avoid noisy "Update via package manager" notes when git is missing/broken, // but do show it when this is clearly not a git checkout. if (normalizeLowercaseStringOrEmpty(res.stderr).includes("not a git repository")) { return"not-git";
} return"unknown";
} return res.stdout.trim() === root ? "git" : "not-git";
}
const git = await detectOpenClawGitCheckout(params.root); if (git === "git") { const shouldUpdate = await params.confirm({
message: "Update OpenClaw from git before running doctor?",
initialValue: true,
}); if (!shouldUpdate) { return { updated: false };
}
note("Running update (fetch/rebase/build/ui:build/doctor)…", "Update"); const result = await runGatewayUpdate({
cwd: params.root,
argv1: process.argv[1],
});
note(
[
`Status: ${result.status}`,
`Mode: ${result.mode}`,
result.root ? `Root: ${result.root}` : null,
result.reason ? `Reason: ${result.reason}` : null,
]
.filter(Boolean)
.join("\n"), "Update result",
); if (result.status === "ok") {
params.outro("Update completed (doctor already ran as part of the update)."); return { updated: true, handled: true };
} return { updated: true, handled: false };
}
if (git === "not-git") {
note(
[ "This install is not a git checkout.",
`Run \`${formatCliCommand("openclaw update")}\` to update via your package manager (npm/pnpm), then rerun doctor.`,
].join("\n"), "Update",
);
}
return { updated: false };
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-05)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.