Watch Mode
Automatically regenerate interfaces when models change
Watch Mode
Watch mode monitors your models directory and automatically regenerates the TypeScript file whenever a model file changes. It's designed for development workflows where you want instant feedback.
Starting the watcher
php artisan oi:gen-ts --watchThe command stays running, watching for file changes in your models directory. When a change is detected, it regenerates the output file and reports the result.
How it works
The watcher monitors all .php files in app/Models (and any additional paths configured for model discovery). When any file is modified, the full generation pipeline runs again.
Typical workflow
Open two terminal windows:
Terminal 1 — frontend dev server:
npm run devTerminal 2 — model watcher:
php artisan oi:gen-ts --watchNow when you update a model, the TypeScript interfaces are regenerated automatically, and your frontend dev server picks up the new types without any manual steps.
Stopping the watcher
Press Ctrl+C to stop the watcher.