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 type { SlackAccountConfig } from "../config/types.js";
import { normalizeChatType } from "../channels/chat-type.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js";
@@ -28,26 +28,26 @@ export type ResolvedSlackAccount = {
channels?: SlackAccountConfig["channels"];
};
function listConfiguredAccountIds(cfg: ClawdbotConfig): string[] {
function listConfiguredAccountIds(cfg: MoltbotConfig): string[] {
const accounts = cfg.channels?.slack?.accounts;
if (!accounts || typeof accounts !== "object") return [];
return Object.keys(accounts).filter(Boolean);
}
export function listSlackAccountIds(cfg: ClawdbotConfig): string[] {
export function listSlackAccountIds(cfg: MoltbotConfig): string[] {
const ids = listConfiguredAccountIds(cfg);
if (ids.length === 0) return [DEFAULT_ACCOUNT_ID];
return ids.sort((a, b) => a.localeCompare(b));
}
export function resolveDefaultSlackAccountId(cfg: ClawdbotConfig): string {
export function resolveDefaultSlackAccountId(cfg: MoltbotConfig): string {
const ids = listSlackAccountIds(cfg);
if (ids.includes(DEFAULT_ACCOUNT_ID)) return DEFAULT_ACCOUNT_ID;
return ids[0] ?? DEFAULT_ACCOUNT_ID;
}
function resolveAccountConfig(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
accountId: string,
): SlackAccountConfig | undefined {
const accounts = cfg.channels?.slack?.accounts;
@@ -55,7 +55,7 @@ function resolveAccountConfig(
return accounts[accountId] as SlackAccountConfig | undefined;
}
function mergeSlackAccountConfig(cfg: ClawdbotConfig, accountId: string): SlackAccountConfig {
function mergeSlackAccountConfig(cfg: MoltbotConfig, accountId: string): SlackAccountConfig {
const { accounts: _ignored, ...base } = (cfg.channels?.slack ?? {}) as SlackAccountConfig & {
accounts?: unknown;
};
@@ -64,7 +64,7 @@ function mergeSlackAccountConfig(cfg: ClawdbotConfig, accountId: string): SlackA
}
export function resolveSlackAccount(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
}): ResolvedSlackAccount {
const accountId = normalizeAccountId(params.accountId);
@@ -105,7 +105,7 @@ export function resolveSlackAccount(params: {
};
}
export function listEnabledSlackAccounts(cfg: ClawdbotConfig): ResolvedSlackAccount[] {
export function listEnabledSlackAccounts(cfg: MoltbotConfig): ResolvedSlackAccount[] {
return listSlackAccountIds(cfg)
.map((accountId) => resolveSlackAccount({ cfg, accountId }))
.filter((account) => account.enabled);