mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 13:50:43 +00:00
feat(plugins): add registry repair command
This commit is contained in:
@@ -4,7 +4,9 @@ import {
|
||||
buildPluginDiagnosticsReport,
|
||||
buildPluginInspectReport,
|
||||
buildPluginSnapshotReport,
|
||||
inspectPluginRegistry,
|
||||
resetPluginsCliTestState,
|
||||
refreshPluginRegistry,
|
||||
runPluginsCommand,
|
||||
runtimeLogs,
|
||||
} from "./plugins-cli-test-helpers.js";
|
||||
@@ -66,6 +68,49 @@ describe("plugins cli list", () => {
|
||||
expect(runtimeLogs).toContain("No plugin issues detected.");
|
||||
});
|
||||
|
||||
it("reports persisted plugin registry state without refreshing", async () => {
|
||||
inspectPluginRegistry.mockResolvedValue({
|
||||
state: "stale",
|
||||
refreshReasons: ["stale-manifest"],
|
||||
persisted: {
|
||||
plugins: [{ pluginId: "demo", enabled: true }],
|
||||
},
|
||||
current: {
|
||||
plugins: [
|
||||
{ pluginId: "demo", enabled: true },
|
||||
{ pluginId: "next", enabled: false },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
await runPluginsCommand(["plugins", "registry"]);
|
||||
|
||||
expect(inspectPluginRegistry).toHaveBeenCalledWith({ config: {} });
|
||||
expect(refreshPluginRegistry).not.toHaveBeenCalled();
|
||||
expect(runtimeLogs.join("\n")).toContain("State:");
|
||||
expect(runtimeLogs.join("\n")).toContain("stale");
|
||||
expect(runtimeLogs.join("\n")).toContain("Refresh reasons:");
|
||||
expect(runtimeLogs.join("\n")).toContain("openclaw plugins registry --refresh");
|
||||
});
|
||||
|
||||
it("refreshes the persisted plugin registry on request", async () => {
|
||||
refreshPluginRegistry.mockResolvedValue({
|
||||
plugins: [
|
||||
{ pluginId: "demo", enabled: true },
|
||||
{ pluginId: "off", enabled: false },
|
||||
],
|
||||
});
|
||||
|
||||
await runPluginsCommand(["plugins", "registry", "--refresh"]);
|
||||
|
||||
expect(refreshPluginRegistry).toHaveBeenCalledWith({
|
||||
config: {},
|
||||
reason: "manual",
|
||||
});
|
||||
expect(inspectPluginRegistry).not.toHaveBeenCalled();
|
||||
expect(runtimeLogs.join("\n")).toContain("Plugin registry refreshed: 1/2 enabled");
|
||||
});
|
||||
|
||||
it("shows conversation-access hook policy in inspect output", async () => {
|
||||
buildPluginInspectReport.mockReturnValue({
|
||||
workspaceDir: "/workspace",
|
||||
|
||||
Reference in New Issue
Block a user