KeiSeiKit-1.0/_primitives/_rust/kei-router/src/main.rs
Parfii-bot 0be354a920 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

35 lines
891 B
Rust

//! kei-router CLI — print routed tool-call as JSON.
use clap::Parser;
use kei_router::Router;
use std::process::ExitCode;
#[derive(Parser)]
#[command(name = "kei-router", version, about = "Route NL query → tool-call JSON")]
struct Cli {
/// The natural-language query.
query: String,
/// Hint remote-MCP forwarding on fallback (adds _forward=true).
#[arg(long)]
forward: bool,
}
fn main() -> ExitCode {
let cli = Cli::parse();
let router = Router::new();
let result = if cli.forward {
router.route_with_hint(&cli.query)
} else {
router.route(&cli.query)
};
match serde_json::to_string_pretty(&result) {
Ok(s) => {
println!("{}", s);
ExitCode::SUCCESS
}
Err(e) => {
eprintln!("kei-router: json encode failed: {e}");
ExitCode::from(1)
}
}
}