refactor: rename to openclaw

This commit is contained in:
Peter Steinberger
2026-01-30 03:15:10 +01:00
parent 4583f88626
commit 9a7160786a
2357 changed files with 16688 additions and 16788 deletions

View File

@@ -8,7 +8,7 @@ import {
addSubagentRunForTests,
resetSubagentRegistryForTests,
} from "../../agents/subagent-registry.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import * as internalHooks from "../../hooks/internal-hooks.js";
import { clearPluginCommands, registerPluginCommand } from "../../plugins/commands.js";
import type { MsgContext } from "../templating.js";
@@ -33,7 +33,7 @@ vi.mock("./commands-context-report.js", () => ({
let testWorkspaceDir = os.tmpdir();
beforeAll(async () => {
testWorkspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-commands-"));
testWorkspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-commands-"));
await fs.writeFile(path.join(testWorkspaceDir, "AGENTS.md"), "# Agents\n", "utf-8");
});
@@ -41,7 +41,7 @@ afterAll(async () => {
await fs.rm(testWorkspaceDir, { recursive: true, force: true });
});
function buildParams(commandBody: string, cfg: MoltbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: OpenClawConfig, ctxOverrides?: Partial<MsgContext>) {
const ctx = {
Body: commandBody,
CommandBody: commandBody,
@@ -85,7 +85,7 @@ describe("handleCommands gating", () => {
const cfg = {
commands: { bash: false, text: true },
whatsapp: { allowFrom: ["*"] },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/bash echo hi", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -97,7 +97,7 @@ describe("handleCommands gating", () => {
const cfg = {
commands: { bash: true, text: true },
whatsapp: { allowFrom: ["*"] },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/bash echo hi", cfg);
params.elevated = {
enabled: true,
@@ -113,7 +113,7 @@ describe("handleCommands gating", () => {
const cfg = {
commands: { config: false, debug: false, text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/config show", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -124,7 +124,7 @@ describe("handleCommands gating", () => {
const cfg = {
commands: { config: false, debug: false, text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/debug show", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -138,7 +138,7 @@ describe("handleCommands bash alias", () => {
const cfg = {
commands: { bash: true, text: true },
whatsapp: { allowFrom: ["*"] },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("!poll", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -150,7 +150,7 @@ describe("handleCommands bash alias", () => {
const cfg = {
commands: { bash: true, text: true },
whatsapp: { allowFrom: ["*"] },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("!stop", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -171,7 +171,7 @@ describe("handleCommands plugin commands", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/card", cfg);
const commandResult = await handleCommands(params);
@@ -186,7 +186,7 @@ describe("handleCommands identity", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/whoami", cfg, {
SenderId: "12345",
SenderUsername: "TestUser",
@@ -206,7 +206,7 @@ describe("handleCommands hooks", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/new take notes", cfg);
const spy = vi.spyOn(internalHooks, "triggerInternalHook").mockResolvedValue();
@@ -222,7 +222,7 @@ describe("handleCommands context", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/context", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -234,7 +234,7 @@ describe("handleCommands context", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/context list", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -246,7 +246,7 @@ describe("handleCommands context", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/context detail", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -261,7 +261,7 @@ describe("handleCommands subagents", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents list", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -283,7 +283,7 @@ describe("handleCommands subagents", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents list", cfg, {
CommandSource: "native",
CommandTargetSessionKey: "agent:main:main",
@@ -301,7 +301,7 @@ describe("handleCommands subagents", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
session: { mainKey: "main", scope: "per-sender" },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/status", cfg);
params.resolvedVerboseLevel = "on";
const result = await handleCommands(params);
@@ -314,7 +314,7 @@ describe("handleCommands subagents", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents foo", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -326,7 +326,7 @@ describe("handleCommands subagents", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents info", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -349,7 +349,7 @@ describe("handleCommands subagents", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
session: { mainKey: "main", scope: "per-sender" },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/status", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -384,7 +384,7 @@ describe("handleCommands subagents", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
session: { mainKey: "main", scope: "per-sender" },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/status", cfg);
params.resolvedVerboseLevel = "on";
const result = await handleCommands(params);
@@ -411,7 +411,7 @@ describe("handleCommands subagents", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
session: { mainKey: "main", scope: "per-sender" },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents info 1", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -427,7 +427,7 @@ describe("handleCommands /tts", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
messages: { tts: { prefsPath: path.join(testWorkspaceDir, "tts.json") } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/tts", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);