refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -95,10 +95,10 @@ const spawnGatewayInstance = async (name: string): Promise<GatewayInstance> => {
|
||||
const port = await getFreePort();
|
||||
const hookToken = `token-${name}-${randomUUID()}`;
|
||||
const gatewayToken = `gateway-${name}-${randomUUID()}`;
|
||||
const homeDir = await fs.mkdtemp(path.join(os.tmpdir(), `clawdbot-e2e-${name}-`));
|
||||
const homeDir = await fs.mkdtemp(path.join(os.tmpdir(), `moltbot-e2e-${name}-`));
|
||||
const configDir = path.join(homeDir, ".clawdbot");
|
||||
await fs.mkdir(configDir, { recursive: true });
|
||||
const configPath = path.join(configDir, "clawdbot.json");
|
||||
const configPath = path.join(configDir, "moltbot.json");
|
||||
const stateDir = path.join(configDir, "state");
|
||||
const config = {
|
||||
gateway: { port, auth: { mode: "token", token: gatewayToken } },
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function withTempHome<T>(
|
||||
fn: (home: string) => Promise<T>,
|
||||
opts: { env?: Record<string, EnvValue>; prefix?: string } = {},
|
||||
): Promise<T> {
|
||||
const base = await fs.mkdtemp(path.join(os.tmpdir(), opts.prefix ?? "clawdbot-test-home-"));
|
||||
const base = await fs.mkdtemp(path.join(os.tmpdir(), opts.prefix ?? "moltbot-test-home-"));
|
||||
const snapshot = snapshotEnv();
|
||||
const envKeys = Object.keys(opts.env ?? {});
|
||||
for (const key of envKeys) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from "node:path";
|
||||
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { ClawdbotConfig } from "../src/config/config.js";
|
||||
import type { MoltbotConfig } from "../src/config/config.js";
|
||||
import type { MsgContext } from "../src/auto-reply/templating.js";
|
||||
|
||||
const makeTempDir = async (prefix: string) => await fs.mkdtemp(path.join(os.tmpdir(), prefix));
|
||||
@@ -16,7 +16,7 @@ const writeExecutable = async (dir: string, name: string, content: string) => {
|
||||
};
|
||||
|
||||
const makeTempMedia = async (ext: string) => {
|
||||
const dir = await makeTempDir("clawdbot-media-e2e-");
|
||||
const dir = await makeTempDir("moltbot-media-e2e-");
|
||||
const filePath = path.join(dir, `sample${ext}`);
|
||||
await fs.writeFile(filePath, "audio");
|
||||
return { dir, filePath };
|
||||
@@ -52,8 +52,8 @@ describe("media understanding auto-detect (e2e)", () => {
|
||||
it("uses sherpa-onnx-offline when available", async () => {
|
||||
const snapshot = envSnapshot();
|
||||
try {
|
||||
const binDir = await makeTempDir("clawdbot-bin-sherpa-");
|
||||
const modelDir = await makeTempDir("clawdbot-sherpa-model-");
|
||||
const binDir = await makeTempDir("moltbot-bin-sherpa-");
|
||||
const modelDir = await makeTempDir("moltbot-sherpa-model-");
|
||||
tempPaths.push(binDir, modelDir);
|
||||
|
||||
await fs.writeFile(path.join(modelDir, "tokens.txt"), "a");
|
||||
@@ -79,7 +79,7 @@ describe("media understanding auto-detect (e2e)", () => {
|
||||
MediaPath: filePath,
|
||||
MediaType: "audio/wav",
|
||||
};
|
||||
const cfg: ClawdbotConfig = { tools: { media: { audio: {} } } };
|
||||
const cfg: MoltbotConfig = { tools: { media: { audio: {} } } };
|
||||
|
||||
await applyMediaUnderstanding({ ctx, cfg });
|
||||
|
||||
@@ -92,8 +92,8 @@ describe("media understanding auto-detect (e2e)", () => {
|
||||
it("uses whisper-cli when sherpa is missing", async () => {
|
||||
const snapshot = envSnapshot();
|
||||
try {
|
||||
const binDir = await makeTempDir("clawdbot-bin-whispercpp-");
|
||||
const modelDir = await makeTempDir("clawdbot-whispercpp-model-");
|
||||
const binDir = await makeTempDir("moltbot-bin-whispercpp-");
|
||||
const modelDir = await makeTempDir("moltbot-whispercpp-model-");
|
||||
tempPaths.push(binDir, modelDir);
|
||||
|
||||
const modelPath = path.join(modelDir, "tiny.bin");
|
||||
@@ -124,7 +124,7 @@ describe("media understanding auto-detect (e2e)", () => {
|
||||
MediaPath: filePath,
|
||||
MediaType: "audio/wav",
|
||||
};
|
||||
const cfg: ClawdbotConfig = { tools: { media: { audio: {} } } };
|
||||
const cfg: MoltbotConfig = { tools: { media: { audio: {} } } };
|
||||
|
||||
await applyMediaUnderstanding({ ctx, cfg });
|
||||
|
||||
@@ -137,7 +137,7 @@ describe("media understanding auto-detect (e2e)", () => {
|
||||
it("uses gemini CLI for images when available", async () => {
|
||||
const snapshot = envSnapshot();
|
||||
try {
|
||||
const binDir = await makeTempDir("clawdbot-bin-gemini-");
|
||||
const binDir = await makeTempDir("moltbot-bin-gemini-");
|
||||
tempPaths.push(binDir);
|
||||
|
||||
await writeExecutable(
|
||||
@@ -157,7 +157,7 @@ describe("media understanding auto-detect (e2e)", () => {
|
||||
MediaPath: filePath,
|
||||
MediaType: "image/png",
|
||||
};
|
||||
const cfg: ClawdbotConfig = { tools: { media: { image: {} } } };
|
||||
const cfg: MoltbotConfig = { tools: { media: { image: {} } } };
|
||||
|
||||
await applyMediaUnderstanding({ ctx, cfg });
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ describe("provider timeouts (e2e)", () => {
|
||||
};
|
||||
(globalThis as unknown as { fetch: unknown }).fetch = fetchImpl;
|
||||
|
||||
const tempHome = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-timeout-e2e-"));
|
||||
const tempHome = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-timeout-e2e-"));
|
||||
process.env.HOME = tempHome;
|
||||
process.env.CLAWDBOT_SKIP_CHANNELS = "1";
|
||||
process.env.CLAWDBOT_SKIP_GMAIL_WATCHER = "1";
|
||||
@@ -163,7 +163,7 @@ describe("provider timeouts (e2e)", () => {
|
||||
|
||||
const configDir = path.join(tempHome, ".clawdbot");
|
||||
await fs.mkdir(configDir, { recursive: true });
|
||||
const configPath = path.join(configDir, "clawdbot.json");
|
||||
const configPath = path.join(configDir, "moltbot.json");
|
||||
|
||||
const cfg = {
|
||||
agents: {
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
ChannelOutboundAdapter,
|
||||
ChannelPlugin,
|
||||
} from "../src/channels/plugins/types.js";
|
||||
import type { ClawdbotConfig } from "../src/config/config.js";
|
||||
import type { MoltbotConfig } from "../src/config/config.js";
|
||||
import type { OutboundSendDeps } from "../src/infra/outbound/deliver.js";
|
||||
import { installProcessWarningFilter } from "../src/infra/warnings.js";
|
||||
import { setActivePluginRegistry } from "../src/plugins/runtime.js";
|
||||
@@ -80,7 +80,7 @@ const createStubPlugin = (params: {
|
||||
},
|
||||
capabilities: { chatTypes: ["direct", "group"] },
|
||||
config: {
|
||||
listAccountIds: (cfg: ClawdbotConfig) => {
|
||||
listAccountIds: (cfg: MoltbotConfig) => {
|
||||
const channels = cfg.channels as Record<string, unknown> | undefined;
|
||||
const entry = channels?.[params.id];
|
||||
if (!entry || typeof entry !== "object") return [];
|
||||
@@ -88,7 +88,7 @@ const createStubPlugin = (params: {
|
||||
const ids = accounts ? Object.keys(accounts).filter(Boolean) : [];
|
||||
return ids.length > 0 ? ids : ["default"];
|
||||
},
|
||||
resolveAccount: (cfg: ClawdbotConfig, accountId: string) => {
|
||||
resolveAccount: (cfg: MoltbotConfig, accountId: string) => {
|
||||
const channels = cfg.channels as Record<string, unknown> | undefined;
|
||||
const entry = channels?.[params.id];
|
||||
if (!entry || typeof entry !== "object") return {};
|
||||
@@ -96,7 +96,7 @@ const createStubPlugin = (params: {
|
||||
const match = accounts?.[accountId];
|
||||
return (match && typeof match === "object") || typeof match === "string" ? match : entry;
|
||||
},
|
||||
isConfigured: async (_account, cfg: ClawdbotConfig) => {
|
||||
isConfigured: async (_account, cfg: MoltbotConfig) => {
|
||||
const channels = cfg.channels as Record<string, unknown> | undefined;
|
||||
return Boolean(channels?.[params.id]);
|
||||
},
|
||||
|
||||
@@ -80,7 +80,7 @@ export function installTestEnv(): { cleanup: () => void; tempHome: string } {
|
||||
{ key: "NODE_OPTIONS", value: process.env.NODE_OPTIONS },
|
||||
];
|
||||
|
||||
const tempHome = fs.mkdtempSync(path.join(os.tmpdir(), "clawdbot-test-home-"));
|
||||
const tempHome = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-test-home-"));
|
||||
|
||||
process.env.HOME = tempHome;
|
||||
process.env.USERPROFILE = tempHome;
|
||||
|
||||
Reference in New Issue
Block a user