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

Function getSessionHooks

src/utils/hooks/sessionHooks.ts:302–330  ·  view source on GitHub ↗
(
  appState: AppState,
  sessionId: string,
  event?: HookEvent,
)

Source from the content-addressed store, hash-verified

300 * @returns Hook matchers for the event, or all hooks if no event specified
301 */
302export function getSessionHooks(
303 appState: AppState,
304 sessionId: string,
305 event?: HookEvent,
306): Map<HookEvent, SessionDerivedHookMatcher[]> {
307 const store = appState.sessionHooks.get(sessionId)
308 if (!store) {
309 return new Map()
310 }
311
312 const result = new Map<HookEvent, SessionDerivedHookMatcher[]>()
313
314 if (event) {
315 const sessionMatchers = store.hooks[event]
316 if (sessionMatchers) {
317 result.set(event, convertToHookMatchers(sessionMatchers))
318 }
319 return result
320 }
321
322 for (const evt of HOOK_EVENTS) {
323 const sessionMatchers = store.hooks[evt]
324 if (sessionMatchers) {
325 result.set(evt, convertToHookMatchers(sessionMatchers))
326 }
327 }
328
329 return result
330}
331
332type FunctionHookMatcher = {
333 matcher: string

Callers 2

getHooksConfigFunction · 0.85
getAllHooksFunction · 0.85

Calls 3

convertToHookMatchersFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected