mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 06:40:24 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -7,7 +7,7 @@ import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
function makeTempDir() {
|
||||
const dir = path.join(os.tmpdir(), `clawdbot-plugins-${randomUUID()}`);
|
||||
const dir = path.join(os.tmpdir(), `moltbot-plugins-${randomUUID()}`);
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
tempDirs.push(dir);
|
||||
return dir;
|
||||
@@ -46,7 +46,7 @@ afterEach(() => {
|
||||
}
|
||||
});
|
||||
|
||||
describe("discoverClawdbotPlugins", () => {
|
||||
describe("discoverMoltbotPlugins", () => {
|
||||
it("discovers global and workspace extensions", async () => {
|
||||
const stateDir = makeTempDir();
|
||||
const workspaceDir = path.join(stateDir, "workspace");
|
||||
@@ -60,8 +60,8 @@ describe("discoverClawdbotPlugins", () => {
|
||||
fs.writeFileSync(path.join(workspaceExt, "beta.ts"), "export default function () {}", "utf-8");
|
||||
|
||||
const { candidates } = await withStateDir(stateDir, async () => {
|
||||
const { discoverClawdbotPlugins } = await import("./discovery.js");
|
||||
return discoverClawdbotPlugins({ workspaceDir });
|
||||
const { discoverMoltbotPlugins } = await import("./discovery.js");
|
||||
return discoverMoltbotPlugins({ workspaceDir });
|
||||
});
|
||||
|
||||
const ids = candidates.map((c) => c.idHint);
|
||||
@@ -78,7 +78,7 @@ describe("discoverClawdbotPlugins", () => {
|
||||
path.join(globalExt, "package.json"),
|
||||
JSON.stringify({
|
||||
name: "pack",
|
||||
clawdbot: { extensions: ["./src/one.ts", "./src/two.ts"] },
|
||||
moltbot: { extensions: ["./src/one.ts", "./src/two.ts"] },
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
@@ -94,8 +94,8 @@ describe("discoverClawdbotPlugins", () => {
|
||||
);
|
||||
|
||||
const { candidates } = await withStateDir(stateDir, async () => {
|
||||
const { discoverClawdbotPlugins } = await import("./discovery.js");
|
||||
return discoverClawdbotPlugins({});
|
||||
const { discoverMoltbotPlugins } = await import("./discovery.js");
|
||||
return discoverMoltbotPlugins({});
|
||||
});
|
||||
|
||||
const ids = candidates.map((c) => c.idHint);
|
||||
@@ -111,8 +111,8 @@ describe("discoverClawdbotPlugins", () => {
|
||||
fs.writeFileSync(
|
||||
path.join(globalExt, "package.json"),
|
||||
JSON.stringify({
|
||||
name: "@clawdbot/voice-call",
|
||||
clawdbot: { extensions: ["./src/index.ts"] },
|
||||
name: "@moltbot/voice-call",
|
||||
moltbot: { extensions: ["./src/index.ts"] },
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
@@ -123,8 +123,8 @@ describe("discoverClawdbotPlugins", () => {
|
||||
);
|
||||
|
||||
const { candidates } = await withStateDir(stateDir, async () => {
|
||||
const { discoverClawdbotPlugins } = await import("./discovery.js");
|
||||
return discoverClawdbotPlugins({});
|
||||
const { discoverMoltbotPlugins } = await import("./discovery.js");
|
||||
return discoverMoltbotPlugins({});
|
||||
});
|
||||
|
||||
const ids = candidates.map((c) => c.idHint);
|
||||
@@ -139,16 +139,16 @@ describe("discoverClawdbotPlugins", () => {
|
||||
fs.writeFileSync(
|
||||
path.join(packDir, "package.json"),
|
||||
JSON.stringify({
|
||||
name: "@clawdbot/demo-plugin-dir",
|
||||
clawdbot: { extensions: ["./index.js"] },
|
||||
name: "@moltbot/demo-plugin-dir",
|
||||
moltbot: { extensions: ["./index.js"] },
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
fs.writeFileSync(path.join(packDir, "index.js"), "module.exports = {}", "utf-8");
|
||||
|
||||
const { candidates } = await withStateDir(stateDir, async () => {
|
||||
const { discoverClawdbotPlugins } = await import("./discovery.js");
|
||||
return discoverClawdbotPlugins({ extraPaths: [packDir] });
|
||||
const { discoverMoltbotPlugins } = await import("./discovery.js");
|
||||
return discoverMoltbotPlugins({ extraPaths: [packDir] });
|
||||
});
|
||||
|
||||
const ids = candidates.map((c) => c.idHint);
|
||||
|
||||
Reference in New Issue
Block a user