watch
runbooks watch
Section titled “runbooks watch”This command is intended for authors of Runbooks.
Use runbooks watch to “watch” a runbook.mdx file (or its scripts, checks, or template files) for changes and automatically reload the Runbook as needed.
runbooks watch <path-to-runbook> [flags]Arguments
Section titled “Arguments”<path-to-runbook>- Path to a directory containing therunbook.mdxfile, or to the file itself.
--disable-live-file-reload- Enable executable registry validation. Scripts will not reload from disk when they are updated; instead, you must re-run therunbookscommand to apply script changes. This trades lower convenience for higher security. See Execution Security Model for details.--output-path <path>- Directory where generated files will be written (default:generated)- Can be relative (e.g.,
./output) or absolute (e.g.,/tmp/generated) - Relative paths are resolved from the current working directory
- Can be relative (e.g.,
--no-telemetry- Disable anonymous telemetry. Can also be set viaRUNBOOKS_TELEMETRY_DISABLE=1environment variable.
What it does
Section titled “What it does”When you run runbooks watch:
- Starts the Backend Server - Launches a Go-based HTTP server on port 7825
- Opens Your Browser - Automatically navigates to
http://localhost:7825 - Watches for Changes - Monitors the runbook file for any modifications
- Auto-Reloads - Automatically refreshes the browser when changes are detected (within ~300ms)
Writing a new runbook
Section titled “Writing a new runbook”runbooks watch /path/to/runbookThen in your editor:
- Make changes to
runbook.mdx - Save the file
- See your changes instantly in the browser - no manual refresh needed!
Technical details
Section titled “Technical details”File watching
Section titled “File watching”- Uses
fsnotifyfor efficient file system monitoring - Watches the directory containing your runbook file
- Implements debouncing (300ms) to handle editors that save files multiple times
- Only triggers on Write and Create events for your specific runbook file
Auto-reload mechanism
Section titled “Auto-reload mechanism”- Uses Server-Sent Events (SSE) to push notifications from server to browser
- The browser maintains a persistent connection to
/api/watch/sse - When the file changes, the server sends a
file-changeevent - The browser receives the event and automatically reloads the page