fix(cli): keep nodes json stdout clean (#84423)

Co-authored-by: Gio Della-Libera <giodl@microsoft.com>
This commit is contained in:
Gio Della-Libera
2026-05-21 18:05:11 -07:00
committed by GitHub
parent cbe68ba1a1
commit ee9813f478
4 changed files with 70 additions and 10 deletions

View File

@@ -127,11 +127,15 @@ const entrySpecs: readonly CommandGroupDescriptorSpec<SubCliRegistrar>[] = [
loadModule: () => import("../exec-policy-cli.js"),
exportName: "registerExecPolicyCli",
},
{
commandNames: ["nodes"],
loadModule: () => import("../nodes-cli.js"),
exportName: "registerNodesCli",
]),
{
commandNames: ["nodes"],
register: async (program, argv) => {
const mod = await import("../nodes-cli.js");
await mod.registerNodesCli(program, argv);
},
},
...defineImportedProgramCommandGroupSpecs([
{
commandNames: ["devices"],
loadModule: () => import("../devices-cli.js"),

View File

@@ -172,6 +172,12 @@ describe("registerSubCliCommands", () => {
await program.parseAsync(["nodes", "list"], { from: "user" });
expect(registerNodesCli).toHaveBeenCalledTimes(1);
expect(registerNodesCli).toHaveBeenCalledWith(expect.any(Command), [
"node",
"openclaw",
"nodes",
"list",
]);
expect(nodesAction).toHaveBeenCalledTimes(1);
});