(&self, ctx: &InstallContext)
| 86 | } |
| 87 | |
| 88 | fn update_plugin(&self, ctx: &InstallContext) -> Result<UpdatePluginOutcome> { |
| 89 | let cached_dirs = codex_plugin_cached_install_dirs(&ctx.home); |
| 90 | let plugin_dir = codex_plugin_install_dir(&ctx.home); |
| 91 | let legacy_config_install = codex_legacy_config_has_tracedecay(&ctx.home); |
| 92 | let mut refreshed = Vec::new(); |
| 93 | if !cached_dirs.is_empty() { |
| 94 | let target = install_codex_cached_plugin(&ctx.home, &ctx.tracedecay_bin)?; |
| 95 | refreshed.push(target); |
| 96 | refreshed.push(install_codex_personal_bootstrap( |
| 97 | &ctx.home, |
| 98 | &ctx.tracedecay_bin, |
| 99 | )?); |
| 100 | } |
| 101 | |
| 102 | if let Some(project_path) = codex_update_project_path(ctx) { |
| 103 | let repo_dir = codex_repo_plugin_install_dir(&project_path); |
| 104 | if repo_dir.join(".codex-plugin/plugin.json").exists() |
| 105 | && codex_plugin_dir_is_tracedecay(&repo_dir) |
| 106 | { |
| 107 | install_codex_plugin_bundle( |
| 108 | &repo_dir, |
| 109 | &ctx.tracedecay_bin, |
| 110 | InstallScope::ProjectLocal, |
| 111 | &ctx.home, |
| 112 | )?; |
| 113 | install_codex_marketplace_entry( |
| 114 | &codex_repo_marketplace_path(&project_path), |
| 115 | "local-repo", |
| 116 | "Local Repo", |
| 117 | "./plugins/tracedecay", |
| 118 | )?; |
| 119 | refreshed.push(repo_dir); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | // A legacy config-managed install must gain its personal-bundle |
| 124 | // replacement before the sweep below strips the working global |
| 125 | // config — even when a cached or repo-local refresh already put |
| 126 | // something into `refreshed`. |
| 127 | let has_personal_bundle = |
| 128 | !cached_dirs.is_empty() || codex_plugin_manifest_path(&ctx.home).exists(); |
| 129 | if refreshed.is_empty() && !has_personal_bundle && !legacy_config_install { |
| 130 | return Ok(UpdatePluginOutcome::NotInstalled); |
| 131 | } |
| 132 | if refreshed.is_empty() || (legacy_config_install && !has_personal_bundle) { |
| 133 | install_codex_personal_bootstrap(&ctx.home, &ctx.tracedecay_bin)?; |
| 134 | refreshed.push(plugin_dir.clone()); |
| 135 | } |
| 136 | |
| 137 | if legacy_config_install { |
| 138 | sweep_legacy_global_codex_config(&ctx.home); |
| 139 | eprintln!( |
| 140 | "\x1b[1mAction required:\x1b[0m migrated the legacy Codex config-managed \ |
| 141 | install to the personal plugin bundle." |
| 142 | ); |
| 143 | eprintln!(" In Codex, run: codex plugin add tracedecay@personal"); |
| 144 | print_hook_trust_guidance(); |
| 145 | } |
nothing calls this directly
no test coverage detected