()
| 14 | use tracedecay::user_config::UserConfig; |
| 15 | |
| 16 | pub(crate) fn refresh_generated_plugins() -> tracedecay::errors::Result<()> { |
| 17 | let home = tracedecay_home_dir()?; |
| 18 | let tracedecay_bin = tracedecay_bin_on_path()?; |
| 19 | eprintln!("Refreshing tracedecay-generated plugin artifacts (agent configs are not touched)"); |
| 20 | |
| 21 | // Detection-driven, not `installed_agents`-driven: each integration |
| 22 | // decides whether generated artifacts exist on this machine, so stale |
| 23 | // tracking state can neither skip a real install nor install anywhere new. |
| 24 | let mut refreshed_any = false; |
| 25 | let mut failures: Vec<String> = Vec::new(); |
| 26 | for ag in tracedecay::agents::all_integrations() { |
| 27 | let ctx = tracedecay::agents::InstallContext { |
| 28 | home: home.clone(), |
| 29 | tracedecay_bin: tracedecay_bin.clone(), |
| 30 | tool_permissions: tracedecay::agents::expected_tool_perms(), |
| 31 | profile: None, |
| 32 | project_root: None, |
| 33 | dashboard: true, |
| 34 | }; |
| 35 | match ag.update_plugin(&ctx) { |
| 36 | Ok(tracedecay::agents::UpdatePluginOutcome::Refreshed(paths)) => { |
| 37 | refreshed_any = true; |
| 38 | for path in paths { |
| 39 | eprintln!( |
| 40 | " \x1b[32m✔\x1b[0m {}: refreshed {}", |
| 41 | ag.id(), |
| 42 | path.display() |
| 43 | ); |
| 44 | } |
| 45 | } |
| 46 | Ok(tracedecay::agents::UpdatePluginOutcome::NotInstalled) => {} |
| 47 | // Config-managed integrations (claude, copilot, …) are refreshed by |
| 48 | // the tracked-agent reinstall in `run_post_update_tasks`, so there |
| 49 | // is nothing to do — and nothing to nag about — here. |
| 50 | Ok(tracedecay::agents::UpdatePluginOutcome::ConfigOnly) => {} |
| 51 | Err(e) => failures.push(format!("{}: {e}", ag.id())), |
| 52 | } |
| 53 | } |
| 54 | if !refreshed_any { |
| 55 | eprintln!("No generated plugin installs detected — nothing to update."); |
| 56 | } |
| 57 | if !failures.is_empty() { |
| 58 | return Err(tracedecay::errors::TraceDecayError::Config { |
| 59 | message: format!("update-plugin failed for {}", failures.join("; ")), |
| 60 | }); |
| 61 | } |
| 62 | |
| 63 | Ok(()) |
| 64 | } |
| 65 | |
| 66 | /// Rewrites and restarts the installed daemon service, returning the service |
| 67 | /// path and its socket, or `None` when no service is installed. |
no test coverage detected