Rightbrain CLI

Authenticate, manage Tasks, and generate TypeScript types from a terminal.

The Rightbrain CLI is published as the rightbrain npm package and runs without a global installation through npx rightbrain@latest <command>.

Authentication and context

CommandPurpose
loginComplete browser-based OAuth, then select an Organization and Project.
logoutClear the stored credentials for the active environment.
whoamiShow the current user, Organization, and Project.
switch-projectSelect a different Organization and Project.
tokenReturn a valid access token, refreshing an expired stored session first.

When token output is captured, stdout contains only the token. token --json returns the token with its dashboard URL, environment name, Organization ID, Project ID, and expiry time. The API base URL is the returned dashboard_url plus /api/v1.

Treat CLI tokens as credentials. Do not commit captured token output or place it in client-side code.

Environments

Named environments keep separate deployment URLs and login sessions. Every command accepts --env <name>. RB_CLI_ENV selects an environment when the flag is absent, and env use sets the default.

env list shows configured environments and the active selection. Its --json form returns environment names and dashboard URLs without exposing session state.

Project setup and generated types

init creates rightbrain.json, updates the configured environment file, installs @rightbrain/sdk when needed, selects or creates an API key, and generates types for selected Tasks.

generate reads the Task IDs from rightbrain.json and writes TypeScript interfaces to generatedTaskTypePath. It requires @rightbrain/sdk version 0.3.0 or later.

The configuration supports either an API key or OAuth client credentials. Credential values can use environment-variable interpolation.

Resource commands

CommandPurpose
organization listList Organizations visible to the current user.
project listList Projects in the selected Organization.
task listList Tasks in the selected Project.
task getRead a Task and its active revision.
task createCreate a Task interactively or from YAML.
task updateCreate a Task revision from YAML, with optional immediate activation.
task runRun a Task with structured and file inputs, optionally against a specific revision or fallback model.
model listList available models, with optional provider filtering.

The deprecated create-task, run-task, and list-models commands remain available temporarily. Use task create, task run, and model list.

Automation output

Commands that support --json return machine-readable output. When stdout is piped, the CLI routes prompts to stderr, suppresses spinners, and returns JSON for supported resource commands.