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 / hooks / entries / fields-of / fields-of.ts
16 lines · 635 BRaw
1import { CORE_EVENT_PREFIX } from '../core-event-prefix'
2import { EVENT_PREFIX } from '../event-prefix'
3import type { Fields } from '../fields'
4
5/**
6 * One checked entry as its fields: an event already named as the CLI's own
7 * keeps its name, any other goes under the plugin prefix.
8 *
9 * @param event the event's name as the caller spelled it
10 * @param props the properties as checked
11 * @returns the entry's fields, the event name as sent and the props attached
12 */
13export const fieldsOf = (event: string, props: Fields['props']): Fields => ({
14 name: event.startsWith(CORE_EVENT_PREFIX) ? event : EVENT_PREFIX + event,
15 props,
16})