area: cliarea: pluginsgood first issuetype: feature
Repository metrics
- Stars
- (2 stars)
- PR merge metrics
- (PR metrics pending)
説明
Plugins in dotagent are subprocesses that speak JSON over stdio (info, validate, invoke — see docs/reference/plugin-protocol.md). The daemon invokes them automatically, but when something goes wrong (silent failure, wrong output shape, unexpected exit code), the only debugging paths are:
- Run the plugin binary by hand and pipe JSON into stdin (works but tedious to construct payloads).
- Read the daemon logs after the fact, often without enough context.
dotagent plugin invoke <name> <payload> is declared in the CLI as the interactive debug path, but the implementation is a stub returning Err("plugin invoke <name> — not yet implemented"). Plugin development is meaningfully harder than it needs to be because of this.
Proposal
Make dotagent plugin invoke mirror what the daemon does, but interactively:
- Resolve the plugin binary the same way
PluginClientdoes (PATH + plugin dir search). - Accept
<payload>as either a JSON literal or-(read from stdin). - Pretty-print the plugin's response (status, output, suggested action).
- Honor the same env contract the daemon passes (
AGENT_NAME,AGENT_HOME, etc.) — likely via--agent <name>/--schedule <id>flags that pull from a real manifest if available, or fall back to placeholders.
Acceptance criteria
-
dotagent plugin invoke sink-file '{"event":"success","stdout":"hi"}'runs the plugin and prints its response. -
echo '{...}' | dotagent plugin invoke sink-file -works. - When the plugin is not found, the error message points at the search path that was tried.
- Output uses the same human/JSON renderer convention defined in
CLAUDE.md(no rawDebugdumps). -
docs/concepts/plugins.mdgains a "Debugging a plugin" section.
Where to start
crates/dotagent/src/commands/mod.rs::plugin_invoke— current stub.crates/dotagent-plugin/src/lib.rs—PluginClient, the existing invocation flow.docs/reference/plugin-protocol.md— JSON shape of each verb.
Non-goals
- Replacing the daemon's plugin lifecycle. This is a one-shot debug command.
- A REPL or interactive prompt. Single invocation, single response.