spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / agents-md / tests / fixtures / recording.ts
29 lines · 821 BRaw
1import type { Plugin } from 'claude-code/testing'
2
3/**
4 * A plugin standing in for the telemetry built-in: it adds the `telemetry`
5 * noun at `engine.create` over the nouns beneath.
6 *
7 * Its `log` and `mark` write the entry they are handed as one `$.ui.log`
8 * line, `<op> <json>`, which startedOf keeps and rowsOf reads back.
9 */
10export const RECORDING: Plugin = {
11 name: 'recording',
12 tier: 'builtin',
13 register(on) {
14 on('engine.create', async ($, e, next) => {
15 const beneath = await next(e)
16 const built = { ...beneath }
17 built.telemetry = {
18 log: async entry => {
19 await beneath.ui.log(`log ${JSON.stringify(entry)}`)
20 },
21 mark: async entry => {
22 await beneath.ui.log(`mark ${JSON.stringify(entry)}`)
23 },
24 }
25
26 return built
27 })
28 },
29}