Skip to content

Commit 8d61b29

Browse files
committed
feat: wire RozenitePlugin into daemon and CLI
Add rozenite CLI subcommand family (status, tools, tool-schema, call) and register RozenitePlugin in the PluginOrchestrator alongside the runtime bridge plugin.
1 parent 50004b5 commit 8d61b29

3 files changed

Lines changed: 73 additions & 1 deletion

File tree

packages/agent-cdp/src/cli/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import { usage } from "./help.js";
55
import type { AgentPluginRegistration } from "./program.js";
66
import { createProgram } from "./program.js";
77
import { registerCliCommands as registerRuntimeBridgeCliCommands } from "../plugins/runtime-bridge/index.js";
8+
import { registerRozeniteCliCommands } from "../plugins/rozenite/cli.js";
89

910
export { ensureTargetSelected, MULTIPLE_TARGETS_AVAILABLE_MESSAGE, usage };
1011

1112
const BUILT_IN_PLUGINS: AgentPluginRegistration[] = [
1213
{ registerCliCommands: registerRuntimeBridgeCliCommands },
14+
{ registerCliCommands: registerRozeniteCliCommands },
1315
];
1416

1517
function shouldPrintHelp(argv: string[]): boolean {

packages/agent-cdp/src/daemon.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { JsProfiler } from "./js-profiler/index.js";
1616
import { NetworkManager } from "./network/index.js";
1717
import { PluginOrchestrator } from "./plugin-orchestrator.js";
1818
import { AgentRuntimeBridgePlugin } from "./plugins/runtime-bridge/index.js";
19+
import { RozenitePlugin } from "./plugins/rozenite/index.js";
1920
import { createTargetProviders } from "./providers.js";
2021
import { RuntimeManager } from "./runtime/index.js";
2122
import { SessionManager } from "./session-manager.js";
@@ -52,7 +53,8 @@ class Daemon {
5253

5354
constructor() {
5455
const bridgePlugin = new AgentRuntimeBridgePlugin((cmd) => this.commandDispatcher.dispatch(cmd));
55-
this.orchestrator = new PluginOrchestrator([bridgePlugin]);
56+
const rozenitePlugin = new RozenitePlugin();
57+
this.orchestrator = new PluginOrchestrator([bridgePlugin, rozenitePlugin]);
5658

5759
this.commandDispatcher = new AgentCdpCommandDispatcher({
5860
startedAt: this.startedAt,
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import type { Command } from "commander";
2+
3+
import type { CliDeps } from "../../cli/context.js";
4+
import { unwrapResponse } from "../../cli/shared.js";
5+
6+
function printJson(data: unknown): void {
7+
console.log(JSON.stringify(data, null, 2));
8+
}
9+
10+
export function registerRozeniteCliCommands(program: Command, deps: CliDeps): void {
11+
const rozenite = program.command("rozenite").description("Rozenite React Native devtools bridge");
12+
13+
rozenite
14+
.command("status")
15+
.description("Show Rozenite plugin state and registered tool count")
16+
.action(async () => {
17+
const data = unwrapResponse(
18+
await deps.sendCommand({ type: "plugin-command", pluginId: "rozenite", command: "status" }),
19+
"Failed to get Rozenite status"
20+
);
21+
printJson(data);
22+
});
23+
24+
rozenite
25+
.command("tools")
26+
.description("List registered Rozenite tools")
27+
.action(async () => {
28+
const data = unwrapResponse(
29+
await deps.sendCommand({ type: "plugin-command", pluginId: "rozenite", command: "tools" }),
30+
"Failed to list Rozenite tools"
31+
);
32+
printJson(data);
33+
});
34+
35+
rozenite
36+
.command("tool-schema <name>")
37+
.description("Show input schema for a Rozenite tool")
38+
.action(async (name: string) => {
39+
const data = unwrapResponse(
40+
await deps.sendCommand({
41+
type: "plugin-command",
42+
pluginId: "rozenite",
43+
command: "tool-schema",
44+
input: { name },
45+
}),
46+
`Failed to get schema for tool '${name}'`
47+
);
48+
printJson(data);
49+
});
50+
51+
rozenite
52+
.command("call <name>")
53+
.description("Call a Rozenite tool")
54+
.option("--input <json>", "Tool input as JSON string")
55+
.action(async (name: string, options: { input?: string }) => {
56+
const args = options.input !== undefined ? (JSON.parse(options.input) as unknown) : undefined;
57+
const data = unwrapResponse(
58+
await deps.sendCommand({
59+
type: "plugin-command",
60+
pluginId: "rozenite",
61+
command: "call",
62+
input: { name, arguments: args },
63+
}),
64+
`Failed to call tool '${name}'`
65+
);
66+
printJson(data);
67+
});
68+
}

0 commit comments

Comments
 (0)