Repository navigation
Conversation
marketplace.schema.json documents `source` as a path or a remote URL, but the validator resolved every source as a path, so a schema-valid entry with an https source failed with "source directory ... does not exist". Skip remote sources with an explicit note; nothing here fetches them. Fixes cursor#640.
rahul05ranjan
left a comment
There was a problem hiding this comment.
Verified against the repo tree by replicating the loop's mechanics in a standalone script against the real marketplace.json (I don't have ajv available locally, so the schema side was checked against the schema definition itself rather than via ajv):
- Reproduced the reported failure mode:
path.resolve(root, "https://github.com/user/plugin")returns<root>/https:/github.com/user/plugin,existsSyncis false, so the old code fails with exactly the misleadingsource directory "..." does not existmessage from #640. Also confirmedpluginEntry.sourceinschemas/marketplace.schema.jsonis just a non-empty string whose description permits a remote URL, so such an entry is schema-valid — the validator/schema mismatch is real. - Old vs new loop logic on the actual marketplace with a planted
{"name":"zz-remote","source":"https://github.com/user/plugin"}entry: old → 1 error; new → theINFOline and zero errors. The current marketplace (104 entries, nohttpsources) produces zero errors under both, somainoutput is indeed unchanged. - The
continueis placed correctly: it skips before the directory/plugin.json checks but leaves the marketplace schema validation path untouched.
One nit: /^https?:\/\// is case-sensitive, but URL schemes are case-insensitive per RFC 3986 — HTTPS://github.com/x/y would still fall through to resolve() and hit the old misleading error. (ftp:// sources have the same problem, though scoping to http(s) is reasonable given the marketplace's actual usage.)
URL schemes are case-insensitive (RFC 3986), so HTTPS://... should be treated like https://... rather than falling through to resolve().
|
Hey @rahul05ranjan, thanks for running it against the real tree. Good catch on the scheme case: pushed |
Summary
Fixes #640.
schemas/marketplace.schema.jsondocumentspluginEntry.sourceas "Path to the plugin directory (relative to the marketplace root) or a remote URL", butscripts/validate-plugins.mjsresolved every source as a path, so an entry with"source": "https://github.com/user/plugin"became<root>/https:/github.com/user/pluginand failed withsource directory "https://..." does not exist. A schema-valid marketplace could not pass the repo's own validator, with a misleading message.Remote sources are now skipped with an explicit
INFO: ... remote source "..." is not validated locallyline and the entry still goes through the marketplace schema check. Nothing fetches them; this only stops reporting a URL as a missing directory. The official marketplace in this repo has no remote sources, so the output onmainis unchanged.Kept separate from #618 so that PR does not grow after opening; the two touch different parts of the loop and apply in either order.
Verification
node scripts/validate-plugins.mjsonmain:All plugins validated successfully.(unchanged).{"name":"zz-remote","source":"https://github.com/user/zz-remote"}entry: oneINFOline, run stays green; onmainthe same entry fails the run.