@vizproof/cli
v0.2.2
Published
CLI tool for VizProof Visual Regression Testing API
Maintainers
Readme
VizProof CLI
CLI tool for interacting with the VizProof Visual Regression Testing API.
Installation
npm install -g @vizproof/cli
# or
pnpm add -g @vizproof/cliConfiguration
Set your API token:
vrt config set-token vrt_your_token_hereSet your API URL (optional, defaults to http://localhost:3000):
vrt config set-url https://vizproof.comOr use environment variables:
export VRT_API_TOKEN=vrt_your_token_here
export VRT_API_URL=https://vizproof.comUsage
List sites
vrt sitesCreate a run
vrt runs:create <siteId>Check run status
vrt runs:status <runId>List runs
vrt runs:list [siteId]Check usage
vrt usageList Playwright flows
vrt flows:list <siteId>Run Playwright steps (custom flow)
# Run an existing flow
vrt flows:run <siteId> --flow-id <flowId>
# Run ad-hoc steps from a JSON file
vrt flows:run <siteId> --steps-file ./flow.steps.json --name "Checkout flow"Wait for run completion (CI-friendly)
vrt runs:wait <runId> --timeout 600 --interval 10Gate deployment on visual regressions
# Fail if at least 1 critical diff (status=fail)
vrt runs:gate <runId> --max-fail 0
# Strict mode: also fail on warnings
vrt runs:gate <runId> --max-fail 0 --max-warn 0
# Auto-rebaseline when run is truly identical (fail=0, warn=0, mismatch <= 0%)
vrt runs:gate <runId> --max-fail 0 --rebaseline-if-identical
# Same, but tolerate tiny mismatch noise up to 0.02%
vrt runs:gate <runId> --max-fail 0 --rebaseline-if-identical --rebaseline-max-mismatch 0.02JSON output for pipelines
vrt runs:create <siteId> --json
vrt runs:status <runId> --json
vrt runs:gate <runId> --max-fail 0 --jsonExamples
# List all sites
vrt sites
# Create a run for a site
vrt runs:create clx123abc456
# Check the status of a run
vrt runs:status run789xyz
# List all runs for a specific site
vrt runs:list clx123abc456
# Wait + gate for CI/CD
vrt runs:wait run789xyz --timeout 600
vrt runs:gate run789xyz --max-fail 0
# Check your current usage
vrt usage
# Run custom Playwright steps from file
vrt flows:run clx123abc456 --steps-file ./flow.steps.json --jsonExample flow.steps.json
[
{ "type": "goto", "url": "https://example.com" },
{ "type": "click", "selector": "a[href='/pricing']" },
{ "type": "waitFor", "ms": 1200 },
{ "type": "screenshot", "name": "pricing", "fullPage": true }
]GitHub Actions (minimal)
- name: Install CLI
run: npm install -g @vizproof/cli
- name: Configure CLI
run: |
vrt config set-token "${{ secrets.VRT_API_TOKEN }}"
vrt config set-url "${{ secrets.VRT_API_URL || 'https://vizproof.com' }}"
- name: Create run
id: create_run
run: |
RUN_JSON=$(vrt runs:create "${{ secrets.VRT_SITE_ID }}" --json)
RUN_ID=$(echo "$RUN_JSON" | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{const j=JSON.parse(s);process.stdout.write(j.runId||'')})")
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
- name: Wait
run: vrt runs:wait "${{ steps.create_run.outputs.run_id }}" --timeout 600 --interval 10
- name: Gate
run: vrt runs:gate "${{ steps.create_run.outputs.run_id }}" --max-fail 0 --jsonExit Codes
0: Success1: Error / gate failed / timeout / invalid run state
The CLI will exit with code 1 if:
- API token is not configured
- API request fails
runs:waittimes out or run ends infailedruns:gatethresholds are exceeded (failand optionallywarn)flows:runfinishes withsuccess=false- Invalid command or arguments
