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

Function run_post_update_tasks

src/update_cmd.rs:309–387  ·  view source on GitHub ↗
(
    no_heal: bool,
    no_reinstall: bool,
)

Source from the content-addressed store, hash-verified

307}
308
309pub(crate) async fn run_post_update_tasks(
310 no_heal: bool,
311 no_reinstall: bool,
312) -> tracedecay::errors::Result<()> {
313 refresh_generated_plugins()?;
314 if let Err(error) = refresh_daemon_service_after_update() {
315 eprintln!(" \x1b[33mwarning:\x1b[0m daemon service refresh failed: {error}");
316 }
317 if no_heal {
318 eprintln!("Skipping post-update health pass (--no-heal).");
319 } else {
320 tracedecay::doctor::heal::run_post_update_health_pass().await;
321 }
322
323 if no_reinstall {
324 eprintln!("Skipping agent integration refresh (--no-reinstall).");
325 // `--no-reinstall` is a durable opt-out for THIS version, not a
326 // one-command deferral: advance the version markers so the startup
327 // silent reinstall (`silent_reinstall_action`) does not immediately
328 // undo the skip on the next ordinary command and reinstall everything
329 // anyway. The next real upgrade re-arms the reinstall as usual.
330 let mut config = UserConfig::load();
331 if config.mark_version_installed(env!("CARGO_PKG_VERSION")) {
332 config.save();
333 }
334 return Ok(());
335 }
336
337 // The generated-artifact refresh above skips config-managed integrations
338 // (claude, copilot, …), but a version bump can change their tool
339 // permissions, hooks, or MCP config too. Run the same full tracked-agent
340 // install pass the startup silent reinstall would, then advance the
341 // version markers so that startup pass does not repeat it. On failure the
342 // markers stay put, so the next ordinary command retries via the silent
343 // reinstall.
344 //
345 // Migrate first so a configured-but-untracked agent (has_tracedecay true,
346 // absent from `installed_agents`) is picked up and refreshed too — exactly
347 // what the canonical `handle_reinstall_command` does.
348 let mut config = UserConfig::load();
349 if let Some(home) = tracedecay::agents::home_dir() {
350 tracedecay::agents::migrate_installed_agents(&home, &mut config);
351 }
352 // Prune tracked ids that no longer resolve to an integration (a release
353 // renamed/removed one, or a typo landed in `installed_agents`).
354 // `migrate_installed_agents` only ADDS ids, so without this the stale id
355 // would be retried on every command forever. The reinstall pass already
356 // skips such ids, but dropping them here stops the pointless retry churn.
357 let before = config.installed_agents.len();
358 config
359 .installed_agents
360 .retain(|id| tracedecay::agents::get_integration(id).is_ok());
361 if config.installed_agents.len() != before {
362 config.save();
363 }
364 if config.installed_agents.is_empty() {
365 eprintln!("Refreshing agent integrations: nothing to refresh");
366 } else {

Callers 1

dispatch_commandFunction · 0.85

Calls 12

migrate_installed_agentsFunction · 0.85
get_integrationFunction · 0.85
reinstall_tracked_agentsFunction · 0.85
is_okMethod · 0.80
loadFunction · 0.50
home_dirFunction · 0.50
saveMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected