MCPcopy
hub / github.com/codeaashu/claude-code / maybeRecordPluginHint

Function maybeRecordPluginHint

src/utils/plugins/hintRecommendation.ts:65–89  ·  view source on GitHub ↗
(hint: ClaudeCodeHint)

Source from the content-addressed store, hash-verified

63 * later in resolvePluginHint (hook side).
64 */
65export function maybeRecordPluginHint(hint: ClaudeCodeHint): void {
66 if (!getFeatureValue_CACHED_MAY_BE_STALE('tengu_lapis_finch', false)) return
67 if (hasShownHintThisSession()) return
68
69 const state = getGlobalConfig().claudeCodeHints
70 if (state?.disabled) return
71
72 const shown = state?.plugin ?? []
73 if (shown.length >= MAX_SHOWN_PLUGINS) return
74
75 const pluginId = hint.value
76 const { name, marketplace } = parsePluginIdentifier(pluginId)
77 if (!name || !marketplace) return
78 if (!isOfficialMarketplaceName(marketplace)) return
79 if (shown.includes(pluginId)) return
80 if (isPluginInstalled(pluginId)) return
81 if (isPluginBlockedByPolicy(pluginId)) return
82
83 // Bound repeat lookups on the same slug — a CLI that emits on every
84 // invocation shouldn't trigger N resolve cycles for the same plugin.
85 if (triedThisSession.has(pluginId)) return
86 triedThisSession.add(pluginId)
87
88 setPendingHint(hint)
89}
90
91const triedThisSession = new Set<string>()
92

Callers 2

callFunction · 0.85
callFunction · 0.85

Calls 10

hasShownHintThisSessionFunction · 0.85
getGlobalConfigFunction · 0.85
parsePluginIdentifierFunction · 0.85
isPluginInstalledFunction · 0.85
isPluginBlockedByPolicyFunction · 0.85
setPendingHintFunction · 0.85
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected