feat(introspect): routes, tokens and --json, over one query layer an MCP server can reuse #18

Merged
chrnx merged 2 commits from feat/introspect-json into develop 2026-10-31 01:35:22 +00:00
2 Commits
Author SHA1 Message Date
chrnx 9acb0b34c9 fix(tokens): name the request as the source of its built-in tokens
CI / installer (macos-14) (pull_request) Successful in 3s
CI / check (pull_request) Successful in 27s
CI / starter (bun) (pull_request) Successful in 30s
CI / starter (deno) (pull_request) Successful in 31s
CI / starter (edge) (pull_request) Successful in 36s
CI / core-freshness (pull_request) Has been skipped
CI / installer (ubuntu-latest) (pull_request) Successful in 13s
CI / starter (node) (pull_request) Successful in 33s
matcha tokens listed req as '— (nothing provides it)'. An agent reading
that would write a provider for req. A needed token with no producing
node must come from the request (req, params, body, …): app.ready() has
already validated the graph, so a truly missing token would have failed
it. Mark those source: "request" in the JSON and 'the request (built
in)' in the text.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 10:54:29 -05:00
chrnx a4827f2e13 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>
2026-10-30 10:51:21 -05:00