open
runbooks open opens a runbook in the Runbooks desktop app.
runbooks open RUNBOOK_SOURCE [flags]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.
Local paths
Section titled “Local paths”runbooks open ./path/to/runbookrunbooks open /absolute/path/to/runbookrunbooks open ./path/to/runbook.mdxBecause open is the command name, write a folder that is named open as a path: runbooks open ./open.
Remote sources
Section titled “Remote sources”You can open a runbook directly from a GitHub or GitLab repo, or from a repo on any other git host, without cloning it first. The source can point at the repo root, at a directory containing a runbook.mdx, or at a runbook file. The same sources work in the desktop app’s Open from URL dialog.
Browser URLs
Section titled “Browser URLs”Copy the URL from your browser’s address bar while viewing the runbook’s directory or its runbook.mdx:
runbooks open https://github.com/org/repo/tree/main/runbooks/setup-vpcrunbooks open https://github.com/org/repo/blob/main/runbooks/setup-vpc/runbook.mdxrunbooks open https://gitlab.com/group/subgroup/repo/-/tree/main/runbooks/setup-vpc| Format | Example |
|---|---|
| GitHub directory | https://github.com/org/repo/tree/main/runbooks/setup-vpc |
| GitHub file | https://github.com/org/repo/blob/main/runbooks/setup-vpc/runbook.mdx |
| GitLab directory | https://gitlab.com/group/repo/-/tree/main/runbooks/setup-vpc |
| GitLab file | https://gitlab.com/group/repo/-/blob/main/runbooks/setup-vpc/runbook.mdx |
| Repo root | https://github.com/org/repo |
The branch, tag or commit in the URL is used. Branch names that contain slashes (release/v1) work. So do commit permalinks (/blob/<sha>/...) and query strings or anchors the browser adds, such as GitLab’s ?ref_type=heads. For github.com and gitlab.com, the https:// prefix is optional.
Directory and file URLs from GitHub Enterprise and self-hosted GitLab work too, and need the https:// prefix. A repo root URL on one of those hosts works only when Runbooks can tell which kind of host it is:
- A GitHub Enterprise Cloud host on
ghe.com, or a GitHub Enterprise Server host you logged in to withgh auth loginor named inGH_HOST. - A GitLab host with
gitlabas a dot- or hyphen-separated part of its name, such asgitlab.example.comorgitlab-ce.corp.net.
For a repo root on any other host, use a git:: source.
Git sources in go-getter syntax
Section titled “Git sources in go-getter syntax”Runbooks also accepts git sources written in go-getter syntax, the syntax of a Terragrunt source and of an OpenTofu or Terraform module source. A double slash (//) separates the repo from the path inside it. ?ref= picks a branch, tag or commit. Without ?ref=, Runbooks uses the repo’s default branch.
runbooks open github.com/org/repo//runbooks/setup-vpc?ref=v1.0runbooks open github.com/org/repo//runbooks/setup-vpc/runbook.mdxrunbooks open gitlab.com/group/subgroup/repo//runbooks/setup-vpc?ref=mainrunbooks open "git::https://git.example.com/org/repo.git//runbooks/setup-vpc?ref=main"runbooks open "git@github.com:org/repo.git//runbooks/setup-vpc?ref=v1.0"| Format | Example |
|---|---|
| GitHub shorthand | github.com/org/repo//runbooks/setup-vpc?ref=v1.0 |
| GitLab shorthand | gitlab.com/group/subgroup/repo//runbooks/setup-vpc?ref=v1.0 |
| Any git host over HTTPS | git::https://git.example.com/org/repo.git//runbooks/setup-vpc?ref=main |
| SSH | git::ssh://git@github.com/org/repo.git//runbooks/setup-vpc or git@github.com:org/repo.git//runbooks/setup-vpc |
As in go-getter, github.com/org/repo/runbooks/setup-vpc (without the //) also works, because a GitHub repo is always owner/repo. GitLab projects can sit under nested groups, so GitLab shorthand needs the // to mark where the path starts. Quote sources that contain ? or & so your shell leaves them alone.
Runbooks parses these sources itself and fetches them with git. It doesn’t use the go-getter library, so it differs from go-getter in a few places:
- Runbooks recognizes scheme-less shorthand for
github.comandgitlab.comonly.runbooks openreads any other scheme-less source,bitbucket.org/org/repoincluded, as a local path. For other hosts, usegit::https://. git::takes a fullhttps://,http://orssh://URL, or agit@host:pathaddress. Runbooks rejectsgit::github.com/org/repo.- Git over HTTPS, HTTP or SSH is the only way Runbooks fetches. go-getter’s other getters (
s3::,gcs::,hg::) and archive URLs such ashttps://example.com/runbook.zipdon’t work, and Runbooks rejectsgit::file://. ?ref=is the only query parameter Runbooks reads. It ignoresdepth,sshkeyand any others.- A
+in?ref=stays a+(?ref=v1.0.0+build.1), where go-getter reads it as a space.
Authentication for private repos
Section titled “Authentication for private repos”Public repositories need no authentication. For a private repository:
- On GitHub, set the
GITHUB_TOKENorGH_TOKENenvironment variable, or rungh auth login. - On GitLab, set the
GITLAB_TOKENenvironment variable, or runglab auth login.
A token in an environment variable is sent only to github.com or gitlab.com unless you name another host:
- For GitHub Enterprise Server, set
GH_ENTERPRISE_TOKENandGH_HOST=<host>, or rungh auth login --hostname <host>. - For a GitHub Enterprise Cloud tenant on
ghe.com, setGITHUB_TOKENandGH_HOST=<host>. - For self-hosted GitLab, set
GITLAB_TOKENandGITLAB_HOST=<host>, or runglab auth login --hostname <host>.
These tokens are used only for HTTPS sources. SSH sources (git@... or ssh://...) authenticate with your SSH keys, so the key must be loaded in your SSH agent and the host must already be in ~/.ssh/known_hosts.
| Flag | Effect |
|---|---|
--watch |
Turns on watch mode, which reloads the runbook when you save it. |
--no-telemetry |
Turns off anonymous telemetry. Setting RUNBOOKS_TELEMETRY_DISABLE=1 does the same. |
--verbose |
Keeps the command attached to the terminal and prints the app’s logs there until you quit Runbooks. Use it to troubleshoot a launch that shows no window. It shows logs only for a Runbooks it starts. If Runbooks is already running, the command hands the runbook to it and exits. |
What it does
Section titled “What it does”Like code ., runbooks open gives you your prompt back right away without printing anything. Runbooks then carries on in the background:
- For a remote source, it clones the repository that holds the runbook. If the download fails, for example because a private repo has no token, the app shows an error dialog that explains why.
- It opens the Runbooks window and renders the
runbook.mdxfile. - It keeps running until you quit it, even if you close the terminal you started it from.
If the app is already running, a second invocation focuses the existing window and opens the new runbook in it. A relative path is resolved from the directory you ran the command in.
Troubleshooting
Section titled “Troubleshooting”Nothing happens
Section titled “Nothing happens”The command doesn’t show the app’s output, so a launch that fails is silent. Run the same command again with --verbose to see the app’s logs in the terminal. If Runbooks is already running, even with no window, quit it first, or --verbose hands the runbook to it and exits without showing its logs. To quit a Runbooks with no window, end its process in Activity Monitor on macOS, your system monitor on Linux, or Task Manager on Windows.
“Runbooks was not found”
Section titled ““Runbooks was not found””The runbooks command records where Runbooks is installed. If you moved or reinstalled Runbooks, open it and install the command again.
Runbook not found
Section titled “Runbook not found”Check that the path points to a runbook.mdx file or a directory containing one. For a remote source, check that the path exists at the branch, tag or commit you named. A source in go-getter syntax without ?ref= reads the repo’s default branch.
Authentication errors for remote runbooks
Section titled “Authentication errors for remote runbooks”If you see “authentication required”, set the token for the git host as described in Authentication for private repos.
Run from a folder that was deleted
Section titled “Run from a folder that was deleted”If your terminal is still in a folder that has since been deleted (a removed git worktree, for example), your shell prints a warning like this when you run runbooks:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directoryRunbooks still starts, or focuses the window that is already open. A relative path such as runbooks open . usually still points into the deleted folder, so the app shows “This path no longer exists” unless a folder has been created again at that path. Some shells can’t say which folder they were in (zsh -c started from the deleted folder, for example), and then relative paths resolve against your home folder. Either way, cd into a folder that exists, or pass an absolute path.