cli
@briven/cli— install as a dev dependency, or run one-off via each PM's remote-exec shim.
install
$ npm install -D @briven/cli
…or skip the install and invoke directly:
$ npx briven
init
Scaffold briven.json, briven/schema.ts, and an example function.
$ npx briven init
Creates the project layout in the current directory. Pass --name to override the default (the directory name). Pass --force to overwrite an existing briven.json.
login
Store an API key so subsequent commands can authenticate against a specific project.
$ npx briven login --project p_xxx --key brk_xxx
Credentials land at ~/.config/briven/credentials.json with mode 0600. Get a key from the dashboard under api keys.
whoami
Verify the stored key is still valid and which project it belongs to.
$ npx briven whoami
link
Associate the current directory with an existing briven project — writes the project id into briven.json so subsequent commands don't need --project.
$ npx briven link --project p_xxx
deploy
Loads briven/schema.ts, compares it to the currently deployed schema, and creates a new deployment. Destructive changes (drop table, drop column) are refused unless --confirm-destructive is passed.
$ npx briven deploy $ npx briven deploy --dry-run $ npx briven deploy --confirm-destructive
invoke
Call a deployed function and print the response. Reads the project id from briven.json; pass --body for an inline JSON body or --body-file path to read from disk. --raw prints just the unwrapped function value, jq-pipeable.
$ npx briven invoke poolStats
$ npx briven invoke createNote --body '{"body":"hello"}'
$ npx briven invoke getNotes --rawenv
Manage per-project environment variables. Values are encrypted at rest with the platform key and only decrypted into the function runtime at cold start; env list surfaces metadata only.
$ npx briven env list $ npx briven env put STRIPE_KEY sk_... $ npx briven env rm STRIPE_KEY
db
Open a psql shell against the project's data-plane schema. Issues a short-lived dsn via the api — the cli never sees the long-lived superuser credentials. Admin-tier; rate limited.
$ npx briven db shell
dev
Watch briven/schema.ts + briven/functions/* and push on change. Drives the inner-loop dev experience — same effect as running briven deploy after every save.
$ npx briven dev
logs
Stream function-invocation logs for the linked project. Shows the structured envelope per invocation: requestId, functionName, durationMs, status, and any logs the function wrote via ctx.log.
$ npx briven logs $ npx briven logs --follow
logout
$ npx briven logout $ npx briven logout --project p_xxx
projects
List every project authenticated on this machine (read straight from ~/.config/briven/credentials.json — no server round-trip) and switch the default. The default project is what every other command picks up when briven.jsonisn't around.
$ npx briven projects list $ npx briven projects set-default p_xxx
export / import
Move a project's schema + functions (and optionally its data) between projects or to disk. --with-data shells out to pg_dump --format=custom --compress=6 against a short-lived dsn; --restore-data on the import side looks for the sibling data dump and pipes it into pg_restore. No new cli deps, but assumes pg_dump + pg_restore on your PATH.
$ npx briven export $ npx briven export --out backup.json $ npx briven export --with-data
$ npx briven import backup.json $ npx briven import backup.json --restore-data
doctor
End-to-end health check against the linked api. Prints pass/fail for: api reachable, session valid, project reachable, runtime ready, an example function invoke (if any). Useful first-line triage when something feels off.
$ npx briven doctor $ npx briven doctor --origin https://api.example.com
environment
BRIVEN_API_ORIGIN— override the control-plane origin for a self-hosted deployment. Default:https://api.briven.tech.XDG_CONFIG_HOME— where credentials are stored, following the XDG spec.