Skip to content

Run the CLI in CI/CD

Use this guide when you want to run the shipped chainabit commands from a non-interactive job.

Install the CLI

bash
npm install -g chainabit

Provide Credentials Safely

For CI jobs, prefer a time-bounded developer token or an already-issued access token instead of typing passwords into the command line.

Option 1: Reuse an Existing Token

bash
export CHAINABIT_TOKEN="$CHAINABIT_TOKEN"
chainabit auth status --json

Option 2: Log In with a Developer Token

bash
chainabit auth login \
  --token-env CHAINABIT_DEVELOPER_TOKEN

The CLI first tries direct bearer authentication with the raw cbt_live_... token. If the target server has not been upgraded yet, it falls back to the legacy exchange endpoint automatically.

Verify the Workspace Context

Use --json so the pipeline can parse structured output.

bash
chainabit auth status --json
chainabit workspace current --json

Expected auth status shape:

json
{
  "authenticated": true,
  "email": "[email protected]",
  "sub": "user_123",
  "exp": "2026-03-28T12:00:00.000Z"
}

Run Real Commands

Once authenticated, you can inspect workspace state, connectors, and AI metadata from the job:

bash
chainabit chain list --json
chainabit connectors list --json
chainabit ai models --json

Example connector catalog entry:

json
[
  {
    "key": "slack",
    "displayName": "Slack",
    "category": "communication",
    "authType": "oauth2",
    "supportedFeatures": ["tool_discovery", "health_check"],
    "isActive": true
  }
]

Example GitHub Actions Workflow

yaml
name: Chainabit check
on: [push]

jobs:
  verify:
    runs-on: ubuntu-latest
    env:
      CHAINABIT_BASE_URL: https://api.chainabit.com/api/v1
      CHAINABIT_WORKSPACE_ID: ${{ secrets.CHAINABIT_WORKSPACE_ID }}
      CHAINABIT_DEVELOPER_TOKEN: ${{ secrets.CHAINABIT_DEVELOPER_TOKEN }}
    steps:
      - uses: actions/checkout@v4
      - run: npm install -g chainabit
      - run: chainabit auth login --token-env CHAINABIT_DEVELOPER_TOKEN
      - run: chainabit auth status --json
      - run: chainabit workspace current --json
      - run: chainabit connectors list --json
      - run: chainabit ai models --json

Creating the Token

Create the CI token from a trusted interactive session:

bash
chainabit auth keys create "github-actions" --ttl 90 --scope execution:run

Add --scope wallet:read if the job needs wallet visibility, or --account <account-uuid> if the token must stay bound to one account.

When to Use Another Page

Built with purpose.