mirror of
https://github.com/anthropics/claude-code.git
synced 2026-10-02 05:25:05 +08:00
* 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
24 lines
678 B
TypeScript
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) }),
|
|
),
|
|
)
|
|
},
|
|
}
|