State the frontmatter line-break rule exactly
Name the separators the checker rejects and the end-of-file closing delimiter it accepts, and show that the rule stops at the frontmatter: a CRLF body and a frontmatter-only file still pass. Split frontmatter lines once and assert the exact rejection reason. Refs #20 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
45eff20ecb
commit
da34e1c1bf
3 files changed
+25
-10
No files matched your search
+7
-6
@@ -131,13 +131,14 @@ def check_package(path):
|
||||
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"):
|
||||
lines = frontmatter.split("\n")
|
||||
# LF is the only line break: CR, CRLF, and other separators split differently.
|
||||
if frontmatter.splitlines() != lines:
|
||||
_fail(f"{path}: invalid SKILL.md frontmatter")
|
||||
top_keys = []
|
||||
nested_keys = []
|
||||
in_metadata = False
|
||||
for line in frontmatter.splitlines():
|
||||
for line in lines:
|
||||
if line.startswith(" "):
|
||||
if not in_metadata or not re.fullmatch(r" [a-z-]+: .+", line):
|
||||
_fail(f"{path}: unsupported skill metadata")
|
||||
@@ -147,14 +148,14 @@ def check_package(path):
|
||||
top_keys.append(key)
|
||||
in_metadata = key == "metadata"
|
||||
# metadata stands alone; every other key carries an inline value.
|
||||
valid_line = line == "metadata:" if in_metadata else re.fullmatch(r"[a-z-]+: .+", line)
|
||||
valid_line = line == "metadata:" if in_metadata else bool(re.fullmatch(r"[a-z-]+: .+", line))
|
||||
if not valid_line:
|
||||
_fail(f"{path}: unsupported skill metadata")
|
||||
else:
|
||||
_fail(f"{path}: unsupported skill metadata")
|
||||
if len(top_keys) != len(set(top_keys)) or set(top_keys) - {"name", "description", "metadata", "disable-model-invocation"} or len(nested_keys) != len(set(nested_keys)) or set(nested_keys) != {"relayview-display-name", "relayview-version"}:
|
||||
_fail(f"{path}: unsupported skill metadata")
|
||||
values = dict(line.split(": ", 1) for line in frontmatter.splitlines() if not line.startswith(" ") and ": " in line)
|
||||
values = dict(line.split(": ", 1) for line in lines if not line.startswith(" ") and ": " in line)
|
||||
if "disable-model-invocation" in values and values["disable-model-invocation"] not in ("true", "false"):
|
||||
_fail(f"{path}: disable-model-invocation must be a boolean")
|
||||
expected_name = path.name
|
||||
@@ -162,7 +163,7 @@ def check_package(path):
|
||||
_fail(f"{path}: missing or incompatible skill metadata")
|
||||
if not re.fullmatch(r"[a-z0-9]+(?:-[a-z0-9]+)*", expected_name) or len(expected_name) > 64 or len(values["description"]) > 1024:
|
||||
_fail(f"{path}: skill name or description exceeds owner bounds")
|
||||
display_name = next(line.split(": ", 1)[1] for line in frontmatter.splitlines() if line.startswith(" relayview-display-name: "))
|
||||
display_name = next(line.split(": ", 1)[1] for line in lines if line.startswith(" relayview-display-name: "))
|
||||
if len(display_name) > 128:
|
||||
_fail(f"{path}: display name exceeds owner bounds")
|
||||
digest = hashlib.sha256(b"relayview-instruction-package-v1\0" + _frame(raw_manifest))
|
||||
|
||||
Reference in new issue
Block a user