Write a single ClawShell-managed skill bundle into ` /.hermes/skills/ /` and chown the result to the invoking user.
(
skill: onboard::OnboardSkillBundle,
home_dir: &Path,
uid: u32,
gid: u32,
)
| 230 | /// `<home>/.hermes/skills/<skill_name>/` and chown the result to the |
| 231 | /// invoking user. |
| 232 | fn write_hermes_skill_bundle( |
| 233 | skill: onboard::OnboardSkillBundle, |
| 234 | home_dir: &Path, |
| 235 | uid: u32, |
| 236 | gid: u32, |
| 237 | ) -> Result<PathBuf, Box<dyn Error>> { |
| 238 | let skill_dir = home_dir.join(".hermes").join("skills").join(skill.name); |
| 239 | std::fs::create_dir_all(&skill_dir)?; |
| 240 | |
| 241 | for file in skill.files { |
| 242 | let path = skill_dir.join(file.relative_path); |
| 243 | if let Some(parent) = path.parent() { |
| 244 | std::fs::create_dir_all(parent)?; |
| 245 | } |
| 246 | std::fs::write(&path, &file.content)?; |
| 247 | } |
| 248 | |
| 249 | // Chown the skill dir (and contents) to the invoking user so Hermes — |
| 250 | // which runs as that user, not root — can read them. |
| 251 | let owner_spec = format!("{uid}:{gid}"); |
| 252 | if let Err(error) = chown_path(&skill_dir, &owner_spec, true) { |
| 253 | warn!( |
| 254 | error = %error, |
| 255 | path = %skill_dir.display(), |
| 256 | "Failed to chown Hermes skill dir to invoking user" |
| 257 | ); |
| 258 | } |
| 259 | |
| 260 | Ok(skill_dir) |
| 261 | } |
| 262 | |
| 263 | /// Write every ClawShell-managed skill that applies to this onboarding |
| 264 | /// run into `~/.hermes/skills/`. The stats skill is always written; the |
no test coverage detected