mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:40:44 +00:00
fix(plugins): label registry list state as enabled
This commit is contained in:
@@ -179,9 +179,7 @@ export function registerPluginsCli(program: Command) {
|
||||
config: cfg,
|
||||
...(opts.json ? { logger: quietPluginJsonLogger } : {}),
|
||||
});
|
||||
const list = opts.enabled
|
||||
? report.plugins.filter((p) => p.status === "loaded")
|
||||
: report.plugins;
|
||||
const list = opts.enabled ? report.plugins.filter((p) => p.enabled) : report.plugins;
|
||||
|
||||
if (opts.json) {
|
||||
const payload = {
|
||||
@@ -202,9 +200,9 @@ export function registerPluginsCli(program: Command) {
|
||||
return;
|
||||
}
|
||||
|
||||
const loaded = list.filter((p) => p.status === "loaded").length;
|
||||
const enabled = list.filter((p) => p.enabled).length;
|
||||
defaultRuntime.log(
|
||||
`${theme.heading("Plugins")} ${theme.muted(`(${loaded}/${list.length} loaded)`)}`,
|
||||
`${theme.heading("Plugins")} ${theme.muted(`(${enabled}/${list.length} enabled)`)}`,
|
||||
);
|
||||
|
||||
if (!opts.verbose) {
|
||||
@@ -225,11 +223,11 @@ export function registerPluginsCli(program: Command) {
|
||||
ID: plugin.name && plugin.name !== plugin.id ? plugin.id : "",
|
||||
Format: plugin.format ?? "openclaw",
|
||||
Status:
|
||||
plugin.status === "loaded"
|
||||
? theme.success("loaded")
|
||||
: plugin.status === "disabled"
|
||||
? theme.warn("disabled")
|
||||
: theme.error("error"),
|
||||
plugin.status === "error"
|
||||
? theme.error("error")
|
||||
: plugin.enabled
|
||||
? theme.success("enabled")
|
||||
: theme.warn("disabled"),
|
||||
Source: sourceLine,
|
||||
Version: plugin.version ?? "",
|
||||
};
|
||||
|
||||
@@ -3,6 +3,13 @@ import { createPluginRecord } from "../plugins/status.test-helpers.js";
|
||||
import { formatPluginLine } from "./plugins-list-format.js";
|
||||
|
||||
describe("formatPluginLine", () => {
|
||||
it("labels active registry entries as enabled rather than loaded", () => {
|
||||
const output = formatPluginLine(createPluginRecord({ id: "demo", enabled: true }));
|
||||
|
||||
expect(output).toContain("enabled");
|
||||
expect(output).not.toContain("loaded");
|
||||
});
|
||||
|
||||
it("shows imported state in verbose output", () => {
|
||||
const output = formatPluginLine(
|
||||
createPluginRecord({
|
||||
|
||||
@@ -5,11 +5,11 @@ import { shortenHomeInString } from "../utils.js";
|
||||
|
||||
export function formatPluginLine(plugin: PluginRecord, verbose = false): string {
|
||||
const status =
|
||||
plugin.status === "loaded"
|
||||
? theme.success("loaded")
|
||||
: plugin.status === "disabled"
|
||||
? theme.warn("disabled")
|
||||
: theme.error("error");
|
||||
plugin.status === "error"
|
||||
? theme.error("error")
|
||||
: plugin.enabled
|
||||
? theme.success("enabled")
|
||||
: theme.warn("disabled");
|
||||
const name = theme.command(plugin.name || plugin.id);
|
||||
const idSuffix = plugin.name && plugin.name !== plugin.id ? theme.muted(` (${plugin.id})`) : "";
|
||||
const desc = plugin.description
|
||||
|
||||
Reference in New Issue
Block a user