MCPcopy Create free account
hub / github.com/Noumena-Network/code / getPluginHookCounts

Function getPluginHookCounts

src/utils/hooks.ts:1465–1482  ·  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

1463 * Only logs actual names for official marketplace plugins; others become 'third-party'.
1464 */
1465function getPluginHookCounts(
1466 hooks: MatchedHook[],
1467): Record<string, number> | undefined {
1468 const pluginHooks = hooks.filter(h => h.pluginId)
1469 if (pluginHooks.length === 0) {
1470 return undefined
1471 }
1472 const counts: Record<string, number> = {}
1473 for (const h of pluginHooks) {
1474 const atIndex = h.pluginId!.lastIndexOf('@')
1475 const isOfficial =
1476 atIndex > 0 &&
1477 ALLOWED_OFFICIAL_MARKETPLACE_NAMES.has(h.pluginId!.slice(atIndex + 1))
1478 const key = isOfficial ? h.pluginId! : 'third-party'
1479 counts[key] = (counts[key] || 0) + 1
1480 }
1481 return counts
1482}
1483
1484
1485/**

Callers 2

executeHooksFunction · 0.85
executeHooksOutsideREPLFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected