(
agent: Option<String>,
profile: Option<String>,
all_profiles: bool,
)
| 493 | } |
| 494 | |
| 495 | pub(crate) async fn handle_uninstall_command( |
| 496 | agent: Option<String>, |
| 497 | profile: Option<String>, |
| 498 | all_profiles: bool, |
| 499 | ) -> tracedecay::errors::Result<()> { |
| 500 | validate_hermes_profile_flags(agent.as_deref(), &profile, all_profiles)?; |
| 501 | let home = tracedecay::agents::home_dir().ok_or_else(|| { |
| 502 | tracedecay::errors::TraceDecayError::Config { |
| 503 | message: "could not determine home directory".to_string(), |
| 504 | } |
| 505 | })?; |
| 506 | let mut user_cfg = tracedecay::user_config::UserConfig::load(); |
| 507 | tracedecay::agents::migrate_installed_agents(&home, &mut user_cfg); |
| 508 | |
| 509 | if let Some(id) = agent { |
| 510 | let ag = tracedecay::agents::get_integration(&id)?; |
| 511 | for target_profile in hermes_selected_profile_targets(&home, &profile, all_profiles)? { |
| 512 | let ctx = tracedecay::agents::InstallContext { |
| 513 | home: home.clone(), |
| 514 | tracedecay_bin: String::new(), |
| 515 | tool_permissions: tracedecay::agents::expected_tool_perms(), |
| 516 | profile: target_profile, |
| 517 | project_root: None, |
| 518 | dashboard: true, |
| 519 | }; |
| 520 | ag.uninstall(&ctx)?; |
| 521 | } |
| 522 | user_cfg.installed_agents.retain(|a| a != &id); |
| 523 | user_cfg.save(); |
| 524 | } else { |
| 525 | for id in user_cfg.installed_agents.clone() { |
| 526 | if let Ok(ag) = tracedecay::agents::get_integration(&id) { |
| 527 | let ctx = tracedecay::agents::InstallContext { |
| 528 | home: home.clone(), |
| 529 | tracedecay_bin: String::new(), |
| 530 | tool_permissions: tracedecay::agents::expected_tool_perms(), |
| 531 | profile: None, |
| 532 | project_root: None, |
| 533 | dashboard: true, |
| 534 | }; |
| 535 | ag.uninstall(&ctx).ok(); |
| 536 | } |
| 537 | } |
| 538 | user_cfg.installed_agents.clear(); |
| 539 | user_cfg.save(); |
| 540 | eprintln!("All agent integrations removed."); |
| 541 | } |
| 542 | Ok(()) |
| 543 | } |
no test coverage detected