CLI reference

Install it on Linux or macOS with curl -fsSL https://visualci.com/install.sh | sh, or anywhere with Rust with cargo install --git https://github.com/DocSpring/visualci visualci-cli. visualci --help and visualci <command> --help print the same options.

Every command that talks to the server takes --token (default $VISUALCI_TOKEN, a project token) and --api-url (default $VISUALCI_API_URL, else https://api.visualci.com). Errors exit with status 2.

visualci build create

Creates a build and prints its id. Export it as VISUALCI_BUILD_ID.

Option Meaning
--name <name> A suite's name, for several suites in one project. Each name has its own builds and baselines. Default default.
--shards <n> How many parallel shards will finalize this build. Default 1.
--nonce <id> Shards that create the build with the same nonce get the same build back.
--subset The build has only some of the project's snapshots: missing ones are carried forward, not removed.
--mode ci|local Default: ci when the CLI detects a CI provider (or CI=true), else local. Local builds get no GitHub check; approving their changes sets the baselines for their branch.

It reads the commit, branch and pull request from the environment; see Other CI providers. It sends the repository's visualci.yml with the build, and stops with the file's error when the file is invalid.

visualci upload

Adds files or directories of them to a build: PDFs, PNG, JPEG and WebP images, and .txt, .json and .html text. Snapshot names come from the file paths, relative to a directory argument, without the extension. Files VisualCI already has aren't uploaded again. With no paths and no --manifest, it sends the uploads listed in visualci.yml.

Option Meaning
--build <id> Default $VISUALCI_BUILD_ID.
--from <framework> Read test frameworks' snapshot files and send one snapshot per test: jest, vitest, insta, syrupy, rspec (rspec-snapshot), or auto to detect each file's. Directories are searched for .snap and .ambr files.
--prefix <text> Added before every snapshot name.
--platform <tag> A platform tag, part of the baseline's key, such as ios-26.1/iphone-16.
--threshold <0..1> 0 is exact; above 0, the colour difference below which two pixels count as the same.
--engine pdfbox|mutool The renderer for these PDFs. Default: the project's.
--format text|json|html How text files are compared. Default: from each file's extension, else plain text.
--manifest <file> A JSON array or JSON Lines of {"name", "path", "platform"?, "threshold"?, "engine"?, "format"?, "ignore"?}, for test helpers that choose names themselves. ignore is {"json_paths": [...], "text_patterns": [...]} for that snapshot only.

visualci snapshot

visualci snapshot <name> <file> adds one file under the given name. It takes the same options as upload, except --manifest.

visualci compare

visualci compare <names...> compares some snapshots of a build before it's finalized, so a local test run can check each test's snapshots as the test makes them. It prints each changed or new snapshot with its environment and link, such as invoice_typical (local-mac) changed: https://app.visualci.com/…, and exits 1 when there's any.

Option Meaning
--build <id> Default $VISUALCI_BUILD_ID.
--platform <tag> The snapshots' platform. Default none.
--wait Ask again while files arrive and PDFs render. It exits 3 when it times out (--timeout, default 120 seconds).
--json Print every snapshot's result as JSON Lines.

Finalizing the build compares everything again.

visualci config

visualci config check [file] checks visualci.yml (the nearest one from the working directory up, $VISUALCI_CONFIG, or the file given) and prints what it sets. It exits 1 when the file is invalid. visualci config schema prints the file's JSON Schema. See visualci.yml.

visualci build finalize

Finishes the build, or one shard of it with --shard <i> (numbered from 0). VisualCI compares the build once every shard has finalized.

With --wait, it waits for the result (up to --timeout seconds, default 900), prints what changed and exits 0 when CI should pass, 1 when it should fail, or 3 when it timed out. Under the project's default review mode, a build with changes passes.

visualci build status

Prints a build's status as JSON. --build <id>, default $VISUALCI_BUILD_ID.

visualci check

visualci check <paths> is a one-shot local check: it creates a local build, uploads, waits and prints what changed, with a link. The server renders the PDFs, so a laptop gets the same pixels as CI. It takes upload's options, plus --name and --timeout (default 600). It exits 0 when nothing changed and 1 when something did.

Local tools

These don't need a token.

  • visualci fingerprint <files> prints each PDF's or image's fingerprint as JSON.
  • visualci diff <base> <head> compares two images and prints the result as JSON. Options: --threshold, --ignore-anti-aliasing, and --overlay <file> to write the changes in red.
  • visualci compare-runs <dir1> <dir2> compares the fingerprints of same-named PDFs from two runs of your tests, and exits 1 when any differ.