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

Function logPluginsEnabledForSession

src/utils/telemetry/pluginTelemetry.ts:191–224  ·  view source on GitHub ↗
(
  plugins: LoadedPlugin[],
  managedNames: Set<string> | null,
  seedDirs: string[],
)

Source from the content-addressed store, hash-verified

189 * A plugin with 5 skills emits 5 skill_loaded rows but 1 of these.
190 */
191export function logPluginsEnabledForSession(
192 plugins: LoadedPlugin[],
193 managedNames: Set<string> | null,
194 seedDirs: string[],
195): void {
196 for (const plugin of plugins) {
197 const { marketplace } = parsePluginIdentifier(plugin.repository)
198
199 logEvent('tengu_plugin_enabled_for_session', {
200 _PROTO_plugin_name:
201 plugin.name as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
202 ...(marketplace && {
203 _PROTO_marketplace_name:
204 marketplace as AnalyticsMetadata_I_VERIFIED_THIS_IS_PII_TAGGED,
205 }),
206 ...buildPluginTelemetryFields(plugin.name, marketplace, managedNames),
207 enabled_via: getEnabledVia(
208 plugin,
209 managedNames,
210 seedDirs,
211 ) as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
212 skill_path_count:
213 (plugin.skillsPath ? 1 : 0) + (plugin.skillsPaths?.length ?? 0),
214 command_path_count:
215 (plugin.commandsPath ? 1 : 0) + (plugin.commandsPaths?.length ?? 0),
216 has_mcp: plugin.manifest.mcpServers !== undefined,
217 has_hooks: plugin.hooksConfig !== undefined,
218 ...(plugin.manifest.version && {
219 version: plugin.manifest
220 .version as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
221 }),
222 })
223 }
224}
225
226/**
227 * Bounded-cardinality error bucket for CLI plugin operation failures.

Callers 1

logSessionTelemetryFunction · 0.85

Calls 4

parsePluginIdentifierFunction · 0.85
logEventFunction · 0.85
getEnabledViaFunction · 0.85

Tested by

no test coverage detected