feat(plugins): paramètres projet plugins + attribution skills/tools aux agents — #282 (manifeste accepte contributes.skills IdeA-native multi-harness; store .ideai/project-plugins.json v1: enable plugin par projet + assignments skills/tools par agent; refs + use cases settings/assign/unassign; resolver skills pour idea_skill_read et injection catalogue lancement agent; permissions MCP dynamiques projetées par harness Claude Code/Codex/OpenCode; tombstones uninstall, hot reload recalcule catalogue et marque assignments cassés; frontend: Settings projet Plugins, détail capabilities, attribution agent, catalogue permissions; bump pointeur IdeaSDK 6eb8db3; QA verte: cargo test -p application, project_plugin_settings 3/3, dto_plugins 2/2, structured_launch_d3 26/26, catalogue mcp 7/7, frontend 5 tests ProjectPluginSettings/plugin, npm build frontend)
This commit is contained in:
84
crates/infrastructure/tests/project_plugin_settings.rs
Normal file
84
crates/infrastructure/tests/project_plugin_settings.rs
Normal file
@ -0,0 +1,84 @@
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use domain::{
|
||||
AgentId, AgentPluginAssignments, FileSystem, PluginId, PluginSkillId, PluginSkillRef,
|
||||
ProjectPath, ProjectPluginActivation, ProjectPluginSettings, ProjectPluginSettingsStore,
|
||||
};
|
||||
use infrastructure::{FsProjectPluginSettingsStore, LocalFileSystem};
|
||||
use uuid::Uuid;
|
||||
|
||||
struct TempDir(PathBuf);
|
||||
|
||||
impl TempDir {
|
||||
fn new() -> Self {
|
||||
let path = std::env::temp_dir().join(format!("idea-project-plugins-{}", Uuid::new_v4()));
|
||||
std::fs::create_dir_all(&path).unwrap();
|
||||
Self(path)
|
||||
}
|
||||
|
||||
fn root(&self) -> ProjectPath {
|
||||
ProjectPath::new(self.0.to_string_lossy().into_owned()).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TempDir {
|
||||
fn drop(&mut self) {
|
||||
let _ = std::fs::remove_dir_all(&self.0);
|
||||
}
|
||||
}
|
||||
|
||||
fn store() -> FsProjectPluginSettingsStore {
|
||||
let fs: Arc<dyn FileSystem> = Arc::new(LocalFileSystem::new());
|
||||
FsProjectPluginSettingsStore::new(fs)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn missing_document_returns_version_one_defaults() {
|
||||
let tmp = TempDir::new();
|
||||
let settings = store().load(&tmp.root()).await.unwrap();
|
||||
assert_eq!(settings, ProjectPluginSettings::default());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn settings_round_trip_under_project_ideai_directory() {
|
||||
let tmp = TempDir::new();
|
||||
let plugin_id = PluginId::new("dev.acme.tools").unwrap();
|
||||
let agent_id = AgentId::from_uuid(Uuid::from_u128(42));
|
||||
let settings = ProjectPluginSettings {
|
||||
version: 1,
|
||||
plugins: vec![ProjectPluginActivation {
|
||||
plugin_id: plugin_id.clone(),
|
||||
enabled: true,
|
||||
}],
|
||||
agents: vec![AgentPluginAssignments {
|
||||
agent_id,
|
||||
skills: vec![PluginSkillRef {
|
||||
plugin_id,
|
||||
skill_id: PluginSkillId::new("build-debug").unwrap(),
|
||||
}],
|
||||
tools: Vec::new(),
|
||||
}],
|
||||
};
|
||||
|
||||
store().save(&tmp.root(), &settings).await.unwrap();
|
||||
|
||||
assert_eq!(store().load(&tmp.root()).await.unwrap(), settings);
|
||||
assert!(tmp.0.join(".ideai/project-plugins.json").is_file());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unsupported_document_version_is_rejected() {
|
||||
let tmp = TempDir::new();
|
||||
std::fs::create_dir_all(tmp.0.join(".ideai")).unwrap();
|
||||
std::fs::write(
|
||||
tmp.0.join(".ideai/project-plugins.json"),
|
||||
br#"{"version":2,"plugins":[],"agents":[]}"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let error = store().load(&tmp.root()).await.unwrap_err();
|
||||
assert!(error
|
||||
.to_string()
|
||||
.contains("unsupported project plugin settings version 2"));
|
||||
}
|
||||
Reference in New Issue
Block a user