skills: drop ~/.agent/skills; add project .agents/skills
This commit is contained in:
1 parent
5b056984bf
commit
1a41e71adc
3 files changed
+17
-9
No files matched your search
@@ -42,16 +42,18 @@ pub struct Skill {
|
||||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
/// Skill dirs, lowest priority first: `~/.agent/skills` and `~/.agents/skills` (shared with other
|
||||
/// agents), `<hx home>/skills`, `<project>/.hx/skills`.
|
||||
/// Skill dirs, lowest priority first: `~/.agents/skills` (shared with other agents), `<hx home>/skills`,
|
||||
/// `<project>/.agents/skills`, `<project>/.hx/skills`.
|
||||
pub fn skill_dirs(home: &Path, cwd: &Path) -> Vec<PathBuf> {
|
||||
let mut v: Vec<PathBuf> = std::env::var_os("HOME")
|
||||
.map(PathBuf::from)
|
||||
.map(|h| PathBuf::from(h).join(".agents/skills"))
|
||||
.into_iter()
|
||||
.flat_map(|h| [h.join(".agent/skills"), h.join(".agents/skills")])
|
||||
.collect();
|
||||
v.push(home.join("skills"));
|
||||
v.push(cwd.join(".hx/skills"));
|
||||
v.extend([
|
||||
home.join("skills"),
|
||||
cwd.join(".agents/skills"),
|
||||
cwd.join(".hx/skills"),
|
||||
]);
|
||||
v
|
||||
}
|
||||
|
||||
@@ -190,7 +192,10 @@ mod tests {
|
||||
.collect();
|
||||
assert_eq!(got, [("a", "shared"), ("g", "hx-g")]);
|
||||
let d = skill_dirs(Path::new("/h"), Path::new("/p"));
|
||||
assert!(d[0].ends_with(".agent/skills") && d[1].ends_with(".agents/skills"));
|
||||
assert!(d[2] == Path::new("/h/skills") && d[3] == Path::new("/p/.hx/skills"));
|
||||
assert!(d[0].ends_with(".agents/skills"));
|
||||
assert_eq!(
|
||||
d[1..],
|
||||
["/h/skills", "/p/.agents/skills", "/p/.hx/skills"].map(PathBuf::from)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user