openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
29 lines (28 loc) • 1 kB
JavaScript
import { k as applyLegacyDoctorMigrations } from "./io.runtime-B9iJRs3w.js";
import { h as validateConfigObjectWithPlugins } from "./io.types-BUCjdS5v.js";
//#region src/commands/doctor/shared/legacy-config-migrate.ts
/** Apply legacy migrations and validate the resulting OpenClaw config shape when possible. */
function migrateLegacyConfig(raw, context) {
const { next, changes } = applyLegacyDoctorMigrations(raw, context);
if (!next) return {
config: null,
changes: []
};
const resolvedCandidate = context ? applyLegacyDoctorMigrations(context.resolvedRaw, context).next ?? context.resolvedRaw : next;
const validated = validateConfigObjectWithPlugins(resolvedCandidate);
if (!validated.ok) {
changes.push("Migration applied; other validation issues remain — run doctor to review.");
return {
config: next,
changes,
partiallyValid: true
};
}
return {
config: validated.config,
sourceConfig: next,
changes
};
}
//#endregion
export { migrateLegacyConfig as t };