Implement `dotagent plugin invoke` (currently a stub)
- Dominant language
- Rust
- Stars
- 3
- Forks
- 1
- Avg merge
- 4h 50m
- Merged PRs (30d)
- 1
Description
Plugins in dotagent are subprocesses that speak JSON over stdio (`info`, `validate`, `invoke` — see [`docs/reference/plugin-protocol.md`](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 ` is declared in the CLI as the interactive debug path, but the implementation is a stub returning `Err("plugin invoke — 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 `PluginClient` does (PATH + plugin dir search).
- Accept `` 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 ` / `--schedule ` 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`](CLAUDE.md) (no raw `Debug` dumps).
- [ ] [`docs/concepts/plugins.md`](docs/concepts/plugins.md) gains 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`](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.
Contributor guide
Research direction
Start at crates/dotagent/src/commands/mod.rs::plugin_invoke and compare its intended behavior with PluginClient in crates/dotagent-plugin/src/lib.rs. Read docs/reference/plugin-protocol.md and CLAUDE.md before exercising the literal and stdin payload examples. Done means the command resolves and invokes plugins, reports missing-plugin search paths, renders responses consistently, and adds the requested section to docs/concepts/plugins.md.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100