(action: DebugCommands)
| 3389 | } |
| 3390 | |
| 3391 | async fn handle_debug_command(action: DebugCommands) -> anyhow::Result<()> { |
| 3392 | match action { |
| 3393 | DebugCommands::Paths => { |
| 3394 | println!("Global paths:"); |
| 3395 | println!(" {:<12} {}", "cwd", std::env::current_dir()?.display()); |
| 3396 | println!( |
| 3397 | " {:<12} {}", |
| 3398 | "home", |
| 3399 | dirs::home_dir() |
| 3400 | .map(|p| p.display().to_string()) |
| 3401 | .unwrap_or_else(|| "<none>".to_string()) |
| 3402 | ); |
| 3403 | println!( |
| 3404 | " {:<12} {}", |
| 3405 | "config", |
| 3406 | dirs::config_dir() |
| 3407 | .map(|p| p.display().to_string()) |
| 3408 | .unwrap_or_else(|| "<none>".to_string()) |
| 3409 | ); |
| 3410 | println!( |
| 3411 | " {:<12} {}", |
| 3412 | "data", |
| 3413 | dirs::data_dir() |
| 3414 | .map(|p| p.display().to_string()) |
| 3415 | .unwrap_or_else(|| "<none>".to_string()) |
| 3416 | ); |
| 3417 | println!( |
| 3418 | " {:<12} {}", |
| 3419 | "cache", |
| 3420 | dirs::cache_dir() |
| 3421 | .map(|p| p.display().to_string()) |
| 3422 | .unwrap_or_else(|| "<none>".to_string()) |
| 3423 | ); |
| 3424 | } |
| 3425 | DebugCommands::Config => { |
| 3426 | let cwd = std::env::current_dir()?; |
| 3427 | let config = load_config(&cwd)?; |
| 3428 | println!("{}", serde_json::to_string_pretty(&config)?); |
| 3429 | } |
| 3430 | DebugCommands::Skill => { |
| 3431 | let skills = list_available_skills(); |
| 3432 | let list: Vec<_> = skills |
| 3433 | .into_iter() |
| 3434 | .map(|(name, description)| { |
| 3435 | serde_json::json!({ |
| 3436 | "name": name, |
| 3437 | "description": description |
| 3438 | }) |
| 3439 | }) |
| 3440 | .collect(); |
| 3441 | println!("{}", serde_json::to_string_pretty(&list)?); |
| 3442 | } |
| 3443 | DebugCommands::Scrap => { |
| 3444 | let db = Database::new().await?; |
| 3445 | let session_repo = SessionRepository::new(db.pool().clone()); |
| 3446 | let sessions = session_repo.list(None, 10_000).await?; |
| 3447 | let mut grouped: BTreeMap<String, Vec<String>> = BTreeMap::new(); |
| 3448 | for session in sessions { |
no test coverage detected