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,7 +1,7 @@ | ||
| 1 | +import { CHOICE_TOKEN } from '../choice-token' | |
| 1 | 2 | import { CHOICES_LIMIT } from '../choices-limit' |
| 2 | 3 | import { isRecord } from '../is-record' |
| 3 | 4 | import { refusal } from '../refusal' |
| 4 | -import { TOKEN } from '../token' | |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * One property's value as it goes into the metadata: a finite number, a |
| @@ -49,7 +49,9 @@ | ||
| 49 | 49 | const isTokenList = |
| 50 | 50 | members.length > 0 && |
| 51 | 51 | 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 | + ) | |
| 53 | 55 | |
| 54 | 56 | if (!isTokenList) { |
| 55 | 57 | 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 @@ | ||
| 2 | 2 | export * from './checked-fields.js' |
| 3 | 3 | export * from './checked-mark.js' |
| 4 | 4 | export * from './checked-value' |
| 5 | +export * from './choice-token' | |
| 5 | 6 | export * from './choices-limit' |
| 6 | 7 | export * from './core-event-prefix' |
| 7 | 8 | export * from './event-prefix' |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /** |
| 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). | |
| 4 | 4 | */ |
| 5 | 5 | export const TOKEN = /^[a-z][a-z0-9_]{0,63}$/ |
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | * A string property: the value and the list it is chosen from, declared |
| 3 | 3 | * beside it, so no free text reaches the row. |
| 4 | 4 | * |
| 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. | |
| 7 | 7 | */ |
| 8 | 8 | export type Choice = { value: string; of: readonly string[] } |