From e3a1306369b61098fdd88a95ff429ba3d7be4c51 Mon Sep 17 00:00:00 2001 From: Affaan Mustafa Date: Wed, 28 Jan 2026 23:02:05 -0800 Subject: [PATCH] fix: remove duplicate hooks declaration from plugin.json Fixes #103, #106, #108 Claude Code automatically loads hooks/hooks.json by convention. Explicitly declaring it in plugin.json causes a duplicate detection error: "Duplicate hooks file detected" Added regression test to prevent this from being reintroduced. --- .claude-plugin/plugin.json | 3 +-- tests/hooks/hooks.test.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 3186376b..68d80fde 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -38,6 +38,5 @@ "./agents/refactor-cleaner.md", "./agents/security-reviewer.md", "./agents/tdd-guide.md" - ], - "hooks": "./hooks/hooks.json" + ] } diff --git a/tests/hooks/hooks.test.js b/tests/hooks/hooks.test.js index e629a267..2ed292ad 100644 --- a/tests/hooks/hooks.test.js +++ b/tests/hooks/hooks.test.js @@ -325,6 +325,22 @@ async function runTests() { } })) passed++; else failed++; + // plugin.json validation + console.log('\nplugin.json Validation:'); + + if (test('plugin.json does NOT have explicit hooks declaration', () => { + // Claude Code automatically loads hooks/hooks.json by convention. + // Explicitly declaring it in plugin.json causes a duplicate detection error. + // See: https://github.com/affaan-m/everything-claude-code/issues/103 + const pluginPath = path.join(__dirname, '..', '..', '.claude-plugin', 'plugin.json'); + const plugin = JSON.parse(fs.readFileSync(pluginPath, 'utf8')); + + assert.ok( + !plugin.hooks, + 'plugin.json should NOT have "hooks" field - Claude Code auto-loads hooks/hooks.json' + ); + })) passed++; else failed++; + // Summary console.log('\n=== Test Results ==='); console.log(`Passed: ${passed}`);