Skip to main content

Overview

roark is the official command line interface for the Roark API. It covers the same surface as the Node.js and Python SDKs (calls, metrics, personas, customer flows, simulations, webhooks) and adds the two commands that make Config as Code practical: roark config diff and roark config apply. It prints JSON, so it composes with jq and with everything else in a pipeline, and it uses distinct exit codes, so a CI job can tell a rejected request apart from a missing credential.

Install

Confirm the install worked:
The CLI needs Node.js 20 or newer. Every install method above uses your existing Node; none of them bundle a runtime.
If ~/.local/bin is not on your PATH, the install script tells you the line to add. Man pages ship with the CLI. Add ~/.roark/share/man to MANPATH and man roark works.

Authenticate

Interactively, roark auth login opens your browser to approve access, then stores the key it mints, scoped to the project and the permissions you approve, and revocable any time under Settings → API keys:
In CI there is no browser, so authenticate with a token instead. Generate one from API Keys and set the environment variable the CLI and SDKs both read, no login step needed:
You can also pass --token <value> on any command, or pipe a token into login (echo "$ROARK_API_BEARER_TOKEN" | roark auth login). See Using the CLI in CI for a full GitHub Actions example. Settings resolve highest precedence first: a flag, then the environment variable, then a project .roark.json found by walking up from the working directory, then the user config file. roark config path prints where each of those lives.
A .roark.json arrives with a clone rather than being something you wrote, so if a project file sets baseURL, the CLI refuses to send a stored or environment credential to it. Read the file, then pass --allow-project-base-url (or set ROARK_ALLOW_PROJECT_BASE_URL) to opt in, or pass --token to send a different credential.

Usage

Commands read noun before verb, and the verb is list, get, create, update or delete unless the operation is genuinely something else:
roark <command> --help prints the flags for any command, and roark --help lists the command tree.

Output

JSON on stdout (indented and coloured for a terminal, compact when piped) so the same command works in both places. Errors go to stderr, so > out.json captures only real output.

Request bodies

Flags cover the common case, and nested objects go one level deep with dots. A whole payload can be supplied as JSON, with flags overriding what it contains:

Any endpoint

Endpoints without a generated command are still reachable:

Shell completion


Config as Code

The CLI is the intended way to run Config as Code. Point it at a directory of YAML resources. It bundles them, resolves any file:// prompt references, and submits the result:
1

Preview the changes

Prints the create, update and delete operations that would run. Nothing is written.
2

Apply

Shows the same preview, then asks for confirmation before reconciling. Pass -y to skip the prompt in CI, and --no-prune for an additive-only apply that leaves removed resources alone.
These commands need an API key carrying the config:apply permission. See Config as Code for the resource kinds and apply semantics.

Using the CLI in CI

CI runs headless, so skip auth login and authenticate with a token in the environment. Store an API key as a secret (ROARK_API_KEY) and export it as ROARK_API_BEARER_TOKEN; every command picks it up with no interactive step. The common setup is a two-stage GitHub Actions workflow: diff on every pull request so a reviewer sees what would change, and apply on merge to main.
GitHub Actions
config diff exits non-zero if the request is rejected (see exit codes below), so a broken bundle fails the PR check rather than slipping through. Use --no-prune on apply if you want additive-only syncs that never delete resources removed from the repo.

Exit codes

Distinct codes so a CI job can branch on the failure rather than grepping stderr.

Additional Resources

NPM Package

View package details on npm

Homebrew Tap

Formula source and release notes

Config as Code

Define agents, personas, flows and metrics as YAML

API Reference

Explore the full API documentation