Answer stability round 1: 0 🔴, 1 🟡 (0 misread); link only folders holding a SKILL.md, so a synced/ or .trash/ that 0.18.0 let Claude Code write into the clone is never linked back, with prose round 1's comment wording in home.py
This commit is contained in:
@@ -15,7 +15,7 @@ from text_files.file_writes import replace_file
|
||||
|
||||
# What the home links to in the clone: the instruction files Claude Code reads from its home, and the two folders those files name beside them. So a claude opens each file of the setup that they name in its own home: the setup's CLAUDE.md → "Vocabulary", "setup".
|
||||
LINKED = ("CLAUDE.md", "agents", "bin", "principles", "rules")
|
||||
# The folder of skills, a folder of the home's own that holds a link to each of the clone's skills: Claude Code writes in it, such as the signed-in account's skills at sign-in, and a whole link would carry those writes into the clone.
|
||||
# A folder of the home's own: Claude Code writes in it, such as the signed-in account's skills at sign-in, and a link to the whole folder would carry those writes into the clone.
|
||||
SKILLS = "skills"
|
||||
# Stands for the clone's folder in the clone's settings.json. Every value that holds it is a shell command, such as a hook's.
|
||||
CLONE = "{clone}"
|
||||
@@ -103,13 +103,14 @@ def linked(home: pathlib.Path, clone: pathlib.Path) -> Failure | None:
|
||||
if skills.is_symlink():
|
||||
skills.unlink()
|
||||
skills.mkdir(exist_ok=True)
|
||||
# Only links are replaced, so a skill the clone dropped loses its own, and what Claude Code wrote here stays.
|
||||
# Only links are replaced, so a skill the clone dropped loses its link, and what Claude Code wrote here stays.
|
||||
for entry in skills.iterdir():
|
||||
if entry.is_symlink():
|
||||
entry.unlink()
|
||||
# A clone without skills, as a test's may be, links none, as a whole link to a missing folder linked none.
|
||||
# A skill is a folder that holds a SKILL.md, so the `synced/` and `.trash/` that a release before 0.18.1 let Claude Code write into the clone stay unlinked. A clone without skills/, as a test's may be, leaves the folder empty.
|
||||
for skill in sorted((clone / SKILLS).iterdir()) if (clone / SKILLS).is_dir() else []:
|
||||
(skills / skill.name).symlink_to(skill)
|
||||
if (skill / "SKILL.md").is_file():
|
||||
(skills / skill.name).symlink_to(skill)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ class Home(unittest.TestCase):
|
||||
self.clone = self.temp / "the clone"
|
||||
for folder in ("agents", "bin", "principles", "rules", "skills/larv-review", "skills/comprehension-panel"):
|
||||
(self.clone / folder).mkdir(parents=True)
|
||||
for skill in ("larv-review", "comprehension-panel"):
|
||||
(self.clone / "skills" / skill / "SKILL.md").write_text(f"# {skill}\n", encoding="utf-8")
|
||||
(self.clone / "CLAUDE.md").write_text("# The setup's rules\n", encoding="utf-8")
|
||||
(self.clone / "settings.json").write_text(json.dumps(SETTINGS), encoding="utf-8")
|
||||
self.home = self.temp / "share" / "claude-home"
|
||||
@@ -89,6 +91,19 @@ class Home(unittest.TestCase):
|
||||
self.assertFalse((self.home / "skills").is_symlink())
|
||||
self.assertEqual((self.home / "skills" / "comprehension-panel").resolve(), (self.clone / "skills" / "comprehension-panel").resolve())
|
||||
|
||||
def test_what_an_older_release_let_claude_code_write_into_the_clones_skills_is_not_linked_as_a_skill(self) -> None:
|
||||
for leftover in ("synced/account/docx", ".trash/1-docx"):
|
||||
(self.clone / "skills" / leftover).mkdir(parents=True)
|
||||
(self.clone / "skills" / leftover / "SKILL.md").write_text("an account's skill\n", encoding="utf-8")
|
||||
signed_in = self.home / "skills" / "synced" / "account" / "pdf" / "SKILL.md"
|
||||
signed_in.parent.mkdir(parents=True)
|
||||
signed_in.write_text("an account's skill\n", encoding="utf-8")
|
||||
|
||||
self.assertIsNone(self.unready())
|
||||
|
||||
self.assertEqual(sorted(entry.name for entry in (self.home / "skills").iterdir() if entry.is_symlink()), ["comprehension-panel", "larv-review"])
|
||||
self.assertEqual(signed_in.read_text(encoding="utf-8"), "an account's skill\n")
|
||||
|
||||
def test_a_clone_without_skills_builds_a_home_with_an_empty_skills_folder(self) -> None:
|
||||
subprocess.run(["rm", "-r", str(self.clone / "skills")], check=True)
|
||||
|
||||
@@ -98,7 +113,7 @@ class Home(unittest.TestCase):
|
||||
|
||||
def test_a_skill_the_clone_dropped_loses_its_link_at_the_next_refresh(self) -> None:
|
||||
self.assertIsNone(self.unready())
|
||||
(self.clone / "skills" / "comprehension-panel").rmdir()
|
||||
subprocess.run(["rm", "-r", str(self.clone / "skills" / "comprehension-panel")], check=True)
|
||||
self.commit = "4d5e6f\n"
|
||||
|
||||
self.assertIsNone(self.unready())
|
||||
|
||||
Reference in New Issue
Block a user