Skip to content

fix(plugins): drop redundant hooks key so the code-oz plugin loads#46

Merged
omerakben merged 1 commit into
mainfrom
fix/plugin-hooks-autoload-duplicate
May 30, 2026
Merged

fix(plugins): drop redundant hooks key so the code-oz plugin loads#46
omerakben merged 1 commit into
mainfrom
fix/plugin-hooks-autoload-duplicate

Conversation

@omerakben
Copy link
Copy Markdown
Owner

Why

Discovered by a real post-merge dogfood of #45: claude plugin marketplace add omerakben/code-oz + plugin install code-oz@code-oz-marketplace installs the plugin, but it fails to load:

Hook load failed: Duplicate hooks file detected: ./hooks/hooks.json ... The standard hooks/hooks.json is loaded automatically, so manifest.hooks should only reference additional hook files.

Claude Code auto-discovers hooks/hooks.json from the plugin root. The code-oz plugin also declared "hooks": "./hooks/hooks.json" in plugin.json, so it loaded twice and the whole plugin (commands + hook) failed to load. claude plugin validate and the offline suite passed because they asserted the broken value, not load behavior — only a real install surfaced it.

What

  • Remove the hooks key from plugins/code-oz/.claude-plugin/plugin.json. The SessionStart router still loads via the conventional path (confirmed against the plugin reference docs: hooks auto-load from hooks/hooks.json; manifest hooks is for additional files only).
  • Flip the manifest test RED-first to assert the key is absent.

Verification

  • Real marketplace add + plugin install of both plugins now shows code-oz Status: enabled (was "failed to load"); code-oz-discipline unchanged.
  • claude plugin validate passes; 3812 offline tests pass; typecheck clean.

Installing the code-oz plugin from the marketplace failed at load time:

  Hook load failed: Duplicate hooks file detected: ./hooks/hooks.json ...
  The standard hooks/hooks.json is loaded automatically, so manifest.hooks
  should only reference additional hook files.

Claude Code auto-discovers hooks/hooks.json from the plugin root, so declaring
it again in plugin.json's `hooks` key loads it twice and the whole plugin
(commands included) fails to load. `claude plugin validate` and the offline
suite passed because they asserted the broken value rather than load behavior;
only a real `marketplace add` + `plugin install` surfaced it.

Remove the `hooks` key from plugins/code-oz/.claude-plugin/plugin.json. The
SessionStart router hook still loads via the conventional path (confirmed
against the plugin reference docs). Flip the manifest test RED-first to assert
the key is absent.

Verified: real install of both plugins from a local marketplace now shows
code-oz Status: enabled (was "failed to load"); code-oz-discipline unchanged.
3812 offline tests pass; typecheck clean; claude plugin validate passes.
Copilot AI review requested due to automatic review settings May 30, 2026 15:04
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Warning

Review limit reached

@omerakben, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes and 4 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 03ba0c78-4ef6-4cde-84df-e2cfcb4583da

📥 Commits

Reviewing files that changed from the base of the PR and between 7cf6c79 and 741982b.

📒 Files selected for processing (2)
  • plugins/code-oz/.claude-plugin/plugin.json
  • tests/plugins/manifest-shape.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/plugin-hooks-autoload-duplicate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the explicit declaration of the standard hooks file (./hooks/hooks.json) from the plugin.json manifest for the code-oz plugin, as standard hooks are auto-loaded and declaring them explicitly causes duplicate loading errors. The corresponding test in manifest-shape.test.ts has been updated to expect plugin.hooks to be undefined. I have no feedback to provide as there are no review comments.

@omerakben omerakben merged commit 8d2c290 into main May 30, 2026
3 of 4 checks passed
@omerakben omerakben deleted the fix/plugin-hooks-autoload-duplicate branch May 30, 2026 15:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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