refactor: rename clawdbot to moltbot with legacy compat

This commit is contained in:
Peter Steinberger
2026-01-27 12:19:58 +00:00
parent 83460df96f
commit 6d16a658e5
1839 changed files with 11250 additions and 11199 deletions

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../routing/session-key.js";
type ChannelSectionBase = {
@@ -6,14 +6,14 @@ type ChannelSectionBase = {
accounts?: Record<string, Record<string, unknown>>;
};
function channelHasAccounts(cfg: ClawdbotConfig, channelKey: string): boolean {
function channelHasAccounts(cfg: MoltbotConfig, channelKey: string): boolean {
const channels = cfg.channels as Record<string, unknown> | undefined;
const base = channels?.[channelKey] as ChannelSectionBase | undefined;
return Boolean(base?.accounts && Object.keys(base.accounts).length > 0);
}
function shouldStoreNameInAccounts(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channelKey: string;
accountId: string;
alwaysUseAccounts?: boolean;
@@ -24,12 +24,12 @@ function shouldStoreNameInAccounts(params: {
}
export function applyAccountNameToChannelSection(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channelKey: string;
accountId: string;
name?: string;
alwaysUseAccounts?: boolean;
}): ClawdbotConfig {
}): MoltbotConfig {
const trimmed = params.name?.trim();
if (!trimmed) return params.cfg;
const accountId = normalizeAccountId(params.accountId);
@@ -54,7 +54,7 @@ export function applyAccountNameToChannelSection(params: {
name: trimmed,
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
const baseAccounts: Record<string, Record<string, unknown>> = base?.accounts ?? {};
const existingAccount = baseAccounts[accountId] ?? {};
@@ -77,14 +77,14 @@ export function applyAccountNameToChannelSection(params: {
},
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
export function migrateBaseNameToDefaultAccount(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channelKey: string;
alwaysUseAccounts?: boolean;
}): ClawdbotConfig {
}): MoltbotConfig {
if (params.alwaysUseAccounts) return params.cfg;
const channels = params.cfg.channels as Record<string, unknown> | undefined;
const base = channels?.[params.channelKey] as ChannelSectionBase | undefined;
@@ -107,5 +107,5 @@ export function migrateBaseNameToDefaultAccount(params: {
accounts,
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}