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
- Install script (recommended)
- Homebrew
- npm
macOS, Linux, WSL:This installs into
~/.roark and links roark into ~/.local/bin. Nothing is written outside your home directory, and no step needs sudo.Pin a version, or remove the CLI entirely:Re-run the install command to upgrade. It replaces the installed version in place and prunes the old one.
The CLI needs Node.js 20 or newer. Every install method above uses your existing Node; none of them bundle a runtime.
~/.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 credential it mints (mode 0600), with the permissions you approve:
auth status asks the API rather than reading the file, so a credential revoked in the browser is
reported as rejected here too, and exits 3:
roark whoami tells you which you are holding (tokenScope),
and both are revocable in the dashboard: project keys under Settings → API keys, user
credentials under Settings → Account → Connected apps. See
API Keys for the difference.
In CI there is no browser, so authenticate with a token instead. Use a project key here rather than a user credential: a project key belongs to the project and keeps working when people join and leave, while a user credential is tied to a person and is revoked when their account is deactivated. Generate one from API Keys and set the environment variable the CLI and SDKs both read, no login step needed:
--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.
Choosing a project
A project key names its own project and ignores everything in this section. A user credential reaches every project you are a member of, so each command acts on one:--project <id>on the commandROARK_PROJECT_IDin the environmentprojectin a.roark.jsonbeside your codeprojectin the user config file (roark config set project)- the project you chose on the consent screen, stored on the credential itself
roark auth status prints which of these is in effect.
Unlike
baseURL, a project in a checked-in .roark.json is safe and needs no opt-in. It selects
which of your own projects a command acts on, and it cannot send your credential anywhere new.
That is the distinction the warning above is drawing: one steers permissions you already have, the
other steers where your secret goes.403 That project is not available to this credential, the project is outside
your credential’s organization or you are not an active member of it. roark project list shows the
ones that are.
Usage
Commands read noun before verb, and the verb islist, 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 anyfile:// prompt references, and submits the result:
1
Preview the changes
create, update and delete operations that would run. Nothing is written.2
Apply
-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 skipauth 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