Enforce LF-only SKILL.md frontmatter
The contract stated an LF rule the checker only enforced by accident: CRLF on a single line, a lone CR, a Unicode line separator, or CRLF on a delimiter passed. Require LF delimiters and LF-only frontmatter lines, and test each case. Every package in every tag v0.1.0-v0.14.0 still passes. The contract now names the required frontmatter keys and shows runnable check and pack commands. Refs #20 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f872770dc9
commit
45eff20ecb
3 files changed
+38
-10
No files matched your search
+4
-1
@@ -127,10 +127,13 @@ def check_package(path):
|
||||
if set(observed) != set(declared):
|
||||
_fail(f"{path}: missing declared file")
|
||||
skill = _text(observed["SKILL.md"], "SKILL.md")
|
||||
match = re.match(r"\A---\r?\n(.*?)\r?\n---(?:\r?\n|\Z)", skill, re.S)
|
||||
match = re.match(r"\A---\n(.*?)\n---(?:\n|\Z)", skill, re.S)
|
||||
if not match:
|
||||
_fail(f"{path}: invalid SKILL.md frontmatter")
|
||||
frontmatter = match.group(1)
|
||||
# Lines end in LF only: CR, CRLF, or Unicode separators would split differently.
|
||||
if frontmatter.splitlines() != frontmatter.split("\n"):
|
||||
_fail(f"{path}: invalid SKILL.md frontmatter")
|
||||
top_keys = []
|
||||
nested_keys = []
|
||||
in_metadata = False
|
||||
|
||||
Reference in new issue
Block a user