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.
TypeScript
mods: merge poteat/diff-parity; a mark's props, hyphened Choice members and the built-in panel's marks at its call sites, in the tested and linted layout
poteatead880635311
diff --cc mods/diff/hooks/record/mark-outcome/mark-outcome.tsindex 697c5393,917279a8..06225a06--- a/mods/diff/hooks/record/mark-outcome/mark-outcome.ts+++ b/mods/diff/hooks/record/mark-outcome/mark-outcome.ts@@@ -1,5 -1,10 +1,12 @@@+ import type { Host } from '../../host'+/**-- * How a marked feature went: fine, or degraded for a reason (the pane never- * marks `bad`: a failed fetch keeps the last good diff on screen).- * marks `bad`: a failed fetch keeps the last good diff on screen), with the++ * How a marked feature went: fine, or degraded for a reason, with the+ * properties the built-in panel's mark carries beside it.++ *++ * The pane never marks `bad`: a failed fetch keeps the last good diff on++ * screen.*/- export type MarkOutcome = { kind: 'ok' } | { kind: 'sad'; reason: string }+ export type MarkOutcome = ({ kind: 'ok' } | { kind: 'sad'; reason: string }) & {+ props?: Parameters<Host['mark']>[0]['props']+ }diff --cc mods/diff/hooks/record/tabs/tabs.tsindex 00000000,316756ef..6a614b47mode 000000,100644..100644--- a/mods/diff/hooks/record/tabs/tabs.ts+++ b/mods/diff/hooks/record/tabs/tabs.ts@@@ -1,0 -1,5 +1,5 @@@+ /**- * The tabs a tab-switch mark names, the built-in panel's own: the diff, and- * the conversation it closes back to.++ * Where a tab-switch mark says the person went, named as the built-in++ * panel names it: the diff, or the conversation it closes back to.+ */+ export const TABS = ['diff', 'convo'] as constdiff --cc mods/diff/hooks/register.tsindex 641e4d45,89d09dac..2c89db75--- a/mods/diff/hooks/register.ts+++ b/mods/diff/hooks/register.ts@@@ -281,13 -308,12 +303,11 @@@ export function register(on: On)const isManual = trigger === 'manual'await engine.openPane(isManual ? { ...pane, ...Names.FOCUSED_PANE } : pane)isPaneOpen = true-- const record = Record.recorderOf(engine)- record.mark(Record.FEATURES.tabSwitch, { kind: 'ok' })const sessionId = await engine.sessionId().catch(() => null)if (sessionId !== null && sessionId !== shownSessionId) {shownSessionId = sessionId-- record.shown(trigger, Record.widthBucketOf(columns))++ Record.recorderOf(engine).shown(trigger, Record.widthBucketOf(columns))}void refresh(engine)@@@ -296,7 -322,16 +316,13 @@@async function closePane(engine: Host): Promise<void> {await engine.closePane({ id: Names.PANE_ID })isPaneOpen = false- Record.recorderOf(engine).mark(Record.FEATURES.tabSwitch, { kind: 'ok' })+ }+- function markTabSwitch(- engine: Host,- tab: (typeof Record.TABS)[number],- ): void {++ function markTabSwitch(engine: Host, tab: (typeof Record.TABS)[number]) {+ Record.recorderOf(engine).mark(Record.FEATURES.tabSwitch, {+ kind: 'ok',+ props: { tab: { value: tab, of: Record.TABS } },+ })}async function wasDrawnWhenProbed(engine: Host): Promise<boolean> {diff --cc mods/telemetry/hooks/entries/checked-mark.tsindex d570666f,82a7869e..2b5b2310--- a/mods/telemetry/hooks/entries/checked-mark.ts+++ b/mods/telemetry/hooks/entries/checked-mark.ts@@@ -7,9 -8,11 +8,12 @@@ import { TOKEN } from './token/*** The row's fields from one mark, or a refusal naming the first thing- * wrong: the entry's shape, the feature, the kind, then the reason.- * wrong: the entry's shape, the feature, the kind, the reason, then each- * property in turn.++ * wrong: the entry's shape, the feature, the kind, the reason, then props.+ *- * @param entry the feature, kind and reason as the caller passed them++ * Each property is checked in turn, as a log's are.+ *+ * @param entry the feature, kind, reason and properties as the caller passed+ * them* @returns the mark's row fields once the entry passes every check*/export function checkedMark(entry: unknown): Fields {@@@ -32,7 -35,7 +36,7 @@@throw refusal('reason: an ok mark carries none', 'mark')}- return markFieldsOf(kind, feature)- return markFieldsOf(kind, feature, undefined, checkedProps(props, 'mark'))++ return markFieldsOf({ kind, feature, props: checkedProps(props, 'mark') })}if (typeof reason !== 'string' || !TOKEN.test(reason)) {@@@ -42,5 -45,5 +46,10 @@@)}- return markFieldsOf(kind, feature, reason)- return markFieldsOf(kind, feature, reason, checkedProps(props, 'mark'))++ return markFieldsOf({++ kind,++ feature,++ reason,++ props: checkedProps(props, 'mark'),++ })}diff --cc mods/telemetry/hooks/entries/choice-token/choice-token.tsindex e4555079,e64eefb3..c7134702--- a/mods/telemetry/hooks/entries/choice-token/choice-token.ts+++ b/mods/telemetry/hooks/entries/choice-token/choice-token.ts@@@ -1,8 -1,7 +1,8 @@@/**- * The shape of a Choice member: a snake_case token of at most 64- * characters.+ * The shape of a Choice member: a lowercase token of at most 64 characters,- * of letters, digits, `_` and `-`, which may start with a digit (a bucket- * such as `110_to_143`) and carry a hyphen (a kind such as `merge-base`),- * unlike a name or a key (TOKEN).++ * of letters, digits, `_` and `-`.+ *+ * Unlike a name or a key (TOKEN), it may start with a digit (a bucket such- * as `110_to_143`).++ * as `110_to_143`) and carry a hyphen (a kind such as `merge-base`).*/- export const CHOICE_TOKEN = /^[a-z0-9][a-z0-9_]{0,63}$/+ export const CHOICE_TOKEN = /^[a-z0-9][a-z0-9_-]{0,63}$/diff --cc mods/telemetry/hooks/entries/index.tsindex 13bece5e,2a82de01..6ee9ca8e--- a/mods/telemetry/hooks/entries/index.ts+++ b/mods/telemetry/hooks/entries/index.ts@@@ -12,6 -13,6 +13,7 @@@ export * from './fields-ofexport * from './ingest-url.js'export * from './is-mark-kind'export * from './is-record'++export * from './mark'export * from './mark-fields-of'export * from './mark-kinds'export * from './prop-limit'diff --cc mods/telemetry/hooks/entries/mark-fields-of/mark-fields-of.tsindex 81d38919,b7bf86e5..e2a78b14--- a/mods/telemetry/hooks/entries/mark-fields-of/mark-fields-of.ts+++ b/mods/telemetry/hooks/entries/mark-fields-of/mark-fields-of.ts@@@ -1,21 -1,26 +1,25 @@@--import type TelemetryTypes from '../../telemetry-types'import { FEATURE_PREFIX } from '../feature-prefix'import type { Fields } from '../fields'++import type { Mark } from '../mark'/*** One checked mark as its fields: the CLI's own feature event,- * `tengu_feature_<kind>` with `feature_name`, `error_code` when given, and- * the mark's properties merged in as the CLI's feature events merge their- * extras: after `feature_name` on an ok row, and beneath `feature_name` and- * `error_code` on a sad or bad one.+ * `tengu_feature_<kind>` with `feature_name`, and `error_code` when given.*-- * @param kind how the feature went-- * @param feature the feature marked-- * @param reason why, on a sad or bad mark; absent on ok- * @param props the mark's checked properties++ * The mark's properties merge in as the CLI's feature events merge their++ * extras: after `feature_name` on an ok row, and beneath `feature_name`++ * and `error_code` on a sad or bad one.++ *++ * @param mark the feature, how it went, why when not ok, and its checked++ * properties* @returns the event's name and props, ready to log*/--export const markFieldsOf = (-- kind: TelemetryTypes.MarkKind,-- feature: string,-- reason?: string,- props: Readonly<Record<string, string | number | boolean>> = {},--): Fields => ({++export const markFieldsOf = ({++ kind,++ feature,++ reason,++ props,++}: Mark): Fields => ({name: FEATURE_PREFIX + kind,props:reason === undefineddiff --cc mods/telemetry/hooks/entries/mark/index.tsindex 00000000,00000000..c2450bf2new file mode 100644--- /dev/null+++ b/mods/telemetry/hooks/entries/mark/index.ts@@@ -1,0 -1,0 +1,3 @@@++export type * from './mark.js'++++export * as default from '.'diff --cc mods/telemetry/hooks/entries/mark/mark.tsindex 00000000,00000000..f24420abnew file mode 100644--- /dev/null+++ b/mods/telemetry/hooks/entries/mark/mark.ts@@@ -1,0 -1,0 +1,13 @@@++import type TelemetryTypes from '../../telemetry-types'++import type { Fields } from '../fields'++++/**++ * One mark past every check: the feature, how it went, why when not ok,++ * and its properties as they go into the row.++ */++export type Mark = {++ kind: TelemetryTypes.MarkKind++ feature: string++ reason?: string++ props: Fields['props']++}diff --cc mods/telemetry/hooks/telemetry-types/telemetry.tsindex 433d3613,8dc3ff8f..cf1b2551--- a/mods/telemetry/hooks/telemetry-types/telemetry.ts+++ b/mods/telemetry/hooks/telemetry-types/telemetry.ts@@@ -34,11 -36,13 +34,12 @@@ export type Telemetry =* Marks one use of a feature as the CLI's own feature events do, one* `tengu_feature_<kind>` row; resolves once the ingest accepted it.*- * The row carries `feature_name`, and `error_code` on a sad or bad one; it- * joins the product-wide feature surface (queried by `feature_name`), so- * no plugin prefix. `reason` is required on sad and bad, refused on ok.- * The row carries `feature_name`, `error_code` on a sad or bad one, and- * the entry's `props` beside them, checked as `log`'s are; it joins the- * product-wide feature surface (queried by `feature_name`), so no plugin- * prefix. `reason` is required on sad and bad, refused on ok.++ * The row carries `feature_name`, `error_code` on sad or bad (`reason`,++ * required there and refused on ok) and the entry's `props`, checked as++ * `log`'s are; it joins the product-wide feature surface, so no prefix.*- * @param entry the feature, how it went, and why when not ok+ * @param entry the feature, how it went, why when not ok, and the row's+ * properties by snake_case key* @example* await $.telemetry.mark({ feature: "learn_page", kind: "ok" })* await $.telemetry.mark({