- 1
#![allow(clippy::unwrap_used, clippy::expect_used)] - 2
- 3
//! Retired-plugin cleanup during seeding. It writes the Shared layer, which - 4
//! every `Core::new` reads, so it runs in a binary of its own. - 5
- 6
use vak_plugin::{InstallOptions, InstallScope, PluginStore}; - 7
- 8
#[test] - 9
fn a_retired_shared_plugin_is_removed_and_its_shared_grant_pruned() { - 10
let _home = vak_config::paths::isolate_home_for_tests(); - 11
let root = vak_config::paths::default_workspace().join(".vak"); - 12
let staging = tempfile::tempdir().unwrap(); - 13
let package = staging.path().join("legacy-eval"); - 14
std::fs::create_dir_all(package.join("skills/legacy")).unwrap(); - 15
std::fs::write( - 16
package.join("vak-plugin.json"), - 17
r#"{"schema":1,"name":"legacy-eval","version":"1.0.0","description":"Old.","license":"MIT","components":{"skills":["skills"]}}"#, - 18
) - 19
.unwrap(); - 20
std::fs::write( - 21
package.join("skills/legacy/SKILL.md"), - 22
"---\nname: legacy\ndescription: Old.\n---\n\nCall `python_eval`.\n", - 23
) - 24
.unwrap(); - 25
PluginStore::new(&root) - 26
.install_local( - 27
&package, - 28
InstallOptions { - 29
scope: InstallScope::User, - 30
allow_unlicensed: false, - 31
}, - 32
) - 33
.unwrap(); - 34
let global = vak_config::global_path().unwrap(); - 35
std::fs::write( - 36
&global, - 37
"[plugins]\nnetwork_allow = [\"legacy-eval\", \"kept\"]\n", - 38
) - 39
.unwrap(); - 40
- 41
vak_core::seed::seed_shared_capabilities().expect("cleanup succeeds"); - 42
- 43
assert!( - 44
!PluginStore::new(&root) - 45
.list() - 46
.unwrap() - 47
.iter() - 48
.any(|plugin| plugin.name == "legacy-eval") - 49
); - 50
let config: toml::Value = toml::from_str(&std::fs::read_to_string(&global).unwrap()).unwrap(); - 51
assert_eq!( - 52
config["plugins"]["network_allow"], - 53
toml::Value::Array(vec!["kept".into()]) - 54
); - 55
} - 56
Indexing the workspace…
Vakyartha documentation is discovering safe artifacts, anchors, and source references.