The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(profile_distribution): an owned skill category with a README.md keeps installer-added skills
kshitijk4poor77c7f8e849cd
diff --git a/hermes_cli/profile_distribution.py b/hermes_cli/profile_distribution.pyindex 8c231982cb0..3f392108c15 100644--- a/hermes_cli/profile_distribution.py+++ b/hermes_cli/profile_distribution.py@@ -441,11 +441,15 @@ def _refuse_symlink(path: Path) -> None:)-def _is_container(path: Path) -> bool:- """A shipped directory holding no files other than its DESCRIPTION.md and dotfiles- (``.DS_Store``, ``.gitkeep``) is a container of roots (a skills category), not a root- itself; a skill dir always holds SKILL.md."""- return path.is_dir() and not any(+def _is_container(path: Path, rel: Tuple[str, ...]) -> bool:+ """A container of roots, not a root itself. Under ``skills/`` that is any dir without+ SKILL.md (a category, whatever metadata it ships: DESCRIPTION.md, README.md, LICENSE);+ elsewhere, a dir holding no files other than DESCRIPTION.md and dotfiles."""+ if not path.is_dir():+ return False+ if rel[0] == "skills":+ return not (path / "SKILL.md").is_file()+ return not any(p.is_file() and p.name != "DESCRIPTION.md" and not p.name.startswith(".") for p in path.iterdir())@@ -458,7 +462,7 @@ def _merge_dir(src: Path, dest: Path, rel: Tuple[str, ...]) -> None:continueif parts == _CRON_STORE_REL:continue # merged up front by _copy_dist_payload- if _is_container(child):+ if _is_container(child, parts):_merge_dir(child, _real_dir(dest, (child.name,)), parts)else:_replace_entry(child, dest / child.name)@@ -469,7 +473,7 @@ def _refuse_symlinked_containers(src: Path, dest: Path, rel: Tuple[str, ...]) ->parts = (*rel, child.name)if _is_distribution_runtime_path(parts):continue- if _is_container(child):+ if _is_container(child, parts):_refuse_symlink(dest / child.name)_refuse_symlinked_containers(child, dest / child.name, parts)@@ -480,7 +484,7 @@ def _merges_per_root(src: Path, rel_parts: Tuple[str, ...]) -> bool:added to it (``hermes skills install`` and agent-created skills land in``skills/<category>/``) survive. The pre-write symlink guard and the copy loop bothuse this, so the guard covers exactly what the copy merges."""- return src.is_dir() and (len(rel_parts) == 1 or _is_container(src))+ return src.is_dir() and (len(rel_parts) == 1 or _is_container(src, rel_parts))def _refuse_symlinked_targets(target: Path, entries) -> None:diff --git a/tests/hermes_cli/test_profile_distribution.py b/tests/hermes_cli/test_profile_distribution.pyindex 9c9dd70221f..8f3f45ee0fd 100644--- a/tests/hermes_cli/test_profile_distribution.py+++ b/tests/hermes_cli/test_profile_distribution.py@@ -489,6 +489,8 @@ class TestUpdate:(staged / "skills" / "research" / "web-search" / "SKILL.md").write_text("author v2\n", encoding="utf-8")(staged / "skills" / "research" / "arxiv").mkdir()(staged / "skills" / "research" / "arxiv" / "SKILL.md").write_text("new author skill\n", encoding="utf-8")+ # Category metadata beyond DESCRIPTION.md must not turn the category into a root.+ (staged / "skills" / "research" / "README.md").write_text("about research\n", encoding="utf-8")update_distribution("rb")@@ -497,6 +499,7 @@ class TestUpdate:assert not (research / "web-search" / "stale.txt").exists() # an owned root is still replaced wholeassert (research / "arxiv" / "SKILL.md").exists()assert (research / "DESCRIPTION.md").read_text(encoding="utf-8") == "research skills\n"+ assert (research / "README.md").read_text(encoding="utf-8") == "about research\n"def test_an_owned_category_refuses_a_symlinked_subcategory_before_writing(self, profile_env, tmp_path):staged, plan = self._owned_category(profile_env, "rb")