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 { ClawdbotPluginApi, LineChannelData, ReplyPayload } from "clawdbot/plugin-sdk";
import type { MoltbotPluginApi, LineChannelData, ReplyPayload } from "clawdbot/plugin-sdk";
import {
createActionCard,
createImageCard,
@@ -150,7 +150,7 @@ function parseCardArgs(argsStr: string): {
return result;
}
export function registerLineCardCommand(api: ClawdbotPluginApi): void {
export function registerLineCardCommand(api: MoltbotPluginApi): void {
api.registerCommand({
name: "card",
description: "Send a rich card message (LINE).",

View File

@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig, PluginRuntime } from "clawdbot/plugin-sdk";
import type { MoltbotConfig, PluginRuntime } from "clawdbot/plugin-sdk";
import { linePlugin } from "./channel.js";
import { setLineRuntime } from "./runtime.js";
@@ -12,7 +12,7 @@ type LineRuntimeMocks = {
function createRuntime(): { runtime: PluginRuntime; mocks: LineRuntimeMocks } {
const writeConfigFile = vi.fn(async () => {});
const resolveLineAccount = vi.fn(({ cfg, accountId }: { cfg: ClawdbotConfig; accountId?: string }) => {
const resolveLineAccount = vi.fn(({ cfg, accountId }: { cfg: MoltbotConfig; accountId?: string }) => {
const lineConfig = (cfg.channels?.line ?? {}) as {
tokenFile?: string;
secretFile?: string;
@@ -48,7 +48,7 @@ describe("linePlugin gateway.logoutAccount", () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: {
line: {
tokenFile: "/tmp/token",
@@ -71,7 +71,7 @@ describe("linePlugin gateway.logoutAccount", () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: {
line: {
accounts: {

View File

@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig, PluginRuntime } from "clawdbot/plugin-sdk";
import type { MoltbotConfig, PluginRuntime } from "clawdbot/plugin-sdk";
import { linePlugin } from "./channel.js";
import { setLineRuntime } from "./runtime.js";
@@ -33,7 +33,7 @@ function createRuntime(): { runtime: PluginRuntime; mocks: LineRuntimeMocks } {
const sendMessageLine = vi.fn(async () => ({ messageId: "m-media", chatId: "c1" }));
const chunkMarkdownText = vi.fn((text: string) => [text]);
const resolveTextChunkLimit = vi.fn(() => 123);
const resolveLineAccount = vi.fn(({ cfg, accountId }: { cfg: ClawdbotConfig; accountId?: string }) => {
const resolveLineAccount = vi.fn(({ cfg, accountId }: { cfg: MoltbotConfig; accountId?: string }) => {
const resolved = accountId ?? "default";
const lineConfig = (cfg.channels?.line ?? {}) as {
accounts?: Record<string, Record<string, unknown>>;
@@ -90,7 +90,7 @@ describe("linePlugin outbound.sendPayload", () => {
it("sends flex message without dropping text", async () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);
const cfg = { channels: { line: {} } } as ClawdbotConfig;
const cfg = { channels: { line: {} } } as MoltbotConfig;
const payload = {
text: "Now playing:",
@@ -121,7 +121,7 @@ describe("linePlugin outbound.sendPayload", () => {
it("sends template message without dropping text", async () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);
const cfg = { channels: { line: {} } } as ClawdbotConfig;
const cfg = { channels: { line: {} } } as MoltbotConfig;
const payload = {
text: "Choose one:",
@@ -157,7 +157,7 @@ describe("linePlugin outbound.sendPayload", () => {
it("attaches quick replies when no text chunks are present", async () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);
const cfg = { channels: { line: {} } } as ClawdbotConfig;
const cfg = { channels: { line: {} } } as MoltbotConfig;
const payload = {
channelData: {
@@ -197,7 +197,7 @@ describe("linePlugin outbound.sendPayload", () => {
it("sends media before quick-reply text so buttons stay visible", async () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);
const cfg = { channels: { line: {} } } as ClawdbotConfig;
const cfg = { channels: { line: {} } } as MoltbotConfig;
const payload = {
text: "Hello",
@@ -235,7 +235,7 @@ describe("linePlugin outbound.sendPayload", () => {
it("uses configured text chunk limit for payloads", async () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);
const cfg = { channels: { line: { textChunkLimit: 123 } } } as ClawdbotConfig;
const cfg = { channels: { line: { textChunkLimit: 123 } } } as MoltbotConfig;
const payload = {
text: "Hello world",
@@ -295,7 +295,7 @@ describe("linePlugin groups.resolveRequireMention", () => {
},
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
const requireMention = linePlugin.groups.resolveRequireMention({
cfg,

View File

@@ -4,7 +4,7 @@ import {
LineConfigSchema,
processLineMessage,
type ChannelPlugin,
type ClawdbotConfig,
type MoltbotConfig,
type LineConfig,
type LineChannelData,
type ResolvedLineAccount,
@@ -53,7 +53,7 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
if (!account.channelAccessToken) {
throw new Error("LINE channel access token not configured");
}
await line.pushMessageLine(id, "Clawdbot: your access has been approved.", {
await line.pushMessageLine(id, "Moltbot: your access has been approved.", {
channelAccessToken: account.channelAccessToken,
});
},
@@ -164,7 +164,7 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
allowFrom: account.config.allowFrom ?? [],
policyPath: `${basePath}dmPolicy`,
allowFromPath: basePath,
approveHint: "clawdbot pairing approve line <code>",
approveHint: "moltbot pairing approve line <code>",
normalizeEntry: (raw) => raw.replace(/^line:(?:user:)?/i, ""),
};
},
@@ -639,7 +639,7 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = {
},
logoutAccount: async ({ accountId, cfg }) => {
const envToken = process.env.LINE_CHANNEL_ACCESS_TOKEN?.trim() ?? "";
const nextCfg = { ...cfg } as ClawdbotConfig;
const nextCfg = { ...cfg } as MoltbotConfig;
const lineConfig = (cfg.channels?.line ?? {}) as LineConfig;
const nextLine = { ...lineConfig };
let cleared = false;