MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / getPluginHookCounts

Function getPluginHookCounts

src/utils/hooks.ts:1598–1615  ·  view source on GitHub ↗

* Build a map of {sanitizedPluginName: hookCount} from matched hooks. * Only logs actual names for official marketplace plugins; others become 'third-party'.

(
  hooks: MatchedHook[],
)

Source from the content-addressed store, hash-verified

1596 * Only logs actual names for official marketplace plugins; others become 'third-party'.
1597 */
1598function getPluginHookCounts(
1599 hooks: MatchedHook[],
1600): Record<string, number> | undefined {
1601 const pluginHooks = hooks.filter(h => h.pluginId)
1602 if (pluginHooks.length === 0) {
1603 return undefined
1604 }
1605 const counts: Record<string, number> = {}
1606 for (const h of pluginHooks) {
1607 const atIndex = h.pluginId!.lastIndexOf('@')
1608 const isOfficial =
1609 atIndex > 0 &&
1610 ALLOWED_OFFICIAL_MARKETPLACE_NAMES.has(h.pluginId!.slice(atIndex + 1))
1611 const key = isOfficial ? h.pluginId! : 'third-party'
1612 counts[key] = (counts[key] || 0) + 1
1613 }
1614 return counts
1615}
1616
1617/**
1618 * Build a map of {hookType: count} from matched hooks.

Callers 2

executeHooksFunction · 0.85
executeHooksOutsideREPLFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected