/** * Field catalog for the interactive settings editor (`config edit`) and the * full `config show` rendering. Pure module: no TTY, no fs. * * Validation is NOT duplicated here — every field points at its zod schema * from src/config/schema.ts (`SectionSchema.shape.`), so ranges and * enums live exactly once. The drift-guard tests assert catalog keys match * the schema shapes in both directions. */ import type { z } from 'zod'; import type { RawAppConfig } from '../config/schema.js'; export type SectionId = 'general' | 'server' | 'send' | 'attachments' | 'scheduler' | 'watcher' | 'verification' | 'cache' | 'hooks' | 'alerts'; export type FieldKind = 'boolean' | 'int' | 'string' | 'enum' | 'string-array' | 'enum-array'; export interface FieldDescriptor { /** snake_case key, exactly as in config.toml. */ key: string; /** Prompt label, includes the valid range for ints. */ label: string; kind: FieldKind; /** The field's zod schema — the single source of validation truth. */ schema: z.ZodType; /** Choices for enum / enum-array fields. */ options?: readonly string[]; /** Empty input deletes the key instead of storing ''. */ optional?: boolean; /** Rendering for an empty array / unset value, e.g. '(all)'. */ emptyLabel?: string; /** Never render the value (menus, diffs, config show) — mask it. */ secret?: boolean; } export interface SectionDescriptor { id: SectionId; label: string; fields: FieldDescriptor[]; /** The mutable snake_case section object inside a raw config. */ resolve(raw: RawAppConfig): Record; /** One-line current-state summary for the section picker. */ summarize(raw: RawAppConfig): string; } export interface FieldChange { key: string; before: string; after: string; } export declare const SETTINGS_SECTIONS: SectionDescriptor[]; export declare function resolveSection(id: string | undefined): SectionDescriptor | undefined; /** Render a field value as a single short line for menus and diffs. */ export declare function formatFieldValue(f: FieldDescriptor, value: unknown): string; /** Convert raw prompt input into the value stored in the config object. */ export declare function parseFieldInput(f: FieldDescriptor, input: string): unknown; /** clack `validate` hook: parse, then let the field's zod schema judge. */ export declare function validateFieldInput(f: FieldDescriptor, input: string): string | undefined; /** Changed fields between two section objects, rendered for display. */ export declare function diffSection(section: SectionDescriptor, before: Record, after: Record): FieldChange[]; //# sourceMappingURL=settings-fields.d.ts.map