Beyond pull requests
CLI
Review code from the terminal or in CI, with exit codes you can gate a pipeline on.
The auditbench command runs the same review from your terminal or a CI pipeline, and exits with a non-zero code when the verdict is bad enough to stop a build.
Install#
The CLI needs Node.js 18 or later. Build it from source:
Terminal
git clone https://github.com/noumanas/-audit-bench-cli.git cd -audit-bench-cli npm install npm run build npm link # puts the auditbench command on your PATH
A Docker image can be built from the same repository with docker build -t auditbench-cli ..
Sign in#
- On your machine: run
auditbench loginand enter your Audit Bench Ai email and password. The session is saved in~/.auditbench/config.json, readable only by you. - In CI: set
AUDITBENCH_API_KEYto your API key, and no login is needed. Find the key in the app under Repository scan → CLI / CI-CD API key. Store it as a secret, never in the repository.
Commands#
Terminal
auditbench login # sign in with your email and password auditbench status # your plan and remaining usage auditbench audit src/checkout.ts # review one file auditbench scan . # review a folder (or a .zip) auditbench scan . --fail-on needs_work
| Command | What it does |
|---|---|
login | Sign in. Accepts -e/--email and -p/--password for scripts |
logout | Remove the saved session |
status | Show your plan and how much of it you’ve used |
audit <file> | Review a single file |
scan <dir|file.zip> | Review a folder or zip archive |
Options#
| Option | Applies to | Meaning |
|---|---|---|
--fail-on | audit, scan | do_not_ship (default), needs_work or never: the verdict that makes the command exit 1 |
--provider | audit, scan | Use a specific AI provider instead of your account’s default |
Exit codes#
0: the verdict is below your--fail-onlevel.1: the verdict reached your--fail-onlevel, or something went wrong (not signed in, a limit reached, a network error).
Use it in CI#
GitHub Actions#
.github/workflows/audit-bench.yml
name: Audit Bench Ai
on: pull_request
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: git clone https://github.com/noumanas/-audit-bench-cli.git /tmp/cli && cd /tmp/cli && npm ci && npm run build && npm link
- run: auditbench scan . --fail-on do_not_ship
env:
AUDITBENCH_API_KEY: ${{ secrets.AUDITBENCH_API_KEY }}GitLab CI#
.gitlab-ci.yml
audit-bench:
image: node:20
script:
- git clone https://github.com/noumanas/-audit-bench-cli.git /tmp/cli
- (cd /tmp/cli && npm ci && npm run build && npm link)
- auditbench scan . --fail-on do_not_ship
variables:
AUDITBENCH_API_KEY: $AUDITBENCH_API_KEYTip
On GitHub, the GitHub App already reviews every pull request with inline comments and a check. Use the CLI in CI when you can’t install the App, or to gate other pipelines.
Environment variables#
| Variable | Purpose |
|---|---|
AUDITBENCH_API_KEY | Authenticate without logging in (CI) |
AUDITBENCH_API_URL | Point the CLI at a different Audit Bench Ai server (self-hosted setups) |
Every audit and scan counts toward your plan like a review in the app. Unchanged code is served from cache for free.