mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix: unblock plugin landing checks (#73235) (thanks @zqchris)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { cleanupTrackedTempDirs, makeTrackedTempDir } from "../plugins/test-helpers/fs-fixtures.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import {
|
||||
@@ -29,6 +30,16 @@ function makePluginWorkspace() {
|
||||
};
|
||||
}
|
||||
|
||||
function configWithPluginLoadPath(pluginRoot: string): OpenClawConfig {
|
||||
return {
|
||||
plugins: {
|
||||
load: {
|
||||
paths: [pluginRoot],
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function writeManifest(dir: string, manifest: Record<string, unknown>) {
|
||||
fs.writeFileSync(
|
||||
path.join(dir, "openclaw.plugin.json"),
|
||||
@@ -102,6 +113,7 @@ describe("doctor plugin manifest legacy contract repair", () => {
|
||||
});
|
||||
|
||||
const migrations = collectLegacyPluginManifestContractMigrations({
|
||||
config: configWithPluginLoadPath(pluginsRoot),
|
||||
env: {
|
||||
...process.env,
|
||||
},
|
||||
@@ -131,6 +143,7 @@ describe("doctor plugin manifest legacy contract repair", () => {
|
||||
});
|
||||
|
||||
await maybeRepairLegacyPluginManifestContracts({
|
||||
config: configWithPluginLoadPath(pluginsRoot),
|
||||
env: {
|
||||
...process.env,
|
||||
},
|
||||
@@ -168,6 +181,7 @@ describe("doctor plugin manifest legacy contract repair", () => {
|
||||
});
|
||||
|
||||
const migrations = collectLegacyPluginManifestContractMigrations({
|
||||
config: configWithPluginLoadPath(pluginsRoot),
|
||||
env: {
|
||||
...process.env,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { z } from "zod";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { loadPluginManifestRegistry } from "../plugins/manifest-registry.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { normalizeOptionalString } from "../shared/string-coerce.js";
|
||||
@@ -81,6 +82,7 @@ function buildLegacyManifestContractMigration(params: {
|
||||
}
|
||||
|
||||
export function collectLegacyPluginManifestContractMigrations(params?: {
|
||||
config?: OpenClawConfig;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
manifestRoots?: string[];
|
||||
workspaceDir?: string;
|
||||
@@ -114,6 +116,7 @@ export function collectLegacyPluginManifestContractMigrations(params?: {
|
||||
|
||||
for (const plugin of loadPluginManifestRegistry({
|
||||
cache: false,
|
||||
...(params?.config ? { config: params.config } : {}),
|
||||
...(params?.env ? { env: params.env } : {}),
|
||||
...(params?.workspaceDir ? { workspaceDir: params.workspaceDir } : {}),
|
||||
}).plugins) {
|
||||
@@ -138,6 +141,7 @@ export function collectLegacyPluginManifestContractMigrations(params?: {
|
||||
}
|
||||
|
||||
export async function maybeRepairLegacyPluginManifestContracts(params: {
|
||||
config?: OpenClawConfig;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
manifestRoots?: string[];
|
||||
workspaceDir?: string;
|
||||
@@ -146,6 +150,7 @@ export async function maybeRepairLegacyPluginManifestContracts(params: {
|
||||
note?: typeof note;
|
||||
}): Promise<void> {
|
||||
const migrations = collectLegacyPluginManifestContractMigrations({
|
||||
...(params.config ? { config: params.config } : {}),
|
||||
...(params.env ? { env: params.env } : {}),
|
||||
...(params.manifestRoots ? { manifestRoots: params.manifestRoots } : {}),
|
||||
...(params.workspaceDir ? { workspaceDir: params.workspaceDir } : {}),
|
||||
|
||||
@@ -223,6 +223,7 @@ async function runLegacyPluginManifestHealth(ctx: DoctorHealthFlowContext): Prom
|
||||
const { maybeRepairLegacyPluginManifestContracts } =
|
||||
await import("../commands/doctor-plugin-manifests.js");
|
||||
await maybeRepairLegacyPluginManifestContracts({
|
||||
config: ctx.cfg,
|
||||
env: process.env,
|
||||
runtime: ctx.runtime,
|
||||
prompter: ctx.prompter,
|
||||
|
||||
Reference in New Issue
Block a user