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

@@ -4,11 +4,11 @@ import path from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import { resolveTelegramToken } from "./token.js";
function withTempDir(): string {
return fs.mkdtempSync(path.join(os.tmpdir(), "clawdbot-telegram-token-"));
return fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-telegram-token-"));
}
describe("resolveTelegramToken", () => {
@@ -20,7 +20,7 @@ describe("resolveTelegramToken", () => {
vi.stubEnv("TELEGRAM_BOT_TOKEN", "env-token");
const cfg = {
channels: { telegram: { botToken: "cfg-token" } },
} as ClawdbotConfig;
} as MoltbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("cfg-token");
expect(res.source).toBe("config");
@@ -30,7 +30,7 @@ describe("resolveTelegramToken", () => {
vi.stubEnv("TELEGRAM_BOT_TOKEN", "env-token");
const cfg = {
channels: { telegram: {} },
} as ClawdbotConfig;
} as MoltbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("env-token");
expect(res.source).toBe("env");
@@ -41,7 +41,7 @@ describe("resolveTelegramToken", () => {
const dir = withTempDir();
const tokenFile = path.join(dir, "token.txt");
fs.writeFileSync(tokenFile, "file-token\n", "utf-8");
const cfg = { channels: { telegram: { tokenFile } } } as ClawdbotConfig;
const cfg = { channels: { telegram: { tokenFile } } } as MoltbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("file-token");
expect(res.source).toBe("tokenFile");
@@ -52,7 +52,7 @@ describe("resolveTelegramToken", () => {
vi.stubEnv("TELEGRAM_BOT_TOKEN", "");
const cfg = {
channels: { telegram: { botToken: "cfg-token" } },
} as ClawdbotConfig;
} as MoltbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("cfg-token");
expect(res.source).toBe("config");
@@ -64,7 +64,7 @@ describe("resolveTelegramToken", () => {
const tokenFile = path.join(dir, "missing-token.txt");
const cfg = {
channels: { telegram: { tokenFile, botToken: "cfg-token" } },
} as ClawdbotConfig;
} as MoltbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("");
expect(res.source).toBe("none");