feat: 导入的 skills 默认存到 ~/.ias/skills/

- Import/Delete 目标改为 ~/.ias/skills/(全局共享)
- SkillRegistry::load() 返回 (Self, Vec<String>) 替代 Result
  允许部分加载:格式不兼容的 skill 记录警告但不阻止加载
- 新增 global_skills_dir() 辅助函数
This commit is contained in:
2026-06-02 10:02:54 +08:00
parent e88f3240c4
commit f7ba23db94
13 changed files with 40 additions and 1570 deletions
+2 -9
View File
@@ -22,10 +22,7 @@ impl SkillRegistry {
}
/// 从 system_dir 和 user_dir 加载所有技能
/// system_dir: resources/skills/(随 iAs 分发)
/// user_dir: skills/(用户自行添加)
/// 同名时 user 覆盖 system
pub async fn load(system_dir: &str, user_dir: &str) -> Result<Self, Vec<String>> {
pub async fn load(system_dir: &str, user_dir: &str) -> (Self, Vec<String>) {
let mut registry = Self::new();
let mut errors = Vec::new();
@@ -47,11 +44,7 @@ impl SkillRegistry {
registry.load_from_dir(user_dir, SkillSource::User, &mut errors);
}
if errors.is_empty() {
Ok(registry)
} else {
Err(errors)
}
(registry, errors)
}
fn load_from_dir(&mut self, dir: &str, source: SkillSource, errors: &mut Vec<String>) {