feat(introspect): routes, tokens and --json, over one query layer an MCP server can reuse
CI / installer (macos-14) (pull_request) Successful in 4s
CI / check (pull_request) Successful in 27s
CI / starter (bun) (pull_request) Successful in 30s
CI / starter (deno) (pull_request) Successful in 32s
CI / starter (edge) (pull_request) Successful in 36s
CI / core-freshness (pull_request) Has been skipped
CI / installer (ubuntu-latest) (pull_request) Successful in 14s
CI / starter (node) (pull_request) Successful in 32s

Agents that inspect a green-tea app should read its graph instead of
guessing it.

- Add `matcha routes`: every route with its transport and chain.
- Add `matcha tokens`: every token, who provides it and who needs it,
  handlers included.
- explain, routes and tokens take --json. It prints one JSON document
  on stdout; a refused query prints a structured error on stderr and
  exits 1.

All introspection now goes through src/introspect.rs. Each Query
variant runs one script that prints a single JSON envelope, and the
CLI renders the data as text unless --json is given. Text output is
unchanged. A future `matcha mcp` serves the same queries as tools
without a second implementation, which is why the formatting moved
from the generated script into Rust.

Adds serde_json (dtolnay, 1.0.154).

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-10-30 10:51:21 -05:00
1 parent 47d1d6e037
commit a4827f2e13
8 files changed
+697 -216

No files matched your search

+23
View File
@@ -80,6 +80,29 @@ pub enum Command {
entry: Option<String>,
#[arg(long)]
out: Option<String>,
/// Print the answer as JSON, for a program or an agent
#[arg(long)]
json: bool,
},
/// List every route, its transport, and the chain it runs
Routes {
#[arg(long)]
entry: Option<String>,
#[arg(long)]
out: Option<String>,
/// Print the answer as JSON, for a program or an agent
#[arg(long)]
json: bool,
},
/// List every token: who provides it and who needs it
Tokens {
#[arg(long)]
entry: Option<String>,
#[arg(long)]
out: Option<String>,
/// Print the answer as JSON, for a program or an agent
#[arg(long)]
json: bool,
},
/// Add a capability to a controller
Add {