cyberneticlibrary

Sync schema fields with disk state

sync-schemascommandsetup L22
motlin/claude-code-plans
What it does

Add missing optional fields to Zod schemas to match real on-disk data

Best for

Iterative tightening of schemas to match real data without losing type strictness

Inputs
  • · vitest failures from disk-validation tests
  • · actual JSONL/JSON/settings files
  • · current Zod schema definitions
Outputs
  • · updated schema files with .optional() fields
  • · passing disk-validation tests
Requires
  • · npm/vitest
  • · jq for parsing disk data
Preconditions
  • · vitest test suite exists
  • · unrecognized_keys or type mismatch failures
Failure modes
  • · field type inferred wrong from disk values
  • · field genuinely requires z.unknown() (weakness)
Trust signals
  • · reads actual on-disk values before choosing type
  • · dry-run via vitest first
  • · maintains .strict() on objects
  • · groups failures by schema+key for dedup