mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-04 22:01:15 +00:00
refactor(plugins): decouple bundled plugin runtime loading
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { installedPluginRoot } from "../../test/helpers/bundled-plugin-paths.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
applyExclusiveSlotSelection,
|
||||
@@ -21,6 +22,12 @@ import {
|
||||
writeConfigFile,
|
||||
} from "./plugins-cli-test-helpers.js";
|
||||
|
||||
const CLI_STATE_ROOT = "/tmp/openclaw-state";
|
||||
|
||||
function cliInstallPath(pluginId: string): string {
|
||||
return installedPluginRoot(CLI_STATE_ROOT, pluginId);
|
||||
}
|
||||
|
||||
function createEnabledPluginConfig(pluginId: string): OpenClawConfig {
|
||||
return {
|
||||
plugins: {
|
||||
@@ -58,7 +65,7 @@ function createClawHubInstallResult(params: {
|
||||
return {
|
||||
ok: true,
|
||||
pluginId: params.pluginId,
|
||||
targetDir: `/tmp/openclaw-state/extensions/${params.pluginId}`,
|
||||
targetDir: cliInstallPath(params.pluginId),
|
||||
version: params.version,
|
||||
packageName: params.packageName,
|
||||
clawhub: {
|
||||
@@ -154,7 +161,7 @@ describe("plugins cli install", () => {
|
||||
installs: {
|
||||
alpha: {
|
||||
source: "marketplace",
|
||||
installPath: "/tmp/openclaw-state/extensions/alpha",
|
||||
installPath: cliInstallPath("alpha"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -164,7 +171,7 @@ describe("plugins cli install", () => {
|
||||
installPluginFromMarketplace.mockResolvedValue({
|
||||
ok: true,
|
||||
pluginId: "alpha",
|
||||
targetDir: "/tmp/openclaw-state/extensions/alpha",
|
||||
targetDir: cliInstallPath("alpha"),
|
||||
version: "1.2.3",
|
||||
marketplaceName: "Claude",
|
||||
marketplaceSource: "local/repo",
|
||||
@@ -201,7 +208,7 @@ describe("plugins cli install", () => {
|
||||
install: {
|
||||
source: "clawhub",
|
||||
spec: "clawhub:demo@1.2.3",
|
||||
installPath: "/tmp/openclaw-state/extensions/demo",
|
||||
installPath: cliInstallPath("demo"),
|
||||
clawhubPackage: "demo",
|
||||
clawhubFamily: "code-plugin",
|
||||
clawhubChannel: "official",
|
||||
@@ -260,7 +267,7 @@ describe("plugins cli install", () => {
|
||||
install: {
|
||||
source: "clawhub",
|
||||
spec: "clawhub:demo@1.2.3",
|
||||
installPath: "/tmp/openclaw-state/extensions/demo",
|
||||
installPath: cliInstallPath("demo"),
|
||||
clawhubPackage: "demo",
|
||||
},
|
||||
});
|
||||
@@ -317,7 +324,7 @@ describe("plugins cli install", () => {
|
||||
installPluginFromNpmSpec.mockResolvedValue({
|
||||
ok: true,
|
||||
pluginId: "demo",
|
||||
targetDir: "/tmp/openclaw-state/extensions/demo",
|
||||
targetDir: cliInstallPath("demo"),
|
||||
version: "1.2.3",
|
||||
npmResolution: {
|
||||
packageName: "demo",
|
||||
|
||||
Reference in New Issue
Block a user