Skip to content

CLI Config-as-Code

Manage relays, schedules, and relay rules idempotently with a TypeScript config file.

Terminal window
npm install -D @beepsdev/cli

Set your API key:

Terminal window
export BEEPS_API_KEY="bk_your_key_here"

Or use a config file:

{
"apiKey": "bk_your_key_here",
"baseUrl": "https://api.beeps.dev/v0"
}
Terminal window
beeps relay plan --config ./beeps.cli.json
export BEEPS_CLI_CONFIG="./beeps.cli.json"

Precedence: command flags > CLI config file > environment variables.

import type { BeepsConfig } from "@beepsdev/sdk";
const config = {
version: 1,
relays: [
{
externalKey: "myco::relay::primary",
name: "Primary",
description: "Primary rotation",
},
],
schedules: [
{
externalKey: "myco::schedule::primary-weekly",
relayExternalKey: "myco::relay::primary",
name: "Primary Schedule",
type: "weekly",
handoffDay: "monday",
handoffTime: "00:00",
members: [{ email: "dev1@myco.com" }, { email: "dev2@myco.com" }],
},
],
relayRules: [
{
externalKey: "myco::rule::primary-notify",
relayExternalKey: "myco::relay::primary",
group: "default",
order: 1,
name: "Notify Primary",
ruleType: "schedule_notify",
enabled: true,
config: {
scheduleExternalKey: "myco::schedule::primary-weekly",
},
},
],
} satisfies BeepsConfig;
export default config;

Set startAt only when you want a schedule to begin in the future. If you omit it, beeps starts the schedule immediately when the config is applied.

Terminal window
beeps config lint -f beeps.config.ts
beeps relay plan -f beeps.config.ts

For CI:

Terminal window
beeps config lint -f beeps.config.ts --json
beeps relay plan -f beeps.config.ts --json
Terminal window
beeps relay apply -f beeps.config.ts --dry-run # preview
beeps relay apply -f beeps.config.ts # apply

To remove relay rules that are not in the config:

Terminal window
beeps relay apply -f beeps.config.ts --prune
Terminal window
beeps relay export -o beeps.config.ts

Since beeps.config.ts uses externalKey everywhere, it’s idempotent and safe to re-run.

name: Deploy beeps config
on:
push:
branches: [main]
paths: [beeps.config.ts]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- run: npm install @beepsdev/cli
- run: npx beeps relay apply -f beeps.config.ts
env:
BEEPS_API_KEY: ${{ secrets.BEEPS_API_KEY }}