From feb8d3a4bda7a4458c2ec664470cb7ceb97abea4 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 25 Apr 2026 05:22:15 -0700 Subject: [PATCH] fix(plugins): label registry list state as enabled --- src/cli/plugins-cli.ts | 18 ++++++++---------- src/cli/plugins-list-format.test.ts | 7 +++++++ src/cli/plugins-list-format.ts | 10 +++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/cli/plugins-cli.ts b/src/cli/plugins-cli.ts index e645404e9e8..7350f6a318f 100644 --- a/src/cli/plugins-cli.ts +++ b/src/cli/plugins-cli.ts @@ -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 ?? "", }; diff --git a/src/cli/plugins-list-format.test.ts b/src/cli/plugins-list-format.test.ts index f7059c0c983..786e89d693c 100644 --- a/src/cli/plugins-list-format.test.ts +++ b/src/cli/plugins-list-format.test.ts @@ -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({ diff --git a/src/cli/plugins-list-format.ts b/src/cli/plugins-list-format.ts index 59cd15e4bcb..47db9f9dbc8 100644 --- a/src/cli/plugins-list-format.ts +++ b/src/cli/plugins-list-format.ts @@ -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