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
28 lines · 882 BRaw
1import { FEATURE_PREFIX } from '../feature-prefix'
2import type { Fields } from '../fields'
3import type { Mark } from '../mark'
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 * The mark's properties merge in as the CLI's feature events merge their
10 * extras: after `feature_name` on an ok row, and beneath `feature_name`
11 * and `error_code` on a sad or bad one.
12 *
13 * @param mark the feature, how it went, why when not ok, and its checked
14 * properties
15 * @returns the event's name and props, ready to log
16 */
17export const markFieldsOf = ({
18 kind,
19 feature,
20 reason,
21 props,
22}: Mark): Fields => ({
23 name: FEATURE_PREFIX + kind,
24 props:
25 reason === undefined
26 ? { feature_name: feature, ...props }
27 : { ...props, feature_name: feature, error_code: reason },
28})