Repository navigation
ci: validate every PR and check declared plugin component paths exist - #582
Open
akushonkamen wants to merge 2 commits into
Open
akushonkamen wants to merge 2 commits into
akushonkamen wants to merge 2 commits into
Conversation
The paths filter only listed the two manifest files and schemas, so a PR that only touches SKILL.md, hooks.json, mcp.json, agents or scripts ran no CI at all. The job takes seconds; drop the filter so every PR is validated. Piece 1 of cursor#531. Signed-off-by: akushonkamen <akushonkamen@163.com>
The validator only called existsSync on the manifests themselves (marketplace.json, plugin dir, plugin.json), so a plugin could declare skills/agents/rules/commands/hooks/mcpServers/logo paths that do not exist and pass CI. Check each declared path: plain paths must exist (directory when declared with a trailing slash), glob patterns must have an existing static base directory, and absolute URLs (allowed for logo) plus inline hooks/mcpServers objects are skipped. Validated green against all 100 plugins currently in the marketplace. Piece 2 of cursor#531. Signed-off-by: akushonkamen <akushonkamen@163.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #531.
Why
At
1b6d44f(this PR's base), the CI setup checks the two manifests and nothing else:scripts/validate-plugins.mjscallsexistsSynconly three times (lines 37, 57, 65), and all three are on the manifests themselves:marketplace.json, the plugin's source directory, and itsplugin.json. A plugin can declareskills/agents/rules/commands/hooks/mcpServers/logopaths that do not exist and still pass schema validation and CI — the paths fail silently at load time in Cursor..github/workflows/validate-plugins.ymlgates the job behind apaths:filter listing three globs (marketplace.json,**/plugin.json,schemas/**), so a PR that only touchesSKILL.md,hooks.json,mcp.json, agents or scripts runs no CI at all.Issue #531 files the pieces separately ("filing as one issue so the pieces can be picked off separately"). This PR takes the first two pieces of the suggested shape: drop the
paths:filter (per the issue author: "broaden to the whole tree (or drop the filter); the job takes seconds"), and add path-existence checking for declared component fields. Pieces 3–6 of the suggested shape (frontmatter parsing,${VAR}placeholders vsvariables, unlisted plugin directories, a lockfile withnpm ci) are left for follow-up PRs.Change
Piece 1 —
.github/workflows/validate-plugins.yml: remove thepaths:filter underpull_request:, so every pull request runs the validation job. The job takes seconds. No other change to the workflow (thenpm install --no-save ajv ajv-formatsline is untouched; the lockfile piece is issue-suggested shape #2, out of scope here).Piece 2 —
scripts/validate-plugins.mjs: add acheckComponentPath()helper and apply it to every declared component path:skills,agents,rules,commands(string or array entries)hooksandmcpServerswhen declared as path strings (string or array entries)logowhen declared as a stringCheck rules, matching the schema's allowed shapes:
statSync).*,?,{,},[,]) must have an existing static base directory (the path prefix up to the first glob-containing segment), so a typo'd base likedocs/**/*.mdwith nodocs/is caught.logo) and inlinehooks/mcpServersobjects are skipped.No new dependencies — the check uses
fs/pathonly.Verification
timeout 60 node scripts/validate-plugins.mjs→All plugins validated successfully., exit 0 at the base commit1b6d44fand at this PR's HEAD. All 100 plugins currently in the marketplace pass; zero failures, so the new check introduces no false positives.skills/directory, missinglogo, missinghooksfile, missingmcp.json→ each fails withPlugin "<name>": <field> path "<path>" does not exist, exit 1docs/**/*.mdwith nodocs/base →skills glob "docs/**/*.md" matches nothing — base directory "docs" does not exist, exit 1"README.md/"(trailing slash on a file) →skills path "README.md/" is not a directory, exit 1logoas anhttps://URL and inlinehooks/mcpServersobjects →All plugins validated successfully., exit 0.sourcedirectory is missing →source directory "..." does not exist, exit 1; aplugin.jsonfailing schema (versionas number) plus a marketplace/plugin name mismatch → both errors reported, exit 1.actionlint .github/workflows/validate-plugins.yml→ exit 0.AI disclosure
This fix was developed with an AI coding agent (Claude) and human-reviewed; the claim comment on #531 discloses the same.
Note
Low Risk
CI-only validation and workflow trigger changes; no production runtime or data-path behavior.
Overview
Every pull request now runs the plugin validation workflow by removing the
paths:filter onpull_requestinvalidate-plugins.yml, so changes to skills, hooks, or other plugin assets are no longer skipped when manifests are untouched.scripts/validate-plugins.mjsadds filesystem checks after JSON schema validation: declared paths forskills,agents,rules,commands, stringhooks/mcpServers, andlogomust exist under the plugin root. Globs only require the static prefix directory to exist; trailing-slash paths must be directories;https://(and similar) logos are ignored.Fixes the gap where broken component paths could pass CI and only fail at Cursor load time (#531).
Reviewed by Cursor Bugbot for commit 5ba81f0. Bugbot is set up for automated code reviews on this repo. Configure here.