Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
"./global/crew/independent-reviewer.md",
"./global/crew/scout.md",
"./global/crew/verifier.md"
],
"hooks": "./hooks/hooks.json"
]
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- **Plugin load: dropped the duplicate `hooks` declaration from the manifest.** Claude Code
loads the standard `hooks/hooks.json` automatically, so `manifest.hooks` pointing at that
same path registered it twice and the loader rejected the entire plugin
(`Duplicate hooks file detected`) — taking every skill, agent, guard and the `forge-cortex`
MCP server down with it. `manifest.hooks` is for additional hook files only; the guards are
unchanged and still load from the plugin root. A regression test in `test/channels.test.js`
now fails if the standard path is ever re-declared.

## [0.32.0] - 2026-08-14

### Changed
Expand Down
17 changes: 14 additions & 3 deletions src/doctor.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,20 @@ function commandScriptFromPluginRoot(hook) {
function checkPluginCompatibility(out) {
try {
const plugin = readJson(join(BRAND.root, ".claude-plugin", "plugin.json"));
const hookRel = plugin.hooks;
const hookPath = hookRel ? join(BRAND.root, hookRel) : "";
if (!hookRel || !existsSync(hookPath)) {
// Claude Code auto-loads the standard hooks/hooks.json from the plugin root;
// manifest.hooks exists only for ADDITIONAL hook files. Re-declaring the standard
// path registers it twice and the loader rejects the WHOLE plugin.
const standardRel = "hooks/hooks.json";
const hookRel = plugin.hooks ?? standardRel;
const hookPath = join(BRAND.root, hookRel);
if (plugin.hooks && hookPath === join(BRAND.root, standardRel)) {
out.push(
warn(
"Claude plugin hooks",
"manifest re-declares the auto-loaded hooks/hooks.json — Claude Code rejects the whole plugin (duplicate hooks file)",
),
);
} else if (!existsSync(hookPath)) {
out.push(warn("Claude plugin hooks", "manifest hooks path missing or invalid"));
} else {
const manifest = readJson(hookPath);
Expand Down
17 changes: 17 additions & 0 deletions test/channels.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,20 @@ test("plugin hooks wire guards from the plugin root", () => {
assert.match(hooks, /CLAUDE_PLUGIN_ROOT/);
assert.match(hooks, /global\/guards\/protect-paths\.sh/);
});

// Claude Code loads the standard hooks/hooks.json automatically. Declaring it in
// `manifest.hooks` too registers the same file twice, and the loader rejects the
// WHOLE plugin ("Duplicate hooks file detected") — skills, agents, guards and the
// MCP server all vanish. manifest.hooks is only for ADDITIONAL hook files.
test("plugin manifest does not re-declare the standard hooks file", () => {
const plugin = readJson(".claude-plugin/plugin.json");
const declared = [plugin.hooks ?? []].flat();
for (const h of declared) {
assert.notMatch(
h,
/^\.\/hooks\/hooks\.json$/,
"hooks/hooks.json loads automatically; declaring it fails plugin load",
);
}
assert.ok(existsSync(join(root, "hooks/hooks.json")), "the auto-loaded hooks file still exists");
});
Loading