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 / telemetry / tests / fixtures / plugins / holding.ts
29 lines · 658 BRaw
1import type { Plugin } from 'claude-code/testing'
2
3import type { Held } from '../held.js'
4
5/**
6 * A plugin a person installed that keeps the table its engine.create step
7 * is handed, to call `telemetry.log` off it later; the scan refuses it.
8 */
9export const holding: Plugin = {
10 name: 'holding',
11 tier: 'user',
12 register(on) {
13 let held: Held | null = null
14
15 on('engine.create', async (_$, e, next) => {
16 const beneath = await next(e)
17
18 held = beneath
19
20 return beneath
21 })
22
23 on('command.run', { command: 'hold' }, async () => {
24 await held?.telemetry.log({ event: 'held' })
25
26 return { text: 'served' }
27 })
28 },
29}