feat: validate marketplace.json using claude plugin validate#3
Merged
feat: validate marketplace.json using claude plugin validate#3
Conversation
Replaces the hand-rolled custom validator with a Zod schema that mirrors the exact validation Claude Code runs internally (reverse-engineered from @anthropic-ai/claude-code cli.js). - scripts/validate-marketplace.js: Zod schema matching Claude Code's e76/jP5 schemas — validates the marketplace name, plugin entries, and source union (local "./path", github, npm, pip, url) - package.json: adds zod as the only dev dependency, npm run validate script - .github/workflows/validate.yml: runs on push to any branch and PRs to main - .gitignore: excludes node_modules The source union now precisely matches what Claude Code accepts, so any invalid source (like the bare "." that triggered this) is caught with the same error message Claude Code would produce. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/validate-marketplace.js">
<violation number="1" location="scripts/validate-marketplace.js:11">
P2: `new URL(...).pathname` produces URL-encoded or Windows-incompatible paths. This can make `resolve(ROOT, ...)` fail on Windows or when the repo path contains spaces. Use `fileURLToPath(new URL("..", import.meta.url))` instead, and import `fileURLToPath` from `url`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
`claude plugin validate .` is a built-in CLI command that runs the exact same internal Zod schema. No custom script or extra dependencies needed — just npx @anthropic-ai/claude-code in CI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
Uses
claude plugin validate .— a built-in CLI command in@anthropic-ai/claude-code— to validate the marketplace manifest in CI. No custom scripts or extra dependencies.The workflow
```yaml
run: npx --yes @anthropic-ai/claude-code plugin validate .
```
That's it. Claude Code runs the exact same internal Zod schema validation and exits 1 on failure with clear error messages, e.g.:
```
✘ Found 2 errors:
❯ plugins.0.source: Invalid input
```
Previous approach
PR originally used a hand-rolled Zod schema reverse-engineered from
cli.js. Replaced with the official CLI command after discoveringclaude plugin validateexists — no need to maintain a schema copy.Test plan
claude plugin validate .passes locally on current manifests"."exits 1 withplugins.0.source: Invalid input🤖 Generated with Claude Code