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,6 +1,7 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { LEGACY_MANIFEST_KEY } from "../compat/legacy-names.js";
import { runCommandWithTimeout } from "../process/exec.js";
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
import {
@@ -20,7 +21,8 @@ type PackageManifest = {
name?: string;
version?: string;
dependencies?: Record<string, string>;
clawdbot?: { extensions?: string[] };
moltbot?: { extensions?: string[] };
[LEGACY_MANIFEST_KEY]?: { extensions?: string[] };
};
export type InstallPluginResult =
@@ -52,14 +54,14 @@ function safeFileName(input: string): string {
return safeDirName(input);
}
async function ensureClawdbotExtensions(manifest: PackageManifest) {
const extensions = manifest.clawdbot?.extensions;
async function ensureMoltbotExtensions(manifest: PackageManifest) {
const extensions = manifest.moltbot?.extensions ?? manifest[LEGACY_MANIFEST_KEY]?.extensions;
if (!Array.isArray(extensions)) {
throw new Error("package.json missing clawdbot.extensions");
throw new Error("package.json missing moltbot.extensions");
}
const list = extensions.map((e) => (typeof e === "string" ? e.trim() : "")).filter(Boolean);
if (list.length === 0) {
throw new Error("package.json clawdbot.extensions is empty");
throw new Error("package.json moltbot.extensions is empty");
}
return list;
}
@@ -99,7 +101,7 @@ async function installPluginFromPackageDir(params: {
let extensions: string[];
try {
extensions = await ensureClawdbotExtensions(manifest);
extensions = await ensureMoltbotExtensions(manifest);
} catch (err) {
return { ok: false, error: String(err) };
}
@@ -217,7 +219,7 @@ export async function installPluginFromArchive(params: {
return { ok: false, error: `unsupported archive: ${archivePath}` };
}
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-plugin-"));
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-plugin-"));
const extractDir = path.join(tmpDir, "extract");
await fs.mkdir(extractDir, { recursive: true });
@@ -350,7 +352,7 @@ export async function installPluginFromNpmSpec(params: {
const spec = params.spec.trim();
if (!spec) return { ok: false, error: "missing npm spec" };
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-npm-pack-"));
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-npm-pack-"));
logger.info?.(`Downloading ${spec}`);
const res = await runCommandWithTimeout(["npm", "pack", spec], {
timeoutMs: Math.max(timeoutMs, 300_000),