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 / mark-fields-of / mark-fields-of.ts
24 lines · 756 BRaw
1import type TelemetryTypes from '../../telemetry-types'
2import { FEATURE_PREFIX } from '../feature-prefix'
3import type { Fields } from '../fields'
4
5/**
6 * One checked mark as its fields: the CLI's own feature event,
7 * `tengu_feature_<kind>` with `feature_name`, and `error_code` when given.
8 *
9 * @param kind how the feature went
10 * @param feature the feature marked
11 * @param reason why, on a sad or bad mark; absent on ok
12 * @returns the event's name and props, ready to log
13 */
14export const markFieldsOf = (
15 kind: TelemetryTypes.MarkKind,
16 feature: string,
17 reason?: string,
18): Fields => ({
19 name: FEATURE_PREFIX + kind,
20 props:
21 reason === undefined
22 ? { feature_name: feature }
23 : { feature_name: feature, error_code: reason },
24})