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 | /** |
| 2 | * The `$.telemetry` noun as this plugin calls it, declared for a build of |
| 3 | * this folder on its own; no module imports it. |
| 4 | * |
| 5 | * The telemetry plugin adds the noun in the engine.create fold on internal |
| 6 | * builds and nowhere else: where no plugin provides it the calls throw and |
| 7 | * record/ drops the row. The engine's repository leaves this file out. |
| 8 | * |
| 9 | * @entry |
| 10 | */ |
| 11 | declare module 'claude-code' { |
| 12 | /** |
| 13 | * How one use of a feature went: as hoped, degraded, or failed outright. |
| 14 | */ |
| 15 | type DiffTelemetryMarkKind = 'ok' | 'sad' | 'bad' |
| 16 | |
| 17 | /** |
| 18 | * A string property: the value and the list it is chosen from. |
| 19 | */ |
| 20 | type DiffTelemetryChoice = { value: string; of: readonly string[] } |
| 21 | |
| 22 | /** |
| 23 | * One property value a row may carry. |
| 24 | */ |
| 25 | type DiffTelemetryProp = number | boolean | DiffTelemetryChoice |
| 26 | |
| 27 | /** |
| 28 | * What `$.telemetry.log` takes: the event's name after the prefix, and |
| 29 | * its properties by snake_case key. |
| 30 | */ |
| 31 | type DiffTelemetryLogEntry = { |
| 32 | event: string |
| 33 | props?: Readonly<Record<string, DiffTelemetryProp>> |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * What `$.telemetry.mark` takes: the feature, how it went, and why when |
| 38 | * not ok. |
| 39 | */ |
| 40 | type DiffTelemetryMarkEntry = { |
| 41 | feature: string |
| 42 | kind: DiffTelemetryMarkKind |
| 43 | reason?: string |
| 44 | } |
| 45 | |
| 46 | interface EngineInterface { |
| 47 | /** |
| 48 | * A plugin's analytics, one first-party row per call; present only |
| 49 | * where the telemetry plugin is seated. |
| 50 | */ |
| 51 | telemetry: { |
| 52 | log: (entry: DiffTelemetryLogEntry) => Promise<void> |
| 53 | mark: (entry: DiffTelemetryMarkEntry) => Promise<void> |
| 54 | } |
| 55 | } |
| 56 | } |