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
| @@ -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 @@ | ||
| 1 | 1 | /** |
| 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. | |
| 4 | 5 | */ |
| 5 | 6 | export const EVENT_PREFIX = 'tengu_plugin_' |
| @@ -1,14 +1,16 @@ | ||
| 1 | +import { CORE_EVENT_PREFIX } from '../core-event-prefix' | |
| 1 | 2 | import { EVENT_PREFIX } from '../event-prefix' |
| 2 | 3 | import type { Fields } from '../fields' |
| 3 | 4 | |
| 4 | 5 | /** |
| 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. | |
| 6 | 8 | * |
| 7 | 9 | * @param event the event's name as the caller spelled it |
| 8 | 10 | * @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 | |
| 10 | 12 | */ |
| 11 | 13 | 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, | |
| 13 | 15 | props, |
| 14 | 16 | }) |
| @@ -3,6 +3,7 @@ | ||
| 3 | 3 | export * from './checked-mark.js' |
| 4 | 4 | export * from './checked-value' |
| 5 | 5 | export * from './choices-limit' |
| 6 | +export * from './core-event-prefix' | |
| 6 | 7 | export * from './event-prefix' |
| 7 | 8 | export * from './feature-prefix' |
| 8 | 9 | export * from './fields' |
| @@ -14,11 +14,13 @@ | ||
| 14 | 14 | * resolves once the ingest accepted it. |
| 15 | 15 | * |
| 16 | 16 | * 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. | |
| 19 | 21 | * |
| 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 | |
| 22 | 24 | * @example |
| 23 | 25 | * await $.telemetry.log({ |
| 24 | 26 | * event: "suggest_learning_survey_answered", |