release: Themiz на Gitea
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Проверка происхождения и свежести проектных навыков без сети.
|
||||
|
||||
Канон навыков хранится в ``.claude/skills``. Каталог ``.agents/skills`` —
|
||||
производное зеркало; его содержимое сверяется тем же преобразованием, что и
|
||||
``sync_prompts``. Этот модуль ничего не скачивает и не исполняет из SKILL.md.
|
||||
Канон навыков хранится в ``.claude/skills``; других копий нет.
|
||||
Этот модуль ничего не скачивает и не исполняет из SKILL.md.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -14,11 +13,8 @@ import subprocess
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
import sync_prompts
|
||||
|
||||
MANIFEST = Path("config/skill-sources.json")
|
||||
CANONICAL = Path(".claude/skills")
|
||||
MIRROR = Path(".agents/skills")
|
||||
ITEM_PREFIX = "skill-doc:"
|
||||
SAFE_NAME = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]*\Z")
|
||||
|
||||
@@ -143,30 +139,21 @@ def _inspect(root: Path, name: str, checked: str) -> dict:
|
||||
provenance="unknown")
|
||||
|
||||
canonical = root / CANONICAL / name / "SKILL.md"
|
||||
mirror = root / MIRROR / name / "SKILL.md"
|
||||
try:
|
||||
parents = (root / ".claude", root / CANONICAL, canonical.parent,
|
||||
root / ".agents", root / MIRROR, mirror.parent)
|
||||
if any(path.is_symlink() for path in parents) or canonical.is_symlink() or mirror.is_symlink():
|
||||
raise ValueError("skill canonical or generated mirror contains a symlink")
|
||||
parents = (root / ".claude", root / CANONICAL, canonical.parent)
|
||||
if any(path.is_symlink() for path in parents) or canonical.is_symlink():
|
||||
raise ValueError("skill canonical tree contains a symlink")
|
||||
raw = canonical.read_bytes()
|
||||
_frontmatter(raw, name)
|
||||
originals = _tree(canonical.parent)
|
||||
mirrored = _tree(mirror.parent)
|
||||
expected = {name: sync_prompts.to_agents(body.decode("utf-8")).encode("utf-8")
|
||||
for name, body in originals.items()}
|
||||
if mirrored != expected:
|
||||
return _item(item_id, "blocked", detail=(
|
||||
"canonical skill and generated mirror differ; local edits preserved"),
|
||||
provenance=kind, canonical_sha256=_tree_sha(originals), mirror_sha256=_tree_sha(mirrored))
|
||||
except (OSError, UnicodeError, ValueError) as exc:
|
||||
return _item(item_id, "blocked", detail=str(exc), provenance=kind)
|
||||
|
||||
return _item(item_id, "current", checked, None,
|
||||
"project-local canonical tree and generated mirror verified; "
|
||||
"project-local canonical tree verified; "
|
||||
"not an upstream release or an authorship claim",
|
||||
_tree_sha(originals), provenance=kind,
|
||||
canonical_sha256=_tree_sha(originals), mirror_sha256=_tree_sha(mirrored),
|
||||
canonical_sha256=_tree_sha(originals),
|
||||
git_revision=_git_revision(root, CANONICAL / name / "SKILL.md", raw))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user