























@@ -19,6 +19,7 @@ const buildProgramMock = vi.hoisted(() => vi.fn());
1919const getProgramContextMock = vi.hoisted(() => vi.fn(() => null));
2020const registerCoreCliByNameMock = vi.hoisted(() => vi.fn());
2121const registerSubCliByNameMock = vi.hoisted(() => vi.fn());
22+const registerPluginCliCommandsFromValidatedConfigMock = vi.hoisted(() => vi.fn(async () => ({})));
2223const restoreTerminalStateMock = vi.hoisted(() => vi.fn());
2324const hasEnvHttpProxyAgentConfiguredMock = vi.hoisted(() => vi.fn(() => false));
2425const ensureGlobalUndiciEnvProxyDispatcherMock = vi.hoisted(() => vi.fn());
@@ -151,6 +152,10 @@ vi.mock("./program/register.subclis.js", () => ({
151152registerSubCliByName: registerSubCliByNameMock,
152153}));
153154155+vi.mock("../plugins/cli.js", () => ({
156+registerPluginCliCommandsFromValidatedConfig: registerPluginCliCommandsFromValidatedConfigMock,
157+}));
158+154159vi.mock("../terminal/restore.js", () => ({
155160restoreTerminalState: restoreTerminalStateMock,
156161}));
@@ -358,6 +363,7 @@ describe("runCli exit behavior", () => {
358363["models list", ["node", "openclaw", "models", "list"]],
359364["models status without live probe", ["node", "openclaw", "models", "status"]],
360365["tasks list", ["node", "openclaw", "tasks", "list"]],
366+["gateway tools namespace typo", ["node", "openclaw", "tools", "effective"]],
361367["migrate", ["node", "openclaw", "migrate"]],
362368])("skips managed proxy routing for %s", (_name, argv) => {
363369expect(shouldStartProxyForCli(argv)).toBe(false);
@@ -379,6 +385,26 @@ describe("runCli exit behavior", () => {
379385expect(startProxyMock).toHaveBeenCalledWith(undefined);
380386});
381387388+it("keeps gateway tool RPC names out of plugin command discovery", async () => {
389+const parseAsync = vi.fn().mockResolvedValueOnce(undefined);
390+buildProgramMock.mockReturnValueOnce({
391+commands: [],
392+ parseAsync,
393+});
394+395+await runCli(["node", "openclaw", "tools", "effective"]);
396+397+expect(startProxyMock).not.toHaveBeenCalled();
398+expect(registerSubCliByNameMock).toHaveBeenCalledWith(expect.anything(), "tools", [
399+"node",
400+"openclaw",
401+"tools",
402+"effective",
403+]);
404+expect(registerPluginCliCommandsFromValidatedConfigMock).not.toHaveBeenCalled();
405+expect(parseAsync).toHaveBeenCalledWith(["node", "openclaw", "tools", "effective"]);
406+});
407+382408it("fails protected commands when managed proxy activation fails", async () => {
383409startProxyMock.mockRejectedValueOnce(new Error("proxy: enabled but no HTTP proxy URL"));
384410此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。