mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-08 15:51:06 +00:00
Plugins/CLI: add descriptor-backed lazy root command registration (#57165)
Merged via squash.
Prepared head SHA: ad1dee32eb
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
committed by
GitHub
parent
d330782ed1
commit
9b4f26e70a
46
src/cli/program/root-help.test.ts
Normal file
46
src/cli/program/root-help.test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("./core-command-descriptors.js", () => ({
|
||||
getCoreCliCommandDescriptors: () => [
|
||||
{
|
||||
name: "status",
|
||||
description: "Show status",
|
||||
hasSubcommands: false,
|
||||
},
|
||||
],
|
||||
getCoreCliCommandsWithSubcommands: () => [],
|
||||
}));
|
||||
|
||||
vi.mock("./subcli-descriptors.js", () => ({
|
||||
getSubCliEntries: () => [
|
||||
{
|
||||
name: "config",
|
||||
description: "Manage config",
|
||||
hasSubcommands: true,
|
||||
},
|
||||
],
|
||||
getSubCliCommandsWithSubcommands: () => ["config"],
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/cli.js", () => ({
|
||||
getPluginCliCommandDescriptors: () => [
|
||||
{
|
||||
name: "matrix",
|
||||
description: "Matrix channel utilities",
|
||||
hasSubcommands: true,
|
||||
},
|
||||
],
|
||||
}));
|
||||
|
||||
const { renderRootHelpText } = await import("./root-help.js");
|
||||
|
||||
describe("root help", () => {
|
||||
it("includes plugin CLI descriptors alongside core and sub-CLI commands", () => {
|
||||
const text = renderRootHelpText();
|
||||
|
||||
expect(text).toContain("status");
|
||||
expect(text).toContain("config");
|
||||
expect(text).toContain("matrix");
|
||||
expect(text).toContain("Matrix channel utilities");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user