feat: implement uninstall functionality for managed artifacts and persist install metadata

This commit is contained in:
stoorps 2026-03-19 23:07:25 +00:00
parent 38f900ad50
commit 842c390260
Signed by: stoorps
SSH key fingerprint: SHA256:AZlPfu9hTu042EGtZElmDQoy+KvMOeShLDan/fYLoNI
11 changed files with 626 additions and 21 deletions

View file

@ -41,6 +41,7 @@ fn registry_round_trips_update_strategy_and_alternates() {
],
}),
metadata: Vec::new(),
install: None,
}],
};
@ -51,3 +52,52 @@ fn registry_round_trips_update_strategy_and_alternates() {
assert_eq!(strategy.preferred.reason, "install-origin-match");
assert_eq!(strategy.alternates.len(), 2);
}
#[test]
fn registry_round_trips_install_metadata() {
let dir = tempdir().unwrap();
let store = RegistryStore::new(dir.path().join("registry.toml"));
let registry = aim_core::registry::model::Registry {
version: 1,
apps: vec![aim_core::domain::app::AppRecord {
stable_id: "t3code".to_owned(),
display_name: "T3 Code".to_owned(),
source_input: Some("pingdotgg/t3code".to_owned()),
source: None,
installed_version: Some("0.0.11".to_owned()),
update_strategy: None,
metadata: Vec::new(),
install: Some(aim_core::domain::app::InstallMetadata {
scope: aim_core::domain::app::InstallScope::User,
payload_path: Some(
"/tmp/install-home/.local/lib/aim/appimages/t3code.AppImage".to_owned(),
),
desktop_entry_path: Some(
"/tmp/install-home/.local/share/applications/aim-t3code.desktop".to_owned(),
),
icon_path: Some(
"/tmp/install-home/.local/share/icons/hicolor/256x256/apps/t3code.png"
.to_owned(),
),
}),
}],
};
store.save(&registry).unwrap();
let loaded = store.load().unwrap();
let install = loaded.apps[0].install.as_ref().unwrap();
assert_eq!(install.scope, aim_core::domain::app::InstallScope::User);
assert_eq!(
install.payload_path.as_deref(),
Some("/tmp/install-home/.local/lib/aim/appimages/t3code.AppImage")
);
assert_eq!(
install.desktop_entry_path.as_deref(),
Some("/tmp/install-home/.local/share/applications/aim-t3code.desktop")
);
assert_eq!(
install.icon_path.as_deref(),
Some("/tmp/install-home/.local/share/icons/hicolor/256x256/apps/t3code.png")
);
}