CLI Reference
25 commands
Natural language support

CLI Reference

Every command, flag, and option. Brokr accepts canonical syntax, expressive aliases, and natural language — all three routes compile into the same structured plan.

Core Commands

Every command listed below. Detailed flags and examples are in the sections that follow.

CommandDescription
brokr create [type] [--name <name>]Create a stack. Context-aware: auto-detects auth state, git remote, and existing code.
brokr deploy [--watch] [--skip-git] [-m "msg"]Push code + sync env vars + trigger a Vercel deployment.
brokr attach <name | att_code>Attach this directory to a stack.
brokr add <capability> --stack <name>Add a capability (database, deployment, email, repo, ai_provider, kv_store, auth).
brokr remove <capability> --stack <name>Remove a capability from a stack.
brokr status [--stack <name>] [--watch]Show status for all stacks, or a specific stack.
brokr listList all stacks for the current account.
brokr env <subcommand>Manage env vars. Subcommands: pull, push, set, import, list.
brokr deploy --env-onlySync env vars to Vercel without pushing code.
brokr promotePromote staging to production by creating a PR from staging → main.
brokr logs [--follow]Live tail or historical log viewer with level/source filtering.
brokr errors [--last 1d]Grouped error viewer with fingerprinting and stack traces.
brokr build [prompt]AI coding agent with infrastructure superpowers.
brokr search domains --name <name>Search for available custom domains with pricing.
brokr link <target>Link a provider account (github, vercel, account).
brokr claim [stack]Claim a temporary stack.
brokr delete <stack>Delete a stack and all its provisioned resources.
brokr fork gitFork a Brokr-managed repo into your account (non-destructive).
brokr transfer gitTransfer repo ownership to your account (irreversible).
brokr balanceShow credit balance and auto-reload settings.
brokr topup [amount]Add credits via Stripe Checkout.
brokr billingOpen Stripe portal to manage payment methods.
brokr doctorCheck environment, credentials, and API connectivity.
brokr whoamiShow the currently authenticated user.
brokr detachRemove the .brokr file from the current directory.
brokr apply <code>Fetch and apply a file bundle from the dashboard.

Stack Commands

create — Create a new stack. Brokr auto-detects your environment: logged in? GitHub remote? Existing code? The answers determine mode, repo source, and defaults.

bash
# From a repo with a GitHub remote — name and repo auto-detected
cd ~/my-project
brokr create web-app
# New repo from scratch
brokr create web-app --name my-app
# Scaffold a Next.js starter (no login needed)
brokr create web-app --name my-app --fw next
# With a custom domain
brokr create web-app --name smooth --domain smooth.app
# With staging enabled
brokr create web-app --name my-app --staging
FlagDescription
--name, -n <name>Stack name. Inferred from the git repo name when not provided.
--repo <mode>Repo source: create | current | owner/repo | GitHub URL.
--repo-mode <ownership>Repo ownership: brokr-managed | user-managed.
--mutation <policy>Mutation policy: direct | branch | pr-only.
--fw <framework>Scaffold a starter template: next | express.
--domain <domain>Attach a custom domain during creation.
--stagingEnable staging environment alongside production.
--providers <list>Pre-select capabilities (comma-separated or "auto").
--mode <mode>Creation mode: auto | guided | temporary | personal.
--yes, -ySkip confirmation prompts.

type is the first positional argument: web-app, ai-app, custom, or stack. Templates determine which capabilities are provisioned by default.

delete — Permanently delete a stack and all its cloud resources (GitHub repo, Neon database, Vercel deployment, DNS, R2 storage). Requires double confirmation.

bash
brokr delete my-app
# ⚠ This will permanently delete 'my-app' and all resources.
# Type the stack name to confirm: my-app
# ✓ Stack deleted

list — List all stacks for your account.

bash
brokr list
# my-app active https://my-app.brokr.sh
# side-proj provisioning

status — Show detailed status for a stack or all stacks. Use --watch to poll every 5 seconds until all capabilities are active.

bash
brokr status my-app
brokr status my-app --watch
brokr status --json

Capability Commands

add — Add a capability to a stack. The --stack flag is auto-detected from the .brokr file in your directory.

bash
brokr add database --stack my-app
brokr add ai_provider --stack my-app
brokr add auth --stack my-app # auto-scaffolds auth files
CapabilityWhat it provisions
databaseNeon Postgres — connection string written to .env.
deploymentVercel project + GitHub integration.
emailResend email sending via Brokr gateway.
repoGitHub repository (create or attach existing).
ai_providerAI gateway access (Claude, GPT, Deepseek, etc.).
kv_storeUpstash Redis key-value store.
storageCloudflare R2 object storage.
authBrokr Auth integration with auto-scaffolded code.

remove — Remove a capability from a stack. Accepts capability types or provider names.

bash
brokr remove database --stack my-app
brokr remove neon --stack my-app # provider alias works too
brokr remove email --yes # skip confirmation
Provider aliasMaps to
neon, postgres, supabasedatabase
verceldeployment
resendemail
githubrepo
openai, anthropic, deepseekai_provider
upstash, rediskv_store
r2, cloudflarestorage
brokr-authauth

The auth capability auto-scaffolds Brokr Auth files into your project and installs dependencies when added.

Deployment & Env

deploy — Full deploy workflow: commit, push code to GitHub, sync env vars, trigger Vercel build. Watches build progress by default.

bash
# Full deploy — code + env + build + watch
brokr deploy
# ✓ Code pushed → https://github.com/you/my-app
# ✓ Env synced → 12 vars pushed to Vercel
# ✓ Deploy triggered → dpl_abc123
# ✓ Ready → https://my-app.brokr.sh (1m 18s)
# Custom commit message
brokr deploy -m "fix auth redirect"
# Just sync env vars, no code push or build
brokr deploy --env-only
# Skip env sync, just deploy code
brokr deploy --skip-env
# Deploy to staging (if enabled)
brokr deploy staging
# Deploy to production
brokr deploy prod
FlagDescription
--stack, -sStack name or ID (auto-detected from .brokr).
--message, -m <msg>Git commit message.
--watch, -wPoll until deployment is ready (default: true).
--no-watchSkip polling after triggering deploy.
--env-onlySync env vars only, skip code push and build.
--skip-envSkip env var sync.
--skip-gitSkip git commit and push.
--yes, -yAuto-confirm new env vars.

.env.brokr is the source of truth for all env vars. Local values override DB values when syncing to Vercel. Brokr ensures sensitive files (.env, .brokr, credentials.json) are in .gitignore before staging.

env — Manage environment variables with subcommands. Most auto-detect the stack from the .brokr file.

SubcommandDescription
brokr env pull --stack <name>Pull stack env vars into local .env file.
brokr env set KEY=VALUESet a single env var (local + server + Vercel).
brokr env import [--env-file <path>]Bulk import vars from .env or .env.brokr.
brokr env pushForce-sync server secrets to Vercel deployment.
brokr env listShow env var names with masked values.

promote — Promote staging to production by creating a PR from the staging branch to main. Auto-merges if clean, creates a PR for manual resolution if there are conflicts.

bash
brokr promote
# ✓ PR created: staging → main
# ✓ Auto-merged (squash)
# Production will auto-deploy after merge.

staging — Enable staging environments and manage IP whitelists.

bash
# Enable staging on a stack
brokr staging enable --stack my-app
# Add your current IP to the whitelist
brokr staging wl add
# Add a specific IP
brokr staging wl add 203.0.113.42
# List whitelisted IPs
brokr staging wl list
# Disable whitelisting
brokr staging wl off

Directory Commands

attach — Link the current directory to a stack. Pass a stack name (if authenticated), stack ID, or a dashboard attach code (att_XXXX). Writes a .brokr file so other commands auto-detect the stack.

bash
# By name (requires auth)
brokr attach my-app
# By dashboard attach code (no auth needed — opens OAuth flow)
brokr attach att_A1b2C3d4
# After attaching, seeds .env.brokr with managed vars
# ✓ Attached to my-app
# ✓ .env.brokr seeded → 8 vars

When attaching with an att_XXXX code while unauthenticated, Brokr opens a browser OAuth flow and polls for your token. The attach code is single-use and expires.

detach — Disconnect the current directory from Brokr. Removes the .brokr file, .env.brokr, and optionally .git and node_modules.

bash
brokr detach
# ✓ Removed .brokr
# ✓ Removed .env.brokr
# Also remove .git directory
brokr detach
# (prompts unless --yes)
# Keep git history
brokr detach --keep-git
# Full clean including node_modules
brokr detach --clean

Repo Commands

fork — Fork a Brokr-managed GitHub repo into your account. Non-destructive — both repos continue to exist. Optionally updates Vercel to point to the fork.

bash
brokr fork git --stack my-app
# ✓ Forked to github.com/you/my-app
# Update Vercel project to use fork? (y/n)
# ✓ Local remotes updated: origin → brokr, fork → origin

transfer — Transfer full ownership of a Brokr-managed repo to your GitHub account. This is irreversible. Updates Vercel, local git remotes, and marks the stack as user-owned.

bash
brokr transfer git --stack my-app
# ⚠ This is irreversible. Type 'my-app' to confirm: my-app
# ✓ Repo transferred to github.com/you/my-app
# ✓ Vercel project updated
# ✓ Stack marked as user-owned
# Preview without making changes
brokr transfer git --stack my-app --dry-run

Both fork and transfer require the stack to have a Brokr-managed repo. If the stack already uses a user-managed repo, these commands are not needed.

Observability

logs — Live tail and historical log viewer with filtering. Auto-follows in TTY mode unless --no-follow or --last is specified.

bash
# Live tail (default)
brokr logs
# Last 2 hours, errors only
brokr logs --last 2h --level error
# Filter by function path
brokr logs --source /api/chat
# Specific deployment
brokr logs --deployment dpl_abc123
FlagDescription
--follow, -fLive tail mode (default in TTY).
--no-followDisable live tail, show historical logs.
--limit <n>Max lines to show (default: 50, max: 100).
--last <time>Time window: 10m, 2h, 3d.
--level <level>Filter by level: error, warn, info, debug.
--source <path>Filter by function or route path.
--deployment <id>Filter by deployment ID.

errors — Grouped error viewer with fingerprinting. Shows error count, first/last seen timestamps, and stack traces.

bash
# Last 10 error groups (default)
brokr errors
# Last 24 hours, more groups
brokr errors --last 1d --limit 25

doctor — Checks your local environment for common issues: Node.js version (≥ 18), authentication status, API reachability, and token validity.

bash
brokr doctor
# ✓ Node.js v20.11.0
# ✓ Authenticated as you@example.com
# ✓ API reachable at https://api.brokr.sh
# ✓ Token valid

Billing Commands

balance — Show your current Brokr credit balance and auto-reload settings.

bash
brokr balance
# Balance: $42.50
# Auto-reload: ON ($25 when below $5)
# Payment method: Visa ****4242

topup — Add credits to your account via Stripe Checkout. Opens a browser window. Default amount: $25. Range: $5 to $1,000.

bash
# Default $25 top-up
brokr topup
# Custom amount
brokr topup 100
# Opens Stripe Checkout → polls for confirmation
# ✓ Payment confirmed → Balance: $142.50

billing — Opens the Stripe Customer Portal in your browser to manage payment methods, view invoices, and update billing info.

bash
brokr billing
# Opens https://billing.stripe.com/session/...

AI Commands

build — AI coding agent with infrastructure superpowers. Reads your codebase, provisions capabilities, writes code, and optionally deploys. Interactive mode (no arguments) or one-shot mode (with a prompt).

bash
# Interactive session
brokr build
# One-shot mode
brokr build "add a contact form with email sending"
# Use a different model
brokr build --model sonnet "refactor the auth flow"
# Create a branch for changes
brokr build --branch "add dark mode support"
FlagDescription
--model <model>AI model: deepseek (default) | sonnet | opus.
--yes, -ySkip confirmation prompts (headless mode).
--no-deploySkip auto-deploy after code writes.
--branchCreate a git branch for changes.

Requires authentication (brokr link account). The agent creates a pre-build snapshot commit before making changes so you can always roll back.

Other Commands

apply — Fetch and apply a file bundle from the dashboard. The dashboard generates an 8-character hex code that maps to a set of files.

bash
# Apply a bundle
brokr apply a1b2c3d4
# ✓ Created src/components/ContactForm.tsx
# ✓ Updated src/app/page.tsx
# Preview without writing files
brokr apply a1b2c3d4 --dry-run

search domains — Search for available custom domains. Returns availability and pricing. Interactive selection for purchasing (requires auth).

bash
brokr search domains --name smooth
# smooth.app $14.99/yr ✓ available
# smooth.dev $12.99/yr ✓ available
# smooth.io $34.99/yr ✓ available
# smooth.com — ✗ taken
# Filter by TLD
brokr search domains --name my-app --tld .app,.dev
# Show more results
brokr search domains --name cool-project --count 10

whoami — Show the currently authenticated user.

bash
brokr whoami
# you@example.com

claim — Claim a temporary stack to make it permanent. Reads the claim code from the .brokr file if present, or accepts a stack ID.

bash
# From the stack directory (reads .brokr)
brokr claim
# ✓ Stack claimed → clxxxxxxxxxxxxx
# Explicit stack ID
brokr claim clxxxxxxxxxxxxx

If you run brokr link account instead, Brokr auto-claims any temporary stacks that match your GitHub repos.

Aliases & Natural Language

Aliases are first-class commands, but the useful set is intentionally small. You should not need to memorize a parallel CLI.

brokr make web-app --name my-app --repo create

Use a more natural verb for create. Same stack flow, less ceremony.

brokr want database --stack my-app

Ask for a capability in plain English when you do not want to remember the canonical add syntax.

brokr do "add neon to my-app"

Drop into natural language when intent matters more than the exact command shape.

Any quoted string or unrecognized command is treated as natural language and routed to the AI parser. The parser returns the same structured CommandPlan schema used by canonical CLI input.

bash
# Quoted string → NL mode
brokr "give me a postgres database on neon for my-app"
# Unrecognized command → NL mode
brokr add a database to my-app
# Explicit via alias
brokr do "spin up an ai-app with vercel and openai"

Global Flags

FlagDescription
--jsonOutput raw JSON (machine-readable).
--yes, -ySkip confirmation prompts.
--verbose, -VEnable verbose debug output.
--api-url, -uOverride API URL (default: https://brokr.sh/api/orpc).
--help, -hShow help for a command.
--version, -vShow CLI version.

Response Schema

All commands output structured JSON when --json is passed.

bash
// CreateStackResponse
{
"ok": true,
"stackId": "stk_abc123",
"plan": {
"stackName": "my-app",
"mode": "temporary",
"repoConfig": {
"mode": "create",
"ownership": "brokr-managed",
"mutation": "direct",
"raw": "create",
"value": "create"
}
},
"message": "Stack provisioned"
}
// ErrorResponse
{
"ok": false,
"code": "STACK_NOT_FOUND",
"message": "Stack 'my-app' does not exist.",
"hint": "Run 'brokr list' to see your stacks."
}