mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 16:38:27 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -13,12 +13,12 @@ vi.mock("../../plugins/install.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/loader.js", () => ({
|
||||
loadMoltbotPlugins: vi.fn(),
|
||||
loadOpenClawPlugins: vi.fn(),
|
||||
}));
|
||||
|
||||
import fs from "node:fs";
|
||||
import type { ChannelPluginCatalogEntry } from "../../channels/plugins/catalog.js";
|
||||
import type { MoltbotConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { WizardPrompter } from "../../wizard/prompts.js";
|
||||
import { makePrompter, makeRuntime } from "./__tests__/test-utils.js";
|
||||
import { ensureOnboardingPluginInstalled } from "./plugin-install.js";
|
||||
@@ -34,7 +34,7 @@ const baseEntry: ChannelPluginCatalogEntry = {
|
||||
blurb: "Test",
|
||||
},
|
||||
install: {
|
||||
npmSpec: "@moltbot/zalo",
|
||||
npmSpec: "@openclaw/zalo",
|
||||
localPath: "extensions/zalo",
|
||||
},
|
||||
};
|
||||
@@ -49,7 +49,7 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
const prompter = makePrompter({
|
||||
select: vi.fn(async () => "npm") as WizardPrompter["select"],
|
||||
});
|
||||
const cfg: MoltbotConfig = { plugins: { allow: ["other"] } };
|
||||
const cfg: OpenClawConfig = { plugins: { allow: ["other"] } };
|
||||
vi.mocked(fs.existsSync).mockReturnValue(false);
|
||||
installPluginFromNpmSpec.mockResolvedValue({
|
||||
ok: true,
|
||||
@@ -69,10 +69,10 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
expect(result.cfg.plugins?.entries?.zalo?.enabled).toBe(true);
|
||||
expect(result.cfg.plugins?.allow).toContain("zalo");
|
||||
expect(result.cfg.plugins?.installs?.zalo?.source).toBe("npm");
|
||||
expect(result.cfg.plugins?.installs?.zalo?.spec).toBe("@moltbot/zalo");
|
||||
expect(result.cfg.plugins?.installs?.zalo?.spec).toBe("@openclaw/zalo");
|
||||
expect(result.cfg.plugins?.installs?.zalo?.installPath).toBe("/tmp/zalo");
|
||||
expect(installPluginFromNpmSpec).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ spec: "@moltbot/zalo" }),
|
||||
expect.objectContaining({ spec: "@openclaw/zalo" }),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
const prompter = makePrompter({
|
||||
select: vi.fn(async () => "local") as WizardPrompter["select"],
|
||||
});
|
||||
const cfg: MoltbotConfig = {};
|
||||
const cfg: OpenClawConfig = {};
|
||||
vi.mocked(fs.existsSync).mockImplementation((value) => {
|
||||
const raw = String(value);
|
||||
return (
|
||||
@@ -106,7 +106,7 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
const runtime = makeRuntime();
|
||||
const select = vi.fn(async () => "skip") as WizardPrompter["select"];
|
||||
const prompter = makePrompter({ select });
|
||||
const cfg: MoltbotConfig = { update: { channel: "dev" } };
|
||||
const cfg: OpenClawConfig = { update: { channel: "dev" } };
|
||||
vi.mocked(fs.existsSync).mockImplementation((value) => {
|
||||
const raw = String(value);
|
||||
return (
|
||||
@@ -129,7 +129,7 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
const runtime = makeRuntime();
|
||||
const select = vi.fn(async () => "skip") as WizardPrompter["select"];
|
||||
const prompter = makePrompter({ select });
|
||||
const cfg: MoltbotConfig = { update: { channel: "beta" } };
|
||||
const cfg: OpenClawConfig = { update: { channel: "beta" } };
|
||||
vi.mocked(fs.existsSync).mockImplementation((value) => {
|
||||
const raw = String(value);
|
||||
return (
|
||||
@@ -157,7 +157,7 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
note,
|
||||
confirm,
|
||||
});
|
||||
const cfg: MoltbotConfig = {};
|
||||
const cfg: OpenClawConfig = {};
|
||||
vi.mocked(fs.existsSync).mockImplementation((value) => {
|
||||
const raw = String(value);
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,11 @@ import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agents/agent-scope.js";
|
||||
import type { ChannelPluginCatalogEntry } from "../../channels/plugins/catalog.js";
|
||||
import type { MoltbotConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { createSubsystemLogger } from "../../logging/subsystem.js";
|
||||
import { recordPluginInstall } from "../../plugins/installs.js";
|
||||
import { enablePluginInConfig } from "../../plugins/enable.js";
|
||||
import { loadMoltbotPlugins } from "../../plugins/loader.js";
|
||||
import { loadOpenClawPlugins } from "../../plugins/loader.js";
|
||||
import { installPluginFromNpmSpec } from "../../plugins/install.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import type { WizardPrompter } from "../../wizard/prompts.js";
|
||||
@@ -14,7 +14,7 @@ import type { WizardPrompter } from "../../wizard/prompts.js";
|
||||
type InstallChoice = "npm" | "local" | "skip";
|
||||
|
||||
type InstallResult = {
|
||||
cfg: MoltbotConfig;
|
||||
cfg: OpenClawConfig;
|
||||
installed: boolean;
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ function resolveLocalPath(
|
||||
return null;
|
||||
}
|
||||
|
||||
function addPluginLoadPath(cfg: MoltbotConfig, pluginPath: string): MoltbotConfig {
|
||||
function addPluginLoadPath(cfg: OpenClawConfig, pluginPath: string): OpenClawConfig {
|
||||
const existing = cfg.plugins?.load?.paths ?? [];
|
||||
const merged = Array.from(new Set([...existing, pluginPath]));
|
||||
return {
|
||||
@@ -95,7 +95,7 @@ async function promptInstallChoice(params: {
|
||||
}
|
||||
|
||||
function resolveInstallDefaultChoice(params: {
|
||||
cfg: MoltbotConfig;
|
||||
cfg: OpenClawConfig;
|
||||
entry: ChannelPluginCatalogEntry;
|
||||
localPath?: string | null;
|
||||
}): InstallChoice {
|
||||
@@ -114,7 +114,7 @@ function resolveInstallDefaultChoice(params: {
|
||||
}
|
||||
|
||||
export async function ensureOnboardingPluginInstalled(params: {
|
||||
cfg: MoltbotConfig;
|
||||
cfg: OpenClawConfig;
|
||||
entry: ChannelPluginCatalogEntry;
|
||||
prompter: WizardPrompter;
|
||||
runtime: RuntimeEnv;
|
||||
@@ -188,14 +188,14 @@ export async function ensureOnboardingPluginInstalled(params: {
|
||||
}
|
||||
|
||||
export function reloadOnboardingPluginRegistry(params: {
|
||||
cfg: MoltbotConfig;
|
||||
cfg: OpenClawConfig;
|
||||
runtime: RuntimeEnv;
|
||||
workspaceDir?: string;
|
||||
}): void {
|
||||
const workspaceDir =
|
||||
params.workspaceDir ?? resolveAgentWorkspaceDir(params.cfg, resolveDefaultAgentId(params.cfg));
|
||||
const log = createSubsystemLogger("plugins");
|
||||
loadMoltbotPlugins({
|
||||
loadOpenClawPlugins({
|
||||
config: params.cfg,
|
||||
workspaceDir,
|
||||
cache: false,
|
||||
|
||||
Reference in New Issue
Block a user