Files
repoctl/tests/test_distributed_artifacts.py
T
Alexander BaranovandClaude Opus 5 79ea43d5bf fix(skills): sync the distributed adoption skill and pin it to the repo copy
`init` writes .claude/skills/*/SKILL.md into every new repository from the
constants in skills_content, so each skill exists twice: once as the copy
this repository uses, once as the copy it ships. Editing one and not the
other went unnoticed by validate and by every test.

It had already happened. The shipped repository-adoption skill still told
its reader to use `--strategy normalize --recipe documents-to-content-root`
-- an operation the CLI does not offer and CLAUDE.md forbids claiming --
and said nothing about the owner requirement or acknowledged findings.
Every repository bootstrapped since would have received that copy.

Sync both, and add a test that compares each shipped skill against the
checked-in one so the next divergence fails instead of shipping.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 18:11:13 +03:00

45 lines
1.7 KiB
Python

"""The skills this repository ships must match the skills it uses.
`init` writes `.claude/skills/*/SKILL.md` into every new repository from the
constants in `skills_content`, so those constants are a distributed artifact
with a second copy checked in here. Editing one and not the other shipped a
stale skill into every repository created afterwards -- silently, because
neither `validate` nor any other test compared them.
"""
from __future__ import annotations
from pathlib import Path
import pytest
from stewardship import skills_content
REPO_ROOT = Path(__file__).resolve().parents[1]
DISTRIBUTED = {
"repository-bootstrap": skills_content.REPOSITORY_BOOTSTRAP_SKILL,
"repository-adoption": skills_content.REPOSITORY_ADOPTION_SKILL,
"repo-handoff": skills_content.REPO_HANDOFF_SKILL,
}
@pytest.mark.parametrize("name", sorted(DISTRIBUTED))
def test_shipped_skill_matches_the_one_in_this_repository(name: str) -> None:
on_disk = (REPO_ROOT / ".claude" / "skills" / name / "SKILL.md").read_text(encoding="utf-8")
assert on_disk.strip() == DISTRIBUTED[name].strip(), (
f"{name}: .claude/skills/{name}/SKILL.md and skills_content.py have diverged. "
"Update both, or the next `repoctl init` ships the stale one."
)
def test_adoption_skill_does_not_offer_normalization() -> None:
"""CLAUDE.md: do not describe an operation the CLI does not offer.
The skill may name `--strategy normalize` in order to say it is unavailable;
what it must never do is instruct someone to use it.
"""
text = skills_content.REPOSITORY_ADOPTION_SKILL
assert "Only use `--strategy normalize" not in text
assert "not implemented" in text