diff --git a/scripts/lib/cursor-plugin-bundle.mjs b/scripts/lib/cursor-plugin-bundle.mjs index 5dd7453172..3a7ee526c8 100644 --- a/scripts/lib/cursor-plugin-bundle.mjs +++ b/scripts/lib/cursor-plugin-bundle.mjs @@ -72,6 +72,8 @@ const skillFrontmatter = (content) => { return fields; }; +const isNonemptyString = (value) => typeof value === "string" && value !== ""; + /** * Structured differences between the Cursor plugin declaration and the * package version it must launch. Empty means the manifest, server pin, @@ -89,13 +91,10 @@ export const cursorPluginBundleIssues = ({ const add = (field) => issues.push({ field }); if (manifest?.name !== "rea") add("name"); if (manifest?.version !== packageVersion) add("version"); - if (typeof manifest?.description !== "string" || manifest.description === "") - add("description"); - if (typeof manifest?.author?.name !== "string" || manifest.author.name === "") - add("author.name"); + if (!isNonemptyString(manifest?.description)) add("description"); + if (!isNonemptyString(manifest?.author?.name)) add("author.name"); if (manifest?.repository !== CURSOR_PLUGIN_REPOSITORY) add("repository"); - if (typeof manifest?.license !== "string" || manifest.license === "") - add("license"); + if (!isNonemptyString(manifest?.license)) add("license"); if ( !Array.isArray(manifest?.keywords) || manifest.keywords.length === 0 || @@ -120,11 +119,7 @@ export const cursorPluginBundleIssues = ({ ) add("skills.entries"); if (frontmatter?.name !== CURSOR_PLUGIN_SKILL) add("skill.name"); - if ( - typeof frontmatter?.description !== "string" || - frontmatter.description === "" - ) - add("skill.description"); + if (!isNonemptyString(frontmatter?.description)) add("skill.description"); return issues; };