feat(plugin): uninstall + clean upgrade/reinstall of external plugins

Add an Uninstall button on installed external plugin cards that deletes
the package folder (effective next restart — the library stays resident
for the session). Reinstalling or upgrading via the marketplace now
clears any stale native library with a different name before writing the
new one, so the loader always picks the freshly installed binary.

Part of the #100 extensibility epic (phase 2).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-17 15:57:44 +03:00
1 parent eb53e445ab
commit 157412419e
5 files changed
+49

No files matched your search

+10
View File
@@ -76,6 +76,16 @@ pub fn plugins_dir() -> Option<PathBuf> {
Some(p)
}
/// Delete an installed package's folder. It stays loaded for the current
/// session (the library is resident); the removal takes effect on next start.
pub fn uninstall(id: &str) -> Result<(), String> {
let dir = plugins_dir().ok_or("cannot locate the plugins folder")?.join(id);
if dir.is_dir() {
std::fs::remove_dir_all(&dir).map_err(|e| e.to_string())?;
}
Ok(())
}
/// Native dynamic-library extension for the current platform (no dot).
fn lib_extension() -> &'static str {
if cfg!(target_os = "windows") {