Skip to content

Command Line Interface (CLI)

Bell provides a powerful command-line interface to execute scripts, run test suites, convert Postman collections, and more.

Installation

If you're using Bell as a package, you can run it via npx:

bash
npx bell-lang <command>

Basic Usage

Run a Bell file:

bash
bell run example.bel

Or run a Bell file directly without the run command:

bash
bell example.bel

Inline Execution

Execute Bell code directly from the terminal using the -c flag (use \n for newlines):

bash
bell -c 'url "https://api.example.com/data"\nGET'

Commands

run

Executes a .bel file.

bash
bell run <file> [options]

Options:

  • -v, --verbose: Print request/response headers and timing for each request.
  • -e, --env <environment>: Specify an environment configuration to use.
  • --dry-run: Parse and validate the file without sending any HTTP requests.
  • --retry <n>: Retry failed requests up to N times with exponential backoff. Respects Retry-After headers on 429 responses.
  • --proxy <url>: Route requests through an HTTP/HTTPS proxy (e.g. http://localhost:8080).
  • --insecure: Disable TLS certificate verification (useful for self-signed certs in dev).
  • --cacert <file>: Path to a custom CA certificate bundle (.pem).
  • --output <file>: Save the last response body to a file.
  • --json: Print the last response body as JSON to stdout (useful for piping to jq).

test

Runs .bel files as a test suite and reports pass/fail results. Exit code 1 if any assertion fails.

bash
bell test [patterns...] [options]

Arguments:

  • [patterns...]: Glob patterns, file paths, or directories. Defaults to the current directory.

Options:

  • -e, --env <environment>: Specify an environment configuration to use.
  • --reporter <type>: Output format: text (default) or junit for JUnit XML (CI/CD integration).
  • --bail: Stop after the first file that has a failure.
  • --retry <n>: Retry failed requests up to N times.

Example:

bash
bell test                          # run all .bel files in current directory
bell test tests/                   # run all .bel files in tests/
bell test "tests/**/*.bel"         # glob pattern
bell test tests/ --reporter junit  # JUnit XML output for CI
bell test tests/ --bail            # stop on first failure

check

Checks a .bel file for syntax and semantic errors. Outputs a JSON array of diagnostics. Always exits with code 0 (diagnostics are in the output, not the exit code) — suitable for editor integrations.

bash
bell check <file>

Each diagnostic has: line, col, length, message, severity ("error" or "warning").

Warnings include:

  • Undefined variable references
  • Variables declared but never used
  • Possible hardcoded secrets (Bearer tokens, API keys)
  • Variable names that shadow builtins (url, response)

postman

Converts a Postman collection JSON file to Bell files.

bash
bell postman <postman-json> [options]

Options:

  • -o, --output <dir>: Output directory for the .bel files (default: ./bell).

openapi Coming Soon

Coming Soon

Not yet available in the current release.

Converts an OpenAPI 3.x spec (JSON or YAML) to Bell files.

bash
bell openapi <openapi-file> [options]

Options:

  • -o, --output <dir>: Output directory for the .bel files (default: ./bell).

curl Coming Soon

Coming Soon

Not yet available in the current release.

Converts a curl command string to a Bell file. Pass the command as an argument or pipe it via stdin.

bash
bell curl '<curl command>' [options]

Options:

  • -o, --output <file>: Output .bel file. Defaults to stdout.

har Coming Soon

Coming Soon

Not yet available in the current release.

Converts a browser HAR export to Bell files.

bash
bell har <har-file> [options]

Options:

  • -o, --output <dir>: Output directory for the .bel files (default: ./bell).
  • --filter <pattern>: Keep only URLs matching a substring or regex.
  • --dedupe: Keep only the last request per unique method + path.
  • --include-cookies: Include Cookie headers (stripped by default).

insomnia Coming Soon

Coming Soon

Not yet available in the current release.

Converts an Insomnia v4 export JSON to Bell files.

bash
bell insomnia <insomnia-json> [options]

Options:

  • -o, --output <dir>: Output directory for the .bel files (default: ./bell).

http Coming Soon

Coming Soon

Not yet available in the current release.

Converts a .http or .rest (VS Code REST Client) file to Bell files.

bash
bell http <http-file> [options]

Options:

  • -o, --output <dir>: Output directory for the .bel files (default: ./bell).

convert (deprecated)

Alias for bell postman. Use bell postman instead.

bash
bell convert <postman-json> [options]

Options:

  • -o, --output <dir>: Output directory for the .bel files (default: ./bell).

format

Formats a Bell file according to the language style.

bash
bell format <file> [options]

Options:

  • --check: Exit with code 1 if the file would be changed, without writing.
  • --stdout: Print formatted output to stdout instead of writing to the file.

config

Shows the merged Bell configuration (bell.config.json + ~/.bell/bell.config.json).

bash
bell config

init

Creates a bell/ folder with a starter example file to help you get started quickly.

bash
bell init

skill

Prints the Bell language reference for AI assistants. With --install, writes it to .claude/commands/bell.md as a Claude Code slash command.

bash
bell skill               # print to stdout
bell skill --install     # install for Claude Code (project)
bell skill --install --global  # install for Claude Code (global)

help

Displays help information for the commands.

bash
bell help [command]

Interactive REPL

Running bell without any arguments starts the interactive REPL (Read-Eval-Print Loop), where you can type Bell commands and see the results immediately.

bash
bell