fix: validate plugin command spec entries#1943
Open
AmirhosseinHonardoust wants to merge 1 commit into
Open
Conversation
Contributor
|
🟡 Contributor Reputation Check: MEDIUM risk
Maintainers: please review this contributor before merging. |
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.
Summary
Follow-up to #1601. This tightens plugin manifest validation for the third declarative spec array,
commands, and makes the alphabetical ordering check type-safe.Changes:
commandstovalidateSpecPaths()so command entries are validated likeagentsandskills./commands/*.mdand point to an existing top-level command filelocaleCompare()unless all entries in the manifest array are strings, so invalid entries report the existingfield[index] must be a stringerror instead of aborting validationWhy
The plugin docs and cleanup tooling already treat
agents,commands, andskillsas plugin spec fields. After #1601, ordering validation coveredagentsandskills, but notcommands. This keeps validation aligned with the documented plugin schema and withplugin:cleansupport for materialized command files.Validation
I verified the behavior with a temporary local plugin fixture:
commands: ["./commands/b.md", "./commands/a.md"]now fails withcommands must be sorted alphabeticallycommands: [123]now fails withcommands[0] must be a stringinstead of throwing fromlocaleCompare()commands: ["./commands/a.md", "./commands/b.md"]passes when the referenced command files existBefore merging, I also recommend running the standard project checks: