CLI reference
Install it on Linux or macOS with curl -fsSL https://visualci.com/install.sh | sh (set VISUALCI_VERSION=0.2.34 to pin a release, VISUALCI_SHA256 to pin its download's checksum (the .sha256 file published with each release), and VISUALCI_INSTALL_DIR for somewhere other than /usr/local/bin), 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, else the token visualci login kept) and --api-url (default $VISUALCI_API_URL, else https://api.visualci.com). With a personal token, it also needs the project: --project org/project, $VISUALCI_PROJECT, or project: in visualci.yml. Errors exit with status 2. --verbose prints how long each step takes: hashing the files, each call to the server, and the uploads.
visualci login
Signs this machine in without copying a token: it prints a link and a code, you approve the code in the browser, and it keeps a personal access token in the macOS Keychain, or elsewhere in ~/.config/visualci/credentials.json (readable by you alone). --no-browser only prints the link. visualci logout forgets it; delete the token on your account page to revoke it. CI should use a project token in VISUALCI_TOKEN instead.
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. Their snapshot names must be unique across the shards: two sending different files under one name is refused. |
--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. |
--environment <name> |
Where the screenshots were taken, instead of the detected ci, local-mac or local-linux (or $VISUALCI_ENVIRONMENT). Screenshots keep a baseline set per environment. A local build's is local or local-<name>; a CI build's can be anything else. |
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 any text file (.txt, .json, .html, .md, .yaml, .xml, .csv, .svg, source code and so on). In a directory, binary files of other types and hidden files are skipped, and the CLI lists each with the reason. 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. A test that crashed before writing its file adds {"name", "error", "kind"?} with no path, as visualci fail does. |
--allow-empty |
Succeed when there's nothing to upload. Without it, an upload that finds no snapshot files is an error. |
upload sends each image by its file's SHA-256 alone, without decoding it: a file VisualCI already has isn't uploaded,
and VisualCI fingerprints the new ones by their pixels itself. PDFs still carry the CLI's fingerprint of what they draw,
because a PDF's bytes change on every run (its creation date and ID) while what it draws doesn't: without the
fingerprint, every PDF would be uploaded on every run.
With 500 or more snapshots, upload first sends a hash of the run and one per group of names (group_depth in
visualci.yml), and then only the snapshots of groups that differ from their baselines; the rest are carried forward on
the server, at 1 credit per group (see Large suites). It says how many groups
were unchanged. VISUALCI_GROUPS=0 turns this off, and VISUALCI_GROUPS=1 uses it for any size.
visualci snapshot
visualci snapshot <name> <file> adds one file under the given name. It takes the same options as upload, except --manifest.
visualci fail
visualci fail <name> --message "<what went wrong>" reports that a test crashed before it wrote a snapshot's file. The build shows the snapshot as failed under its own name, with the message beside the last approved version, instead of as removed, and the build fails. The last approved version stays the baseline.
| Option | |
|---|---|
--message <text> |
What went wrong. |
--message-file <file> |
Read the message from a file instead, such as a stack trace. Messages over 16 KB are cut. |
--kind <kind> |
document, image or text. Default: from the name's extension (.png an image, .json text), else a document. |
--platform <tag> |
The snapshot's platform, as its file would have been sent. |
--build <id> |
The build (default $VISUALCI_BUILD_ID). |
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.
A build that was sent no snapshots fails, with an error that says so, so an upload that found nothing never passes as "unchanged". Pass --allow-empty when a build is empty on purpose, such as a CI run that skipped the tests.
The exception is a rerun of only the failed jobs. A CI build that was sent nothing, when an earlier CI build of the same suite (--name) already compared the commit on the same branch, gets that build's result, with or without --allow-empty. Its check shows that build's result and follows its review, and the build has a warning naming it.
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. A build that can't be compared because the organization is out of credits exits 4, with a line saying what fixes it. 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, or when the paths hold nothing to check.
visualci release
visualci release [version] records a gallery version: what the project's gallery published at the current commit, kept for good at its own URLs. Without a version, it takes the tag the CI run builds, else the commit's own tag (git describe --exact-match --tags). It exits 0 when the version is recorded (or was, at this commit), and 1 when it's refused: taken by another commit, or nothing published at this one.
visualci publish
visualci publish <paths> sends a full set of screenshots from any machine for a project's gallery: one CI-mode build of everything in the paths (a screenshot it doesn't send shows as removed), on the current branch and commit, in the gallery's environment (gallery.environment in visualci.yml, else ci). It takes upload's options, plus:
--environment <name>sends in another environment.--name <name>names the suite. Defaultgallery, its own, so it never mixes with CI's suites.--timeoutsets how long to wait, in seconds (default 600).
It refuses to run without a gallery section in visualci.yml. It waits until the build is processed, not for its review, and prints the build's link; it posts no GitHub check. Once the build is approved on the default branch, the gallery serves it. It exits 0 when the build completed, changed or not, 1 when it failed, 2 on an error, 3 when the result didn't come in time and 4 when the organization is out of credits.
visualci test
visualci test -- <command> runs a test command inside one build. It creates the build, runs the command with VISUALCI_BUILD_ID set, so every test, process and worker adds to it, and VISUALCI_MODE (local or ci, as the build was made: local unless the CLI detects a CI provider, or --mode), so test helpers can fail a test on its changes in a local run and leave them for review in CI. While the command runs, it tells VisualCI every 5 minutes that the build is still in use, so a suite that runs longer than the project's receive timeout before uploading isn't closed as timed out. It finalizes the build when the command ends, even when the tests fail or are interrupted. Then it waits for the result and prints what changed. It takes build create's options. A local run is always a subset. Options:
--uploadalso sends visualci.yml'suploadsafter the command.--no-waitfinalizes without waiting for the result.--timeoutsets how long to wait, in seconds (default 900).
It exits with the command's status when that failed. Otherwise, like build finalize --wait, it exits 0 when CI should pass, 1 when it shouldn't, 3 when the result didn't come in time, and 4 when the organization is out of credits.
Reviewing builds
The MCP server's review tools, for agents and scripts without it. They use the token visualci login stored (or $VISUALCI_TOKEN) and print the same answer the tool gives, as text, or the whole result with --json.
visualci build list [--waiting] [--branch <b>] [--limit <n>]lists the project's newest builds, or with--waitingthose waiting for a review (list_builds).visualci build show <build> [--all] [--offset <n>] [--limit <n>]shows what a build changed, the largest change first (get_build).visualci build snapshot <build> <name>shows one snapshot's comparison (get_snapshot). Options:--crop changedcrops the images to what changed, and--images all|diff|head|base|nonechooses which images;--pages 1,2picks pages, and--against previouscompares with the branch's previous build;--save-images <dir>writes the images as files (02-page-2-changed-diff.png).
visualci build download <build> [--state changed|added|removed|unchanged|all] [--sides base,head,diff,regions] [--glob '<names>'] [--out <dir>]downloads the build's images as one archive and unpacks it into<dir>(defaultvisualci-build-<build>), the waydownload_buildgives it:<name>[@platform][/page-N]/{base,head,diff,regions}.pngand amanifest.jsonwith each snapshot's state, changed fraction and regions. By default it gets the changed snapshots' base, head and diff images. Use it on a big build to look at the images on disk or run your own checks over the folder. Free.visualci build review <build> approve|reject [--only added|changed] [--snapshot <name>]... [--comment <text>]approves or rejects a build's changes (review).
A refused call (an unknown build, an open comment thread) prints why and exits 1.
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.