Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions scripts/validate-plugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ function fail(message) {
errors++;
}

// The schema allows `source` to be a remote URL. Nothing here fetches it, so
// report the skip instead of resolving it as a path (which turns "https://x"
// into "<root>/https:/x" and reports a missing directory).
function isRemoteSource(source) {
return typeof source === "string" && /^https?:\/\//i.test(source);
}

function skipRemoteSource(entry) {
if (!isRemoteSource(entry.source)) return false;
console.log(
`INFO: Plugin "${entry.name}": remote source "${entry.source}" is not validated locally`
);
return true;
}

// 1. Validate marketplace.json
const marketplacePath = resolve(root, ".cursor-plugin/marketplace.json");

Expand All @@ -50,6 +65,8 @@ if (!validateMarketplace(marketplace)) {

// 2. Validate each plugin
for (const entry of marketplace.plugins ?? []) {
if (skipRemoteSource(entry)) continue;

const pluginDir = resolve(root, entry.source);
const pluginJsonPath = resolve(pluginDir, ".cursor-plugin/plugin.json");

Expand Down Expand Up @@ -98,6 +115,8 @@ const claudeMarketplace = existsSync(claudeMarketplacePath)
: { plugins: [] };

for (const entry of claudeMarketplace.plugins ?? []) {
if (skipRemoteSource(entry)) continue;

const pluginDir = resolve(root, entry.source);
const pluginJsonPath = resolve(pluginDir, ".claude-plugin/plugin.json");

Expand Down Expand Up @@ -126,6 +145,7 @@ for (const entry of [
...(marketplace.plugins ?? []),
...(claudeMarketplace.plugins ?? []),
]) {
if (isRemoteSource(entry.source)) continue;
sources.set(resolve(root, entry.source), entry.name);
}

Expand Down