avelino/dotagent

Implement `dotagent plugin invoke` (currently a stub)

Aberta

#4 aberto em 20 de mai. de 2026

 (0 comentário) (0 reação) (0 responsável)Rust (1 fork)github user discovery
area: cliarea: pluginsgood first issuetype: feature

Métricas do repositório

Stars
 (3 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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 PluginClient does (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 raw Debug dumps).
  • 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.rsPluginClient, 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.

Guia do colaborador