avelino/dotagent

Implement `dotagent plugin invoke` (currently a stub)

Open

#4 创建于 2026年5月20日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)Rust (1 fork)github user discovery
area: cliarea: pluginsgood first issuetype: feature

仓库指标

Star
 (2 star)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南