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://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. Local builds can be viewed but not approved. |
It reads the commit, branch and pull request from the environment; see Other CI providers.
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.
| 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"?}, for test helpers that choose names themselves. |
visualci snapshot
visualci snapshot <name> <file> adds one file under the given name. It takes the same options as upload, except --manifest.
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.