Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func validateNormalizedSkill(bundle normalizedSkillBundle) SkillInfo {
if !ok {
return SkillInfo{Valid: false, ErrorCode: "missing-skill-md"}
}
text := string(file.Contents)
text := strings.ReplaceAll(string(file.Contents), "\r\n", "\n")
if !strings.HasPrefix(text, "---\n") {
return SkillInfo{Valid: false, ErrorCode: "invalid-frontmatter"}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub(crate) fn validate_normalized_skill(bundle: &NormalizedSkillBundle) -> Skill
let Some(file) = bundle.get("SKILL.md") else {
return invalid_skill("missing-skill-md");
};
let content = String::from_utf8_lossy(&file.contents);
let content = String::from_utf8_lossy(&file.contents).replace("\r\n", "\n");
let Some(rest) = content.strip_prefix("---\n") else {
return invalid_skill("invalid-frontmatter");
};
Expand Down
76 changes: 76 additions & 0 deletions testdata/cases/bundled-skill-install.json
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,82 @@
"errorCode": "invalid-frontmatter"
}
},
{
"id": "invalid-frontmatter-crlf",
"operation": "validate",
"description": "Preserves skill naming validation for CRLF frontmatter.",
"options": {
"skillFiles": [
{
"path": "SKILL.md",
"contents": "---\r\nname: Invalid_Name\r\ndescription: Windows line endings.\r\n---\r\n\r\n# CRLF\r\n"
}
]
},
"given": {
"dirs": [],
"files": {}
},
"expected": {
"valid": false,
"errorCode": "invalid-frontmatter"
}
},
{
"id": "crlf-skill-install",
"operation": "install",
"description": "Installs a CRLF skill bundle and hashes its original bytes.",
"options": {
"appId": "example-cli",
"skillFiles": [
{
"path": "SKILL.md",
"contents": "---\r\nname: crlf\r\ndescription: Windows line endings.\r\n---\r\n\r\n# CRLF\r\n"
}
],
"scope": "user",
"agents": [
"codex"
],
"home": "$HOME",
"cwd": "$WORKSPACE"
},
"given": {
"dirs": [
"$HOME/.agents/skills"
],
"files": {}
},
"expected": {
"report": {
"installed": [
{
"hostId": "codex",
"skillName": "crlf",
"targetDir": "$HOME/.agents/skills/crlf"
}
],
"updated": [],
"skipped": [],
"conflicts": [],
"errors": []
},
"filesPresent": [
"$HOME/.agents/skills/crlf/SKILL.md",
"$HOME/.agents/skills/crlf/.kitup.json"
],
"metadata": {
"path": "$HOME/.agents/skills/crlf/.kitup.json",
"fields": {
"schemaVersion": 1,
"appId": "example-cli",
"skillName": "crlf",
"source": "bundled"
},
"hash": "from-skill-files"
}
}
},
{
"id": "nested-resources-copied",
"operation": "install",
Expand Down
Loading