Deploy every embedded bundle file into the stable marketplace dir, stamping the plugin version and substituting the tracedecay binary path. Returns the deploy dir.
(home: &Path, tracedecay_bin: &str)
| 306 | /// stamping the plugin version and substituting the tracedecay binary path. |
| 307 | /// Returns the deploy dir. |
| 308 | fn deploy_plugin_bundle(home: &Path, tracedecay_bin: &str) -> Result<PathBuf> { |
| 309 | let deploy_dir = plugin_deploy_dir(home); |
| 310 | // Clean-replace: wipe the tracedecay-owned deploy dir before writing the |
| 311 | // fresh bundle, so a file the bundle no longer ships (e.g. a retired skill |
| 312 | // dir) does not linger across upgrades. Only remove a directory we |
| 313 | // exclusively own — confirmed by the deployed marketplace/plugin manifest |
| 314 | // naming tracedecay — so an unrelated dir squatting on the path is never |
| 315 | // nuked. |
| 316 | clean_replace_owned_deploy_dir(&deploy_dir)?; |
| 317 | for (relative, contents) in claude_embedded_plugin_files() { |
| 318 | let rendered = render_plugin_file(relative, contents, tracedecay_bin)?; |
| 319 | safe_write_text_file(&deploy_dir.join(relative), &rendered, None)?; |
| 320 | } |
| 321 | eprintln!( |
| 322 | "\x1b[32m✔\x1b[0m Deployed tracedecay plugin bundle to {}", |
| 323 | deploy_dir.display() |
| 324 | ); |
| 325 | Ok(deploy_dir) |
| 326 | } |
| 327 | |
| 328 | /// True when a deployed marketplace dir is tracedecay-owned: its plugin or |
| 329 | /// marketplace manifest names the tracedecay plugin. A fresh (missing) dir is |