Skip to main content

routa_server/api/
debug.rs

1use axum::{routing::get, Json, Router};
2use serde_json::{json, Value};
3
4use crate::state::AppState;
5use routa_core::shell_env;
6
7/// Debug endpoint to check PATH and command resolution
8async fn debug_path() -> Json<Value> {
9    let full_path = shell_env::full_path();
10    let claude_path = shell_env::which("claude");
11    let opencode_path = shell_env::which("opencode");
12
13    Json(json!({
14        "full_path": full_path,
15        "path_entries": full_path.split(':').collect::<Vec<_>>(),
16        "claude": claude_path,
17        "opencode": opencode_path,
18        "env_path": std::env::var("PATH").ok(),
19    }))
20}
21
22pub fn router() -> Router<AppState> {
23    Router::new().route("/path", get(debug_path))
24}