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: a Choice member may start with a digit; names and keys still start with a letterBrowse files
poteat authored on Sep 11, 2026 parent c84f073 · commit 9f306ce9259b
6 changed files+18 -6compared with c84f073
Mmods/telemetry/hooks/entries/checked-value/checked-value.ts
Amods/telemetry/hooks/entries/choice-token/choice-token.ts
Amods/telemetry/hooks/entries/choice-token/index.ts
Mmods/telemetry/hooks/entries/index.ts
Mmods/telemetry/hooks/entries/token/token.ts
Mmods/telemetry/hooks/telemetry-types/choice/choice.ts
@@ -1,7 +1,7 @@
1+import { CHOICE_TOKEN } from '../choice-token'
12 import { CHOICES_LIMIT } from '../choices-limit'
23 import { isRecord } from '../is-record'
34 import { refusal } from '../refusal'
4-import { TOKEN } from '../token'
55
66 /**
77 * One property's value as it goes into the metadata: a finite number, a
@@ -49,7 +49,9 @@
4949 const isTokenList =
5050 members.length > 0 &&
5151 members.length <= CHOICES_LIMIT &&
52- members.every(member => typeof member === 'string' && TOKEN.test(member))
52+ members.every(
53+ member => typeof member === 'string' && CHOICE_TOKEN.test(member),
54+ )
5355
5456 if (!isTokenList) {
5557 throw refusal(
@@ -1,0 +1,6 @@
1+/**
2+ * The shape of a Choice member: a snake_case token of at most 64 characters,
3+ * which may start with a digit (a bucket such as `110_to_143`), unlike a name
4+ * or a key (TOKEN).
5+ */
6+export const CHOICE_TOKEN = /^[a-z0-9][a-z0-9_]{0,63}$/
@@ -1,0 +1,3 @@
1+export * from './choice-token.js'
2+
3+export * as default from '.'
@@ -2,6 +2,7 @@
22 export * from './checked-fields.js'
33 export * from './checked-mark.js'
44 export * from './checked-value'
5+export * from './choice-token'
56 export * from './choices-limit'
67 export * from './core-event-prefix'
78 export * from './event-prefix'
@@ -1,5 +1,5 @@
11 /**
2- * The shape of an event name, a property key and a Choice member: a
3- * snake_case token of at most 64 characters, starting with a letter.
2+ * The shape of an event name and a property key: a snake_case token of at
3+ * most 64 characters, starting with a letter (a Choice member: CHOICE_TOKEN).
44 */
55 export const TOKEN = /^[a-z][a-z0-9_]{0,63}$/
@@ -2,7 +2,7 @@
22 * A string property: the value and the list it is chosen from, declared
33 * beside it, so no free text reaches the row.
44 *
5- * Every member of `of` is a snake_case token, at most CHOICES_LIMIT of
6- * them; `value` is one of them.
5+ * Every member of `of` is a snake_case token, which may start with a digit,
6+ * at most CHOICES_LIMIT of them; `value` is one of them.
77 */
88 export type Choice = { value: string; of: readonly string[] }