Skip to content

fix(plugin-dev): handle wrapped hook schemas and optional matchers in validate-hook-schema.sh - #84381

Open
erichanwang wants to merge 1 commit into
anthropics:mainfrom
erichanwang:fix/validate-hook-schema
Open

fix(plugin-dev): handle wrapped hook schemas and optional matchers in validate-hook-schema.sh#84381
erichanwang wants to merge 1 commit into
anthropics:mainfrom
erichanwang:fix/validate-hook-schema

Conversation

@erichanwang

Copy link
Copy Markdown

Summary

Fixes validate-hook-schema.sh script in plugins/plugin-dev so it accurately validates Claude Code hook configurations (hooks.json).

Changes

  1. Support Top-Level hooks Key: Detects whether hook handlers are defined under a top-level "hooks" object wrapper (e.g. {"description": "...", "hooks": {"SessionStart": [...]}}) or flat at the root level.
  2. Filter Metadata Keys: Ignores top-level metadata keys (description, $schema, title, version) when iterating hook event names.
  3. Make matcher Optional: Removed mandatory matcher check since matchers are optional in Claude Code hooks (matching all events by default when omitted).

Verification

Validated against all 5 plugin hooks.json files in the repo (explanatory-output-style, security-guidance, learning-output-style, hookify, ralph-wiggum). All 5 now pass validation (✅ All 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.

2 participants