mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +00:00
refactor(cursor): share plugin string field validation (#16126)
This commit is contained in:
1 parent
06f57297c4
commit
f6cd4c842b
1 file changed
+6
-11
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user