@zodal/dials-codegen
v0.1.0
Published
Machine-interface emit for zodal-dials: JSON Schema (editor autocomplete), toPrompt (AI), and CLI helpers (get/set/list --show-origin)
Readme
@zodal/dials-codegen
Machine-interface emit for zodal-dials: a JSON Schema (editor autocomplete/validation for the settings file), an AI prompt, and CLI helpers.
npm i @zodal/dials-codegen @zodal/dials-coreimport { toJsonSchema, toPrompt, runCli } from '@zodal/dials-codegen';
// 1. JSON Schema — point a settings file's "$schema" at it for autocomplete (flat dotted keyspace,
// secret values redacted, $schema pointer allowed):
writeFile('dials.schema.json', JSON.stringify(toJsonSchema(dials, { $id: 'https://x/dials.schema.json' })));
// 2. AI prompt — let an assistant help the user configure:
toPrompt(dials); // "# Settings\n- `editor.theme` (enum: light | dark | system, default "system") — …"
// 3. CLI — get/set/list with provenance, secrets masked:
runCli(['list', '--show-origin'], { dials, stack, layer });
// editor.fontSize = 16 (user)
// editor.theme = "dark" (workspace)
runCli(['set', 'editor.fontSize', '18'], ctx); // validates against the field; returns a new layertoJsonSchema— secret defaults/enums/consts redacted;requireddropped (overrides are optional); a$schemaproperty added so the file's own pointer validates.toPrompt— secrets marked[secret], never carrying their value.- CLI (
runCli/formatList/formatGet/coerceByType) — pure & IO-free;list --show-originsurfaces cascade provenance (à lagit config --show-origin);setvalidates and never echoes a secret; secrets always masked.
Part of the zodal-dials ecosystem.
