Watch mode
Watch mode reloads the runbook in the app each time you save runbook.mdx. It is meant for runbook authors.
Activating watch mode
Section titled “Activating watch mode”Pass --watch when you launch the app from the command line:
runbooks open --watch RUNBOOK_SOURCEThen edit runbook.mdx in your editor and save it. The app shows the change about 300ms later.
Watch mode stays on for every runbook you open until you quit the app.
--watch and --disable-live-file-reload are read only when they start the app. If Runbooks is already running, a second runbooks command opens the runbook in the existing window with that window’s modes, whatever flags it passes. To change modes, quit Runbooks first.
Arguments
Section titled “Arguments”RUNBOOK_SOURCE is a local path or remote URL that points to a runbook.mdx file or to the directory that contains one. See runbooks open for the remote URL formats.
--disable-live-file-reload keeps the executable registry that was built when the runbook was opened in this app session. Opening another runbook and coming back rebuilds it. Reloads still update what the app shows, but Runbooks keeps executing the original commands and scripts, and blocks whose script has changed show a “Script changed” warning. A block that runs a script file offers to reload that script from the warning.
Technical details
Section titled “Technical details”File watching
Section titled “File watching”- Runbooks watches the directory that contains your runbook file with
chokidar, so it still sees editors that save by replacing the file. - It does not watch subdirectories, such as cloned repositories or generated output.
- It reacts only to write and create events for the runbook file. Changes to other files in the directory are ignored.
- It waits 300ms after the last event, so an editor that saves a file several times triggers one reload.
- Script files that blocks run are watched separately, with or without
--watch. A change to one never reloads the runbook: its block shows the “Script changed” notice.
Reloading
Section titled “Reloading”- When the file changes, the main process sends a
watch:file-changeIPC event to the renderer. - The renderer reloads the runbook, which re-reads the file and rebuilds the executable registry unless
--disable-live-file-reloadis set. - A reload keeps the session. Environment variables that blocks exported, and the directory a block moved to with
cd, stay as they were. Re-opening the runbook starts its blocks from the runbook’s directory again.