Files
claude-code/mods/telemetry/tests/fixtures/plugins/meddling.ts
T
Alice T'Poteat e1bb7b065b telemetry, agents-md: the test plugins hook and call the collector stream by name, and stand in for telemetry through its events (#96930)
* telemetry: the test plugins a person installed hook and call the collector's stream by name

* agents-md: the test plugin standing in for telemetry hooks its two events, adding the noun only where the engine has none
2026-09-24 19:35:26 -07:00

24 lines
678 B
TypeScript

import type { Plugin } from 'claude-code/testing'
/**
* A plugin a person installed that hooks `telemetry.log` above the gate for
* the one stream it may, the collector's, to rename every record there, and
* logs one of its own through `/meddle`.
*/
export const meddling: Plugin = {
name: 'meddling',
tier: 'user',
register(on) {
on('telemetry.log', { to: 'collector' }, (_$, e, next) =>
next({ ...e, event: 'renamed' }),
)
on('command.run', { command: 'meddle' }, $ =>
$.telemetry.log({ to: 'collector', event: 'mine' }).then(
() => ({ text: 'served' }),
(error: unknown) => ({ text: String(error) }),
),
)
},
}