fix(plugins): label registry list state as enabled

This commit is contained in:
Vincent Koc
2026-04-25 05:22:15 -07:00
parent 5677a26385
commit feb8d3a4bd
3 changed files with 20 additions and 15 deletions

View File

@@ -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 ?? "",
};

View File

@@ -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({

View File

@@ -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