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

Method update_plugin

src/agents/claude.rs:134–170  ·  view source on GitHub ↗
(&self, ctx: &InstallContext)

Source from the content-addressed store, hash-verified

132 }
133
134 fn update_plugin(&self, ctx: &InstallContext) -> Result<UpdatePluginOutcome> {
135 let claude_dir = ctx.home.join(".claude");
136 let settings_path = claude_dir.join("settings.json");
137 let claude_md_path = claude_dir.join("CLAUDE.md");
138
139 if !plugin_marketplace_manifest_path(&ctx.home).exists()
140 && !has_config_managed_leftovers(&ctx.home)
141 {
142 return Ok(UpdatePluginOutcome::NotInstalled);
143 }
144
145 // Redeploy the bundle at the current version, refresh the marketplace
146 // path, ensure enablement, and re-run migration.
147 let deploy_dir = deploy_plugin_bundle(&ctx.home, &ctx.tracedecay_bin)?;
148 register_marketplace(&ctx.home, &deploy_dir)?;
149
150 let mut settings = load_json_file_strict(&settings_path)?;
151 enable_plugin(&mut settings);
152 // Write/refresh the plugin-namespace permission allowlist (and migrate
153 // legacy `mcp__tracedecay__*` entries to their plugin twins) so an
154 // `update-plugin` from an older install stops prompting on every tool
155 // call. Idempotent.
156 install_permissions(&mut settings, &ctx.tool_permissions);
157 write_json_file(&settings_path, &settings)?;
158
159 migrate_off_config_managed(&ctx.home);
160
161 // Refresh the managed CLAUDE.md steering block so an `update-plugin`
162 // rewrites a stale block to the current moment-trigger text. The block
163 // reaches subagents (they load the project/user CLAUDE.md), so keeping
164 // it current is how updated steering actually propagates.
165 install_claude_md_rules(&claude_md_path)?;
166
167 sync_claude_plugin_cache(&ctx.home);
168
169 Ok(UpdatePluginOutcome::Refreshed(vec![deploy_dir]))
170 }
171
172 fn healthcheck(&self, dc: &mut DoctorCounters, ctx: &HealthcheckContext) {
173 eprintln!("\n\x1b[1mClaude Code integration\x1b[0m");

Callers

nothing calls this directly

Calls 12

deploy_plugin_bundleFunction · 0.85
register_marketplaceFunction · 0.85
load_json_file_strictFunction · 0.85
install_permissionsFunction · 0.85
write_json_fileFunction · 0.85
install_claude_md_rulesFunction · 0.85
sync_claude_plugin_cacheFunction · 0.85
existsMethod · 0.80
enable_pluginFunction · 0.70

Tested by

no test coverage detected