Skip to content

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.

Terminal window
runbooks watch <path-to-runbook> [flags]
  • <path-to-runbook> - Path to a directory containing the runbook.mdx file, 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 the runbooks command 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
  • --no-telemetry - Disable anonymous telemetry. Can also be set via RUNBOOKS_TELEMETRY_DISABLE=1 environment variable.

When you run runbooks watch:

  1. Starts the Backend Server - Launches a Go-based HTTP server on port 7825
  2. Opens Your Browser - Automatically navigates to http://localhost:7825
  3. Watches for Changes - Monitors the runbook file for any modifications
  4. Auto-Reloads - Automatically refreshes the browser when changes are detected (within ~300ms)
Terminal window
runbooks watch /path/to/runbook

Then in your editor:

  1. Make changes to runbook.mdx
  2. Save the file
  3. See your changes instantly in the browser - no manual refresh needed!
  • Uses fsnotify for 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
  • 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-change event
  • The browser receives the event and automatically reloads the page