MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / mergeHooksInto

Function mergeHooksInto

src/config/settings.ts:73–80  ·  view source on GitHub ↗

Concatenate a settings file's `hooks` block into the accumulator, keeping * only known events and well-formed matcher arrays.

(target: HooksConfig, raw: unknown)

Source from the content-addressed store, hash-verified

71/** Concatenate a settings file's `hooks` block into the accumulator, keeping
72 * only known events and well-formed matcher arrays. */
73function mergeHooksInto(target: HooksConfig, raw: unknown): void {
74 if (!raw || typeof raw !== "object") return
75 for (const [event, matchers] of Object.entries(raw as Record<string, unknown>)) {
76 if (!isHookEvent(event)) continue
77 if (!Array.isArray(matchers)) continue
78 ;(target[event] ??= []).push(...(matchers as HookMatcher[]))
79 }
80}
81
82function readJson(filePath: string): Record<string, unknown> | undefined {
83 try {

Callers 2

readProjectHooksFunction · 0.85
loadSettingsFunction · 0.85

Calls 1

isHookEventFunction · 0.85

Tested by

no test coverage detected