All docs
Reference7 min readUpdated

uiverify CLI reference: upload and check flags

Every command, flag, environment variable and exit code of uiverify, the visual regression testing CLI, plus the Playwright, Vitest and Bun capture SDK options.

uiverify is the npm package that sends a build to UI Verify. It needs Node 22.12 or later, runs inside a git checkout, and signs in with npx uiverify login on your machine or reads your project key from UIVERIFY_API_KEY in CI. For a first setup, follow the quickstart for your stack (Storybook, Playwright, Vitest, Bun, screenshots); this page is the lookup table.

bash
npx -y uiverify@1.10.0 upload --static-dir ./storybook-static
npx -y uiverify@1.10.0 check --static-dir ./storybook-static --target 'components-button--*'

Commands

The CLI has two build commands over the same pipeline (bundle the directory, register the build, upload it, then wait for the verdict), plus three that manage your login.

CommandWhat it does
uiverify uploadThe CI build. Renders the stories or tests your change can affect when the bundle carries a dependency graph (every one without it, or with --render-all), posts the pull request check, and exits on the visual verdict.
uiverify checkA preview build for an agent's edit loop. Renders only what you name with --target (or the whole archive or screenshot set you upload), diffs against the real CI baseline, posts no GitHub check and never moves a CI baseline. See Check visual changes mid-edit.
uiverify loginSigns you in. Prints a link and a short code, opens the link in your browser when it can, and exits 0 once you have approved (printing Signed in as <email>). A stored login is checked and reused. In a coding agent's shell it waits at most a minute and exits 1 while it is still waiting: run it again, and the same code finishes the sign-in. A code lasts about five minutes.
uiverify whoamiPrints who you are signed in as.
uiverify logoutForgets the stored login for the server you use.
uiverify help, --help, -hPrints the command list and exits 0. uiverify upload --help and uiverify check --help print each command's options.

Any other command, or no command at all, prints the usage line and exits 2.

Flags shared by upload and check

Both commands take the same input and failure-handling flags. Exactly one of --static-dir or --screenshots is required.

FlagDefaultWhat it does
--static-dir <dir>noneUpload a built Storybook (storybook-static) or a Playwright, Vitest, or Bun capture archive (uiverify-archive).
--screenshots <dir>noneUpload a directory of finished PNG or JPEG images, diffed without rendering. Each image is keyed by its path under the directory, without the extension.
--working-directory <dir>current directoryRun from this directory. Relative paths and git metadata resolve from here.
--api-url <url>UIVERIFY_API_URL, else https://uiverify.aiThe UI Verify API to talk to. Only needed for self-hosting or local development.
--project <slug|team/slug>from your repositoryThe project to upload to. Signed in, UI Verify otherwise picks it from your repository and what you upload, and a name that matches nothing creates that project (prefix the team when you are in several). When the repo already has a project of that framework, a new name first gets a question instead, and --confirm-new <code> answers it. With a key, it must name the key's own project.
--confirm-new <code>noneSigned in, create the --project even though the upload asked whether an existing project is this one. The code is the one that question printed.
--strictonAn operational failure (bad key, missing bundle, network error) exits 1.
--no-strictoffAn operational failure logs a warning and exits 0. The visual verdict still gates.

A value flag takes --flag value or --flag=value. An empty value counts as unset, so --api-url "$UNSET_VAR" still falls back to the environment and the default. If both --strict and --no-strict are passed, --strict wins. The removed --shadow and --build-cmd flags are accepted with a warning and ignored.

Signing in instead of a key

On your own machine, sign in once and upload and check need no key. UI Verify picks the project from your repository (the origin remote, and upstream for a fork) and what you upload. When you have none yet, the first upload creates it, and your first team (named after the repository's owner), and prints what it created with a link. When that is ambiguous the upload asks instead: which team, when you are in several (pass --project <team>/<name>), or whether a project that could be this one is it (pass --project <team>/<slug> to use it, or the --project ... --confirm-new <code> it prints to create a new one).

bash
npx -y uiverify@1.10.0 login
npx -y uiverify@1.10.0 upload --static-dir ./storybook-static

The login is stored in one file per machine, ~/.config/uiverify/credentials.json (under $XDG_CONFIG_HOME, or %APPDATA%\uiverify on Windows), readable only by you and never in your repository. Where your system keeps keys for you (the macOS login keychain, Windows data protection, a Linux desktop keyring), the file is sealed with a key kept there. Logins are kept per UI Verify server and renewed quietly. In CI, keep using UIVERIFY_API_KEY: when it is set it always wins over a login.

Several apps in one repo

A repo with several apps of one framework (two Storybooks, say) gets one UI Verify project per app. Signed in, the first app's upload creates its project, or uses the one you made on the website (--project <team>/<slug>). Each other app's upload names its own project, for example --project acme/shop-admin, and because the repo already has a project of that framework, it asks once before creating another: the refusal prints a --confirm-new <code> to run again with, which answers "make a new one". Give each package's upload script its own --project <team>/<slug> so every run goes to the right project, since a signed-in upload without it is ambiguous once the repo has two. CI uploads use each project's own key, which names its project already.

Upload-only flags

These flags control what a CI build renders and how its verdict gates the job. uiverify check rejects them.

FlagDefaultWhat it does
--render-alloffRender every story or test and carry nothing forward, even when the dependency graph shows a change cannot reach it and even if the same upload already passed on this commit. Without it, an upload whose bundle carries a dependency graph (Storybook built with --stats-json, a Vitest archive, a Playwright archive you added one to) renders only what your change can affect. See Skip unchanged.
--auto-accept-changesoffAccept this build's changed and new snapshots as the new baseline, so the build passes. Flaky changes stay pending review. Meant for merges to your default branch.
--exit-zero-on-changesoffA changed verdict exits 0 and stays pending review in the dashboard. failed and blocked still exit 1, and so does a build with a change denied before it finished, which reads failed.

Check-only flags

--target picks what a preview build renders. uiverify upload rejects it.

FlagDefaultWhat it does
--target <glob>noneRepeatable. An exact id (a story id, a Playwright, Vitest, or Bun test id, a screenshot path without its extension) or an anchored glob (components-button--*, settings/*). Replaces the dependency-graph selection a CI build computes.

--target is required for a Storybook --static-dir, because Storybook builds the whole suite; leaving it out is an operational failure. It is optional for a capture archive or --screenshots, which already hold only what you captured.

Environment variables

The CLI reads its key and build metadata from the environment. On GitHub Actions and Bitbucket Pipelines the branch, pull request and repository come from the CI's own variables, and the commit from git; the overrides win when set.

VariableRead byWhat it does
UIVERIFY_API_KEYCLIYour project key (uv_proj_...). Required in CI; on your own machine run npx uiverify login instead. When set, it wins over a login. Redacted from every log line.
UIVERIFY_API_URLCLIAPI URL when --api-url is not passed.
COMMIT_SHACLIThe commit the build is for. Falls back to git rev-parse HEAD.
BRANCHCLIThe branch name. Falls back to GITHUB_HEAD_REF, then BITBUCKET_BRANCH, then git's current branch.
PR_NUMBERCLIThe pull request number. Falls back to GITHUB_REF (refs/pull/<n>/merge), then BITBUCKET_PR_ID. Unset off a pull request, so the build is recorded against the branch.
UIVERIFY_REPOCLIThe repository as owner/repo. Falls back to GITHUB_REPOSITORY, then BITBUCKET_REPO_FULL_NAME, then the origin remote URL.
UIVERIFY_ARCHIVE_DIRPlaywright, Vitest and Bun SDKsWhere capture archives are written. Defaults to ./uiverify-archive under the working directory.

Exit codes

uiverify exits 0, 1 or 2. Exit 1 has two independent causes: the visual verdict, and an operational failure in strict mode.

Exituploadcheck
0passed; changed with --exit-zero-on-changes; an operational failure with --no-strict; helppassed or changed; an operational failure with --no-strict; help
1changed, failed (a failed build, or a change denied before it finished) or blocked (snapshot allowance reached, or a billing problem); an operational failure (default)failed (including a change denied before it finished) or blocked; an operational failure (default)
2A malformed invocation, even with --no-strictA malformed invocation, even with --no-strict

A changed preview is the result you asked for, not a gate, so check exits 0 on it and prints the changed list for your agent to review. To make the upload verdict block merges, see Required checks.

The failed verdict means the build as a whole failed, for example because nothing could render. A story that fails to render, or fails its interaction test, inside a build that otherwise rendered turns the UI Verify pull request check red but does not change the CLI's exit code; the CLI lists it in the summary's failed count. To block merges on story failures, make the pull request check required: see Required checks.

What counts as an operational failure?

An operational failure is the run itself not happening: a missing key or login, a missing or empty capture directory, both --static-dir and --screenshots passed, a Storybook check without --target, or a network error, timeout or server error that survives the retries (each request is retried up to three times). The default is strict, so a dropped upload fails the job instead of leaving CI green with nothing uploaded. --no-strict logs the error and exits 0.

What counts as a malformed invocation?

A malformed invocation is a command line the CLI cannot honor: an unknown or misspelled option, a boolean given a value (--render-all=true), a value flag with no value, a stray positional argument, an unknown command, or a flag that belongs to the other command. It exits 2 regardless of --no-strict, because --no-strict means "don't fail my job if the upload breaks", not "skip the upload", and a typo would otherwise exit 0 having uploaded nothing.

How long does upload wait for a verdict?

After uploading, the CLI polls the build every 2 seconds and prints a Rendered X / N line as the count advances. It gives up after 60 minutes, which is an operational failure. On a changed or failed verdict it prints a per-story summary and the MCP handoff for your agent. If the same commit already has a fully accepted build with no failures and the same bundle content, the rebuild is skipped and the CLI exits 0 straight away.

How do I run uiverify outside GitHub Actions?

The CLI runs on any CI with Node 22.12+ and a git checkout. On any CI other than GitHub Actions or Bitbucket Pipelines there are no variables it knows to read, so set the branch, pull request and, if you like, the commit yourself from your CI's own variables. Many CI checkouts are a detached HEAD, where git reports the branch as HEAD, so set BRANCH explicitly.

Generic CI step
# UIVERIFY_API_KEY comes from your CI's secret store.
# Replace the right-hand sides with your CI's own variables.
export COMMIT_SHA="$YOUR_CI_COMMIT_SHA"
export BRANCH="$YOUR_CI_BRANCH"
export PR_NUMBER="$YOUR_CI_PR_NUMBER"   # leave unset when not building a pull request
export UIVERIFY_REPO="your-org/your-repo" # only if the origin remote doesn't name the repo

npx -y uiverify@1.10.0 upload --static-dir ./storybook-static

The pull request check and comment are posted by the UI Verify GitHub App, so they need the repository on GitHub with the App connected to the project; which CI runs the upload doesn't matter. Without the App, uploads and renders still work and the CLI logs a warning. Clone with full history: in a shallow clone the CLI can't confirm which baselines are ancestors of your commit. uiverify upload prints the gh pr checks <n> --watch hint only for a pull request build on GitHub Actions.

Playwright SDK options

@uiverify/playwright replaces @playwright/test in your imports and archives the final page of every test that uses the built-in page. Its uiVerify fixture has two methods.

APIWhat it does
uiVerify.snapshot(name?, { delayMs?, waitForStableFrame? })Archives the page now as a named snapshot. delayMs adds extra settle time in milliseconds before the screenshot. waitForStableFrame: false archives without waiting for animations and layout to finish (fonts and images still load). A test that calls it is not also archived at its end.
uiVerify.disableAutoSnapshot()Skips the automatic end-of-test snapshot for this test. A test that never loads anything into the built-in page is skipped without it, with one warning per run.

Archives go to ./uiverify-archive, or UIVERIFY_ARCHIVE_DIR when set. A failed test is still captured, unless it never loaded anything into the built-in page; a timed-out or interrupted one is not.

Vitest SDK options

@uiverify/vitest archives every browser-mode test's final DOM once uiverifyPlugin() (from @uiverify/vitest/plugin) is in your Vitest config. The in-test helpers are imported from @uiverify/vitest.

APIWhat it does
uiverifyPlugin({ outDir })Where archives are written. Defaults to UIVERIFY_ARCHIVE_DIR, else ./uiverify-archive.
uiverifyPlugin({ disableAutoSnapshot: true })No automatic end-of-test snapshots for the whole suite; only takeSnapshot() calls capture. Default false.
uiverifyPlugin({ networkIdleTimeout })How long a snapshot waits for the test's network requests to finish, in milliseconds. Default 5000; 0 skips the wait.
await takeSnapshot(name?, { baselineImage?, waitForStableFrame? })Archives the DOM now as a named snapshot and replaces the test's automatic one. baselineImage is a design PNG to compare against until a render is accepted. See Design baselines. waitForStableFrame: false archives without waiting for animations and layout to finish (fonts and images still load).
disableAutoSnapshot()Skips the automatic snapshot for the current test only.
await preloadFonts()Loads every registered font before you render, for components that measure text on mount.

A second takeSnapshot() with the same name in one test gets #2 appended to its id rather than replacing the first, and takeSnapshot("", { baselineImage }) keeps the automatic snapshot's id. Each run clears the previous run's archive before writing.

Bun SDK options

@uiverify/bun runs visual tests on bun test. defineSuite, takeSnapshot, expect and serveBundle are imported from @uiverify/bun; the runner is run from @uiverify/bun/run. See the Bun setup.

APIWhat it does
defineSuite({ viewports, now?, colorScheme? }, setup?)Returns the suite each test file opens with visualSuite(import.meta.path, { baseUrl? }). Each viewports entry runs every test once; now is where the page clock starts (default 2026-01-01T00:00:00Z); colorScheme is light (default) or dark. setup(page) runs at the start of every test.
await takeSnapshot(name?)Archives the page now as a named snapshot. A test that takes none is archived once when it ends.
serveBundle({ entrypoint, plugins?, define? })Builds an HTML entry with Bun.build and serves it at / on a free port, whatever the entry is named, for component tests. Returns { url, stop() }.
run({ webServer?, shards? })Runs every *.visual.ts or *.visual.tsx file in its own bun test process, at most one at once per CPU and per 768 MiB of memory, and writes the archive. webServer is { command, port, env?, ready?, perShard? }: the app it starts gets PORT and UI_VERIFY=1. shards splits a file into several processes, by path.

The runner script takes test file paths and -t <pattern> to run only some tests (bun tests/visual/run.ts tests/visual/home.visual.ts -t menu). Archives go to ./uiverify-archive, or UIVERIFY_ARCHIVE_DIR when set, and each run clears the previous run's archive.

Visual testing for agents

UI Verify is visual regression testing for Playwright, Storybook, Vitest and Bun. Your coding agent sees what its UI change did and fixes it before it ships. See how it works.

Get started