fix(plugins): expose channel CLI metadata in discovery (#71309)

Merged via squash.

Prepared head SHA: ce6bb35812
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:
Gustavo Madeira Santana
2026-04-24 22:06:57 -04:00
committed by GitHub
parent 7ef4ecf499
commit a5db42862d
9 changed files with 385 additions and 14 deletions

View File

@@ -69,6 +69,37 @@ describe("matrix plugin", () => {
expect(entry.setChannelRuntime).toEqual(expect.any(Function));
});
it("registers CLI metadata during discovery registration", () => {
const registerChannel = vi.fn();
const registerCli = vi.fn();
const registerGatewayMethod = vi.fn();
const api = createTestPluginApi({
id: "matrix",
name: "Matrix",
source: "test",
config: {},
runtime: {} as never,
registrationMode: "discovery",
registerChannel,
registerCli,
registerGatewayMethod,
});
entry.register(api);
expect(registerChannel).toHaveBeenCalledTimes(1);
expect(registerCli).toHaveBeenCalledWith(expect.any(Function), {
descriptors: [
{
name: "matrix",
description: "Manage Matrix accounts, verification, devices, and profile state",
hasSubcommands: true,
},
],
});
expect(registerGatewayMethod).not.toHaveBeenCalled();
});
it("registers subagent lifecycle hooks during full runtime registration", () => {
const on = vi.fn();
const registerGatewayMethod = vi.fn();