

























@@ -37,9 +37,22 @@ const { inferAction, registerCapabilityCli } = vi.hoisted(() => {
3737return { inferAction: action, registerCapabilityCli: register };
3838});
393940+const { registerPluginsCli, registerPluginCliCommandsFromValidatedConfig } = vi.hoisted(() => ({
41+registerPluginsCli: vi.fn((program: Command) => {
42+const plugins = program.command("plugins");
43+plugins
44+.command("update")
45+.argument("[id]")
46+.action(() => undefined);
47+}),
48+registerPluginCliCommandsFromValidatedConfig: vi.fn(async () => null),
49+}));
50+4051vi.mock("../acp-cli.js", () => ({ registerAcpCli }));
4152vi.mock("../nodes-cli.js", () => ({ registerNodesCli }));
4253vi.mock("../capability-cli.js", () => ({ registerCapabilityCli }));
54+vi.mock("../plugins-cli.js", () => ({ registerPluginsCli }));
55+vi.mock("../../plugins/cli.js", () => ({ registerPluginCliCommandsFromValidatedConfig }));
4356vi.mock("./private-qa-cli.js", async () => {
4457const actual = await vi.importActual<typeof import("./private-qa-cli.js")>("./private-qa-cli.js");
4558return {
@@ -78,6 +91,8 @@ describe("registerSubCliCommands", () => {
7891loadPrivateQaCliModule.mockClear();
7992registerCapabilityCli.mockClear();
8093inferAction.mockClear();
94+registerPluginsCli.mockClear();
95+registerPluginCliCommandsFromValidatedConfig.mockClear();
8196});
82978398afterEach(() => {
@@ -158,4 +173,24 @@ describe("registerSubCliCommands", () => {
158173expect(registerAcpCli).toHaveBeenCalledTimes(1);
159174expect(acpAction).toHaveBeenCalledTimes(1);
160175});
176+177+it("does not preload plugin CLI registrations for builtin plugins update", async () => {
178+process.argv = ["node", "openclaw", "plugins", "update", "lossless-claw"];
179+const program = new Command().name("openclaw");
180+181+await registerSubCliByName(program, "plugins");
182+183+expect(registerPluginsCli).toHaveBeenCalledTimes(1);
184+expect(registerPluginCliCommandsFromValidatedConfig).not.toHaveBeenCalled();
185+});
186+187+it("keeps plugin CLI registrations available for the plugins command root", async () => {
188+process.argv = ["node", "openclaw", "plugins"];
189+const program = new Command().name("openclaw");
190+191+await registerSubCliByName(program, "plugins");
192+193+expect(registerPluginsCli).toHaveBeenCalledTimes(1);
194+expect(registerPluginCliCommandsFromValidatedConfig).toHaveBeenCalledTimes(1);
195+});
161196});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。