refactor!: remove moltbot state-dir migration fallback

This commit is contained in:
Peter Steinberger
2026-03-22 22:19:35 -07:00
parent 6b9915a106
commit c5a941a506
4 changed files with 5 additions and 13 deletions

View File

@@ -26,7 +26,6 @@ async function maybeMigrateLegacyConfig(): Promise<string[]> {
const legacyCandidates = [
path.join(home, ".clawdbot", "clawdbot.json"),
path.join(home, ".moldbot", "moldbot.json"),
path.join(home, ".moltbot", "moltbot.json"),
];
let legacyPath: string | null = null;

View File

@@ -80,19 +80,12 @@ describe("state + config path candidates", () => {
path.join(resolvedHome, ".openclaw", "openclaw.json"),
path.join(resolvedHome, ".openclaw", "clawdbot.json"),
path.join(resolvedHome, ".openclaw", "moldbot.json"),
path.join(resolvedHome, ".openclaw", "moltbot.json"),
path.join(resolvedHome, ".clawdbot", "openclaw.json"),
path.join(resolvedHome, ".clawdbot", "clawdbot.json"),
path.join(resolvedHome, ".clawdbot", "moldbot.json"),
path.join(resolvedHome, ".clawdbot", "moltbot.json"),
path.join(resolvedHome, ".moldbot", "openclaw.json"),
path.join(resolvedHome, ".moldbot", "clawdbot.json"),
path.join(resolvedHome, ".moldbot", "moldbot.json"),
path.join(resolvedHome, ".moldbot", "moltbot.json"),
path.join(resolvedHome, ".moltbot", "openclaw.json"),
path.join(resolvedHome, ".moltbot", "clawdbot.json"),
path.join(resolvedHome, ".moltbot", "moldbot.json"),
path.join(resolvedHome, ".moltbot", "moltbot.json"),
];
expect(candidates).toEqual(expected);
});

View File

@@ -18,10 +18,10 @@ export function resolveIsNixMode(env: NodeJS.ProcessEnv = process.env): boolean
export const isNixMode = resolveIsNixMode();
// Support historical (and occasionally misspelled) legacy state dirs.
const LEGACY_STATE_DIRNAMES = [".clawdbot", ".moldbot", ".moltbot"] as const;
const LEGACY_STATE_DIRNAMES = [".clawdbot", ".moldbot"] as const;
const NEW_STATE_DIRNAME = ".openclaw";
const CONFIG_FILENAME = "openclaw.json";
const LEGACY_CONFIG_FILENAMES = ["clawdbot.json", "moldbot.json", "moltbot.json"] as const;
const LEGACY_CONFIG_FILENAMES = ["clawdbot.json", "moldbot.json"] as const;
function resolveDefaultHomeDir(): string {
return resolveRequiredHomeDir(process.env, os.homedir);

View File

@@ -25,10 +25,10 @@ afterEach(async () => {
});
describe("legacy state dir auto-migration", () => {
it("follows legacy symlink when it points at another legacy dir (clawdbot -> moltbot)", async () => {
it("follows legacy symlink when it points at another legacy dir (clawdbot -> moldbot)", async () => {
const root = await makeTempRoot();
const legacySymlink = path.join(root, ".clawdbot");
const legacyDir = path.join(root, ".moltbot");
const legacyDir = path.join(root, ".moldbot");
fs.mkdirSync(legacyDir, { recursive: true });
fs.writeFileSync(path.join(legacyDir, "marker.txt"), "ok", "utf-8");
@@ -46,7 +46,7 @@ describe("legacy state dir auto-migration", () => {
const targetMarker = path.join(root, ".openclaw", "marker.txt");
expect(fs.readFileSync(targetMarker, "utf-8")).toBe("ok");
expect(fs.readFileSync(path.join(root, ".moltbot", "marker.txt"), "utf-8")).toBe("ok");
expect(fs.readFileSync(path.join(root, ".moldbot", "marker.txt"), "utf-8")).toBe("ok");
expect(fs.readFileSync(path.join(root, ".clawdbot", "marker.txt"), "utf-8")).toBe("ok");
});