fix(claude-code-hooks): deduplicate settings paths to prevent double hook execution

When cwd equals home directory, ~/.claude/settings.json was being loaded
twice (once as home config and once as cwd config), causing hooks like
Stop to execute twice.

This adds deduplication using Set to ensure each config file is only
loaded once.
This commit is contained in:
khduy
2026-01-31 01:30:28 +07:00
parent 061a5f5132
commit 4c40c3adb1

View File

@@ -55,7 +55,9 @@ export function getClaudeSettingsPaths(customPath?: string): string[] {
paths.unshift(customPath)
}
return paths
// Deduplicate paths to prevent loading the same file multiple times
// (e.g., when cwd is the home directory)
return [...new Set(paths)]
}
function mergeHooksConfig(