MCPcopy Index your code
hub / github.com/codeaashu/claude-code / mergeHooksSettings

Function mergeHooksSettings

src/utils/plugins/pluginLoader.ts:1854–1877  ·  view source on GitHub ↗

* Merge two HooksSettings objects

(
  base: HooksSettings | undefined,
  additional: HooksSettings,
)

Source from the content-addressed store, hash-verified

1852 * Merge two HooksSettings objects
1853 */
1854function mergeHooksSettings(
1855 base: HooksSettings | undefined,
1856 additional: HooksSettings,
1857): HooksSettings {
1858 if (!base) {
1859 return additional
1860 }
1861
1862 const merged = { ...base }
1863
1864 for (const [event, matchers] of Object.entries(additional)) {
1865 if (!merged[event as keyof HooksSettings]) {
1866 merged[event as keyof HooksSettings] = matchers
1867 } else {
1868 // Merge matchers for this event
1869 merged[event as keyof HooksSettings] = [
1870 ...(merged[event as keyof HooksSettings] || []),
1871 ...matchers,
1872 ]
1873 }
1874 }
1875
1876 return merged
1877}
1878
1879/**
1880 * Shared discovery/policy/merge pipeline for both load modes.

Callers 1

createPluginFromPathFunction · 0.85

Calls 1

entriesMethod · 0.80

Tested by

no test coverage detected