Skip to content

feat: validate marketplace.json using claude plugin validate#3

Merged
glebedel merged 2 commits intomainfrom
fix/zod-schema-validation
Feb 23, 2026
Merged

feat: validate marketplace.json using claude plugin validate#3
glebedel merged 2 commits intomainfrom
fix/zod-schema-validation

Conversation

@glebedel
Copy link
Copy Markdown
Contributor

@glebedel glebedel commented Feb 23, 2026

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

  • name: Validate plugin manifests
    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 discovering claude plugin validate exists — no need to maintain a schema copy.

Test plan

  • claude plugin validate . passes locally on current manifests
  • Verified bad source "." exits 1 with plugins.0.source: Invalid input
  • CI passes on this PR

🤖 Generated with Claude Code

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>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@glebedel glebedel changed the title feat: validate marketplace.json with Zod schema mirroring Claude Code feat: validate marketplace.json using claude plugin validate Feb 23, 2026
@glebedel glebedel merged commit 0962f31 into main Feb 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant