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
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:
8 files changed
+697
-216
No files matched your search
+38
-1
@@ -9,6 +9,7 @@ mod cmd_new;
|
||||
mod cmd_plugin;
|
||||
mod cmd_run;
|
||||
mod entry;
|
||||
mod introspect;
|
||||
mod naming;
|
||||
mod plugin_files;
|
||||
mod runtime;
|
||||
@@ -121,12 +122,40 @@ fn main() {
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
Command::Explain { route, entry, out } => {
|
||||
Command::Explain {
|
||||
route,
|
||||
entry,
|
||||
out,
|
||||
json,
|
||||
} => {
|
||||
if let Err(e) = cmd_graph::explain(
|
||||
std::path::Path::new("."),
|
||||
&route,
|
||||
entry.as_deref(),
|
||||
out.as_deref(),
|
||||
render(json),
|
||||
) {
|
||||
eprintln!("error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
Command::Routes { entry, out, json } => {
|
||||
if let Err(e) = cmd_graph::routes(
|
||||
std::path::Path::new("."),
|
||||
entry.as_deref(),
|
||||
out.as_deref(),
|
||||
render(json),
|
||||
) {
|
||||
eprintln!("error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
Command::Tokens { entry, out, json } => {
|
||||
if let Err(e) = cmd_graph::tokens(
|
||||
std::path::Path::new("."),
|
||||
entry.as_deref(),
|
||||
out.as_deref(),
|
||||
render(json),
|
||||
) {
|
||||
eprintln!("error: {e}");
|
||||
std::process::exit(1);
|
||||
@@ -143,3 +172,11 @@ fn main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn render(json: bool) -> cmd_graph::Render {
|
||||
if json {
|
||||
cmd_graph::Render::Json
|
||||
} else {
|
||||
cmd_graph::Render::Text
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user