refactor(cursor): share plugin string field validation (#16126)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-02 22:37:46 +00:00
1 parent 06f57297c4
commit f6cd4c842b
1 file changed
+6 -11
+6 -11
View File
@@ -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;
};