utils/plugins/plugin_schemas library
Plugin Schemas and Validation
Ported from neomage/src/utils/plugins/schemas.ts and validatePlugin.ts
This module provides:
- Plugin manifest schema definitions and validation
- Marketplace manifest schema definitions and validation
- Plugin component file (skill/agent/command) frontmatter validation
- Hooks.json validation
- Official marketplace name impersonation detection
- Path traversal security checks
Classes
- CommandMetadata
- Command metadata for plugin manifest or marketplace entry.
- MarketplaceMetadata
- Marketplace metadata.
- PluginAuthor
- Plugin author information.
- PluginManifest
- Plugin manifest (plugin.json) data model.
- PluginMarketplace
- Marketplace manifest data model.
- PluginMarketplaceEntry
- Marketplace entry for a plugin.
- PluginSourceConfig
- Plugin source configuration for marketplace validation.
- PluginUserConfigOption
- User-configurable option in plugin manifest.
- ValidationError
- A single validation error.
- ValidationResult
- Result of validating a plugin file.
- ValidationWarning
- A single validation warning.
Enums
- PluginFileType
- Type of file being validated.
Constants
-
allowedOfficialMarketplaceNames
→ const Set<
String> - Official marketplace names reserved for Anthropic/Neomage official use. These names are allowed ONLY for official marketplaces and blocked for third parties.
- officialGithubOrg → const String
- The official GitHub organization for Anthropic marketplaces.
Properties
- blockedOfficialNamePattern → RegExp
-
Pattern to detect names that impersonate official Anthropic/Neomage marketplaces.
final
Functions
-
isBlockedOfficialName(
String name) → bool - Check if a marketplace name impersonates an official Anthropic/Neomage marketplace.
-
isMarketplaceAutoUpdate(
String marketplaceName, {bool? autoUpdate}) → bool - Check if auto-update is enabled for a marketplace. Uses the stored value if set, otherwise defaults based on whether it's an official Anthropic marketplace (true) or not (false).
-
validateComponentFile(
String filePath, String content, PluginFileType fileType) → ValidationResult - Validate the YAML frontmatter in a plugin component markdown file.
-
validateHooksJson(
String filePath) → Future< ValidationResult> - Validate a plugin's hooks.json file.
-
validateManifest(
String filePath) → Future< ValidationResult> - Validate a manifest file or directory (auto-detects type).
-
validateMarketplaceManifest(
String filePath) → Future< ValidationResult> - Validate a marketplace manifest file (marketplace.json).
-
validateMarketplaceName(
String name) → List< ValidationError> - Validate a marketplace name string.
-
validateOfficialNameSource(
String name, PluginSourceConfig source) → String? - Validate that a marketplace with a reserved name comes from the official source.
-
validatePluginContents(
String pluginDir) → Future< List< ValidationResult> > - Validate the content files inside a plugin directory.
-
validatePluginManifest(
String filePath) → Future< ValidationResult> - Validate a plugin manifest file (plugin.json).