MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / handle_uninstall_command

Function handle_uninstall_command

src/agent_cmd.rs:495–543  ·  view source on GitHub ↗
(
    agent: Option<String>,
    profile: Option<String>,
    all_profiles: bool,
)

Source from the content-addressed store, hash-verified

493}
494
495pub(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}

Callers 1

dispatch_commandFunction · 0.85

Calls 10

migrate_installed_agentsFunction · 0.85
get_integrationFunction · 0.85
expected_tool_permsFunction · 0.85
clearMethod · 0.80
home_dirFunction · 0.50
loadFunction · 0.50
uninstallMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected