feat: add category and icon fields to plugin manifest schema

This commit is contained in:
LukeGus committed 2026-09-20 21:06:16 -05:00
1 parent 5a76d30637
commit 7f1beddccc
8 files changed
+72

No files matched your search

+19
View File
@@ -27,6 +27,10 @@ function knownPermissions(schema) {
return schema.properties.permissions.items.enum;
}
function knownCategories(schema) {
return schema.properties.category.enum;
}
function validateManifest(manifest, schema) {
const errors = [];
@@ -56,6 +60,21 @@ function validateManifest(manifest, schema) {
}
}
if (typeof manifest.category === "string") {
const categories = knownCategories(schema);
if (!categories.includes(manifest.category)) {
errors.push(
`Field "category" must be one of: ${categories.join(", ")}, got: "${manifest.category}"`,
);
}
} else if ("category" in manifest) {
errors.push('Field "category" must be a string');
}
if ("icon" in manifest && typeof manifest.icon !== "string") {
errors.push('Field "icon" must be a string');
}
if (manifest.engine && typeof manifest.engine === "object") {
if (!manifest.engine.termix) {
errors.push('Field "engine.termix" is required');