stats: log per-request usage in session, add 'hx stats <session>' token report
This commit is contained in:
1 parent
34dea8f9fd
commit
1c69c8ed34
5 files changed
+188
-2
No files matched your search
@@ -53,6 +53,8 @@ enum Cmd {
|
||||
Login { provider: Kind },
|
||||
/// Remove stored credentials for a provider.
|
||||
Logout { provider: Kind },
|
||||
/// Token report for a session file (usage, cache hit rate, costliest tool results).
|
||||
Stats { session: std::path::PathBuf },
|
||||
/// Connect to configured MCP servers and print tools + index/eager token cost.
|
||||
Mcp,
|
||||
/// Serve lens diagnostics + LSP navigation as an MCP server over stdio.
|
||||
@@ -278,6 +280,10 @@ async fn main() -> Result<()> {
|
||||
return Ok(());
|
||||
}
|
||||
Some(Cmd::Logout { provider }) => return Ok(auth::logout(provider)?),
|
||||
Some(Cmd::Stats { session }) => {
|
||||
print!("{}", hx_core::stats::report(&Session::open(session)?));
|
||||
return Ok(());
|
||||
}
|
||||
Some(Cmd::Mcp) => {
|
||||
let cwd = std::env::current_dir()?;
|
||||
let hub = hx_mcp::Hub::start(
|
||||
|
||||
Reference in new issue
Block a user