Skip to content

Commit e3a1306

Browse files
committed
fix: remove duplicate hooks declaration from plugin.json
Fixes anomalyco#103, anomalyco#106, anomalyco#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.
1 parent 81003b1 commit e3a1306

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎.claude-plugin/plugin.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@
3838
"./agents/refactor-cleaner.md",
3939
"./agents/security-reviewer.md",
4040
"./agents/tdd-guide.md"
41-
],
42-
"hooks": "./hooks/hooks.json"
41+
]
4342
}

‎tests/hooks/hooks.test.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,22 @@ async function runTests() {
325325
}
326326
})) passed++; else failed++;
327327

328+
// plugin.json validation
329+
console.log('\nplugin.json Validation:');
330+
331+
if (test('plugin.json does NOT have explicit hooks declaration', () => {
332+
// Claude Code automatically loads hooks/hooks.json by convention.
333+
// Explicitly declaring it in plugin.json causes a duplicate detection error.
334+
// See: https://github.com/affaan-m/everything-claude-code/issues/103
335+
const pluginPath = path.join(__dirname, '..', '..', '.claude-plugin', 'plugin.json');
336+
const plugin = JSON.parse(fs.readFileSync(pluginPath, 'utf8'));
337+
338+
assert.ok(
339+
!plugin.hooks,
340+
'plugin.json should NOT have "hooks" field - Claude Code auto-loads hooks/hooks.json'
341+
);
342+
})) passed++; else failed++;
343+
328344
// Summary
329345
console.log('\n=== Test Results ===');
330346
console.log(`Passed: ${passed}`);

0 commit comments

Comments
 (0)