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

mods/telemetry: an event already named tengu_ is sent under its own name, any other under the plugin prefixBrowse files
poteat authored on Sep 11, 2026 parent 1c97c29 · commit c84f073d356f
6 changed files+23 -9compared with 1c97c29
Amods/telemetry/hooks/entries/core-event-prefix/core-event-prefix.ts
Amods/telemetry/hooks/entries/core-event-prefix/index.ts
Mmods/telemetry/hooks/entries/event-prefix/event-prefix.ts
Mmods/telemetry/hooks/entries/fields-of/fields-of.ts
Mmods/telemetry/hooks/entries/index.ts
Mmods/telemetry/hooks/telemetry-types/telemetry.ts
@@ -1,0 +1,5 @@
1+/**
2+ * What the CLI's own event names start with: an event already so named is
3+ * sent under its own name, so a built-in's port keeps its built-in's row.
4+ */
5+export const CORE_EVENT_PREFIX = 'tengu_'
@@ -1,0 +1,3 @@
1+export * from './core-event-prefix.js'
2+
3+export * as default from '.'
@@ -1,5 +1,6 @@
11 /**
2- * What every event's name starts with: the plugin-event convention. The
3- * calling built-in's own name is already in the event it passes.
2+ * What an event's name starts with unless the caller named it as the CLI's
3+ * own (CORE_EVENT_PREFIX): the plugin-event convention. The calling
4+ * built-in's own name is already in the event it passes.
45 */
56 export const EVENT_PREFIX = 'tengu_plugin_'
@@ -1,14 +1,16 @@
1+import { CORE_EVENT_PREFIX } from '../core-event-prefix'
12 import { EVENT_PREFIX } from '../event-prefix'
23 import type { Fields } from '../fields'
34
45 /**
5- * One checked entry as its fields, the event under its prefix.
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.
68 *
79 * @param event the event's name as the caller spelled it
810 * @param props the properties as checked
9- * @returns the entry's fields, the event name prefixed and the props attached
11+ * @returns the entry's fields, the event name as sent and the props attached
1012 */
1113 export const fieldsOf = (event: string, props: Fields['props']): Fields => ({
12- name: EVENT_PREFIX + event,
14+ name: event.startsWith(CORE_EVENT_PREFIX) ? event : EVENT_PREFIX + event,
1315 props,
1416 })
@@ -3,6 +3,7 @@
33 export * from './checked-mark.js'
44 export * from './checked-value'
55 export * from './choices-limit'
6+export * from './core-event-prefix'
67 export * from './event-prefix'
78 export * from './feature-prefix'
89 export * from './fields'
@@ -14,11 +14,13 @@
1414 * resolves once the ingest accepted it.
1515 *
1616 * The noun cannot see its caller, so the calling built-in names itself in
17- * `event` and this adds the prefix. A value is a finite number, a boolean
18- * or a Choice; free text is refused. One input, as every op on `$` takes.
17+ * `event` and this adds the prefix; an event already named `tengu_…`, a
18+ * built-in port's own row, is sent under that name. A value is a finite
19+ * number, a boolean or a Choice; free text is refused. One input, as every
20+ * op on `$` takes.
1921 *
20- * @param entry the event's name after the prefix, a snake_case token, and
21- * its properties by snake_case key
22+ * @param entry the event's name, a snake_case token, and its properties by
23+ * snake_case key
2224 * @example
2325 * await $.telemetry.log({
2426 * event: "suggest_learning_survey_answered",