mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-04-25 11:18:22 +00:00
* fix(skills): validate bundled SKILL.md front-matter in CI (fixes #2443) Adds a parametrized backend test that runs `_validate_skill_frontmatter` against every bundled SKILL.md under `skills/public/`, so a broken front-matter fails CI with a per-skill error message instead of surfacing as a runtime gateway-load warning. The new test caught two pre-existing breakages on `main` and fixes them: * `bootstrap/SKILL.md`: the unquoted description had a second `:` mid-line ("Also trigger for updates: ..."), which YAML parses as a nested mapping ("mapping values are not allowed here"). Rewrites the description as a folded scalar (`>-`), which preserves the original wording (including the embedded colon, double quotes, and apostrophes) without further escaping. This complements PR #2436 (single-file colon→hyphen patch) with a more general convention that survives future edits. * `chart-visualization/SKILL.md`: used `dependency:` which is not in `ALLOWED_FRONTMATTER_PROPERTIES`. Renamed to `compatibility:`, the documented field for "Required tools, dependencies" per skill-creator. No code reads `dependency` (verified by grep across backend/). * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix the lint error --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
"""Validate every bundled SKILL.md under skills/public/.
|
|
|
|
Catches regressions like #2443 — a SKILL.md whose YAML front-matter fails to
|
|
parse (e.g. an unquoted description containing a colon, which YAML interprets
|
|
as a nested mapping). Each bundled skill is checked individually so the
|
|
failure message identifies the exact file.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from deerflow.skills.validation import _validate_skill_frontmatter
|
|
|
|
SKILLS_PUBLIC_DIR = Path(__file__).resolve().parents[2] / "skills" / "public"
|
|
BUNDLED_SKILL_DIRS = sorted(p.parent for p in SKILLS_PUBLIC_DIR.rglob("SKILL.md"))
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"skill_dir",
|
|
BUNDLED_SKILL_DIRS,
|
|
ids=lambda p: str(p.relative_to(SKILLS_PUBLIC_DIR)),
|
|
)
|
|
def test_bundled_skill_frontmatter_is_valid(skill_dir: Path) -> None:
|
|
valid, msg, name = _validate_skill_frontmatter(skill_dir)
|
|
assert valid, f"{skill_dir.relative_to(SKILLS_PUBLIC_DIR)}: {msg}"
|
|
assert name, f"{skill_dir.relative_to(SKILLS_PUBLIC_DIR)}: no name extracted"
|
|
|
|
|
|
def test_skills_public_dir_has_skills() -> None:
|
|
assert BUNDLED_SKILL_DIRS, f"no SKILL.md found under {SKILLS_PUBLIC_DIR}"
|