Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

zyvor dev

Generates once, then watches your schema and regenerates on every save.

zyvor dev

Output

πŸ‘€ Watching .zyvor/schema.zyvor for changes...
   Press Ctrl+C to stop

βœ… Generated 13 modular files in ".zyvor/generated"
  βœ… Generated: .zyvor/generated/ (modular)
  βœ… Generated: .zyvor/migrations/0001_initial.sql
  πŸ’Ύ Snapshot saved

On a schema change:

πŸ”„ Schema change detected! Regenerating...
  πŸ”„ Schema change detected! Generated: 0002_schema_update.sql
  πŸ’Ύ Snapshot saved
βœ… Regeneration complete

What it does each cycle

  1. read β†’ lex β†’ parse β†’ validate
  2. compare source against migrations/snapshot.json
  3. if unchanged: πŸ“‹ Schema unchanged. Skipping. β€” nothing written
  4. if changed: write modular entities, regenerate initial SQL, diff against the old snapshot, write an auto-numbered diff migration, save the new snapshot

A 300 ms debounce absorbs the double-write some editors do on save.

How to use it

Leave it running in one terminal. Work in another:

# terminal 1
zyvor dev

# terminal 2
zyvor migrate --apply
cargo run

dev never touches your database. It only writes files. Applying is a separate, deliberate step.

Errors don’t kill the watcher

If you save a broken schema mid-edit, you get:

❌ Regeneration failed: <error>

The watcher keeps running. Fix the schema, save again, and it recovers. Your previously generated files stay on disk untouched.

Requires init first

No .zyvor/schema.zyvor found. Run 'zyvor init' first.