fix(lint): exempt meta-skills from lineage/source checks

The compare-masters skill is an aggregate meta-skill that borrows from
other masters and has no single lineage, dates, sources, or own corpus
directories. Treating it as a regular master made --strict CI fail on
all branches since 2026-04-08.

Introduce a kind field (default master) and skip the lineage/dates/
sources/citation_format and references/sources directory checks when
kind == meta-skill. compare/SKILL.md gains kind: meta-skill.

Required fields (name, description) and version/license are still
enforced for all skills.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xr843
2026-04-11 09:18:59 +08:00
parent 38e7eb09dd
commit a0c367c058
2 changed files with 21 additions and 13 deletions
+20 -13
View File
@@ -24,6 +24,8 @@ PREBUILT_DIR = Path(__file__).resolve().parent.parent / "prebuilt"
REQUIRED_FIELDS = {"name", "description"}
RECOMMENDED_FIELDS = {"version", "license", "lineage", "dates", "sources", "citation_format"}
# Fields not applicable to meta-skills (aggregate/comparison skills with no single lineage)
META_SKILL_EXCLUDED = {"lineage", "dates", "sources", "citation_format"}
MAX_DESCRIPTION_CHARS = 500
MAX_SKILL_LINES = 500
@@ -104,7 +106,10 @@ def lint_master(master_dir: Path, strict: bool = False) -> list[str]:
issues.append(f"[ERROR] {name}: missing required field '{field}'")
# --- Recommended fields ---
kind = fm.get("kind", "master")
for field in RECOMMENDED_FIELDS:
if kind == "meta-skill" and field in META_SKILL_EXCLUDED:
continue
if field not in fm:
issues.append(f"[WARN] {name}: missing recommended field '{field}'")
@@ -126,21 +131,23 @@ def lint_master(master_dir: Path, strict: bool = False) -> list[str]:
issues.append(f"[WARN] {name}: sources[{i}] missing 'title' or 'cbeta_id'")
# --- Directory structure checks ---
refs_dir = master_dir / "references"
sources_dir = master_dir / "sources"
# Meta-skills (e.g. compare-masters) borrow from other masters and have no own corpus
if kind != "meta-skill":
refs_dir = master_dir / "references"
sources_dir = master_dir / "sources"
if not refs_dir.exists():
issues.append(f"[WARN] {name}: missing references/ directory")
else:
if not (refs_dir / "voice.md").exists():
issues.append(f"[WARN] {name}: missing references/voice.md")
if not (refs_dir / "teaching.md").exists():
issues.append(f"[WARN] {name}: missing references/teaching.md")
if not refs_dir.exists():
issues.append(f"[WARN] {name}: missing references/ directory")
else:
if not (refs_dir / "voice.md").exists():
issues.append(f"[WARN] {name}: missing references/voice.md")
if not (refs_dir / "teaching.md").exists():
issues.append(f"[WARN] {name}: missing references/teaching.md")
if not sources_dir.exists():
issues.append(f"[WARN] {name}: missing sources/ directory")
elif not list(sources_dir.glob("*.md")):
issues.append(f"[WARN] {name}: sources/ directory is empty")
if not sources_dir.exists():
issues.append(f"[WARN] {name}: missing sources/ directory")
elif not list(sources_dir.glob("*.md")):
issues.append(f"[WARN] {name}: sources/ directory is empty")
# --- Check for tests ---
tests_dir = master_dir / "tests"