diff --git a/internal/skillpkg/skillpkg.go b/internal/skillpkg/skillpkg.go index b036e1198..948e53879 100644 --- a/internal/skillpkg/skillpkg.go +++ b/internal/skillpkg/skillpkg.go @@ -75,8 +75,8 @@ func Load(dir string) (*Package, error) { // metadata is left unchecked: the format wants string values, but lists there are // common and tool clients read them fine, so skipping those skills would cost more. compat, ok := fm["compatibility"].(string) - if _, set := fm["compatibility"]; set && !ok { - return nil, fmt.Errorf("compatibility must be text") + if _, set := fm["compatibility"]; set && (!ok || compat == "") { + return nil, fmt.Errorf("compatibility must be non-empty text") } if n := utf8.RuneCountInString(compat); n > MaxCompatibility { return nil, fmt.Errorf("compatibility has %d characters; the limit is %d", n, MaxCompatibility) diff --git a/internal/skillserve/catalog_test.go b/internal/skillserve/catalog_test.go index 1b44d2c8c..e2d9e6a52 100644 --- a/internal/skillserve/catalog_test.go +++ b/internal/skillserve/catalog_test.go @@ -174,12 +174,13 @@ func TestBuild_SkipsSkillWhoseDescriptionOrCompatibilityIsTooLong(t *testing.T) writeFile(t, filepath.Join(src, "long/SKILL.md"), skill("long", strings.Repeat("a", 1025))) writeFile(t, filepath.Join(src, "wide/SKILL.md"), skill("wide", strings.Repeat("技", 1024))) writeFile(t, filepath.Join(src, "compat/SKILL.md"), "---\nname: compat\ndescription: Use when testing\ncompatibility: "+strings.Repeat("a", 501)+"\n---\n") + writeFile(t, filepath.Join(src, "blank/SKILL.md"), "---\nname: blank\ndescription: Use when testing\ncompatibility: \"\"\n---\n") c, err := (&Builder{Source: src}).Build() if err != nil { t.Fatal(err) } - if len(c.Skills) != 1 || c.Skills[0].URI != "skill://wide/SKILL.md" || !hasWarning(c, "skipped long") || !hasWarning(c, "skipped compat") { + if len(c.Skills) != 1 || c.Skills[0].URI != "skill://wide/SKILL.md" || !hasWarning(c, "skipped long") || !hasWarning(c, "skipped compat") || !hasWarning(c, "skipped blank") { t.Errorf("skills=%v warnings=%v, want long and compat skipped, wide served", c.Skills, c.Skipped) } }