Skip to main content

Getting Started

The yr CLI is the Yardrail command-line client. It wraps the platform's REST API behind a familiar noun-verb command tree with table or JSON output.

Install​

From source​

go install github.com/yardrail/yardrail/cmd/yardrail-cli@latest

The binary is installed as yardrail-cli. Rename or alias it to yr:

mv "$(go env GOPATH)/bin/yardrail-cli" "$(go env GOPATH)/bin/yr"

From a release binary​

Download the latest release from the project's release page, extract, and place yr on your PATH.

Authentication​

The CLI supports two authentication methods: OAuth (browser-based, default) and Personal Access Tokens (PATs).

OAuth login (default)​

yr auth login

Enter your server URL when prompted (e.g. https://platform.yardrail.com). The CLI opens your browser for an OAuth authorization flow (PKCE with S256), then stores the token locally.

tip

Set YR_SERVER to pre-fill the server URL:

export YR_SERVER=https://platform.yardrail.com
yr auth login

PAT login​

If you have a Personal Access Token, pass it directly:

yr auth login --pat <token>

Or use the interactive PAT prompt:

yr auth login --use-pat

You can also set YR_TOKEN to pre-fill the token value.

Cloudflare Access​

If your Yardrail deployment is behind Cloudflare Access, the CLI detects it automatically and launches cloudflared access login for the browser authentication step. The resulting service token is attached to all subsequent requests.

Auth contexts​

The CLI stores credentials in named contexts at ~/.config/yr/config.yaml (or $XDG_CONFIG_HOME/yr/config.yaml). Each context holds a server URL, auth material, and cached user/org metadata. Context names are auto-generated as hostname/org-slug.

yr auth status # show current context
yr auth list # list all contexts
yr auth switch <name> # switch active context
yr auth rename <old> <new>
yr auth remove <name>

Override the context for a single command with --context / -c:

yr -c staging/acme template list

Global flags​

FlagShortDefaultDescription
--context-c(from config)Override auth context
--server-s(from context)Override server URL
--output-otableOutput format: table or json

First commands​

Check the platform configuration:

yr config get

List workflow templates in your org:

yr template list

Trigger a workflow installation and watch its journal:

yr installation trigger <id> --wait

Get JSON output for scripting:

yr template list -o json

See the full command reference for every command and flag.