VisualQ

CLI

Trigger VisualQ audits from any CI/CD pipeline with the @visualq/cli package.

The VisualQ CLI (@visualq/cli) is a zero-dependency command-line client for the CI REST API. Use it in GitLab CI, Jenkins, CircleCI, Bitbucket Pipelines, Azure Pipelines, or local scripts to trigger quality audits and fail the pipeline when checks do not pass.

For GitHub-hosted repositories, the dedicated GitHub Action adds native check runs and PR comments. For other CI systems, the CLI is the recommended integration surface.

Install

Run directly with npx (no install step):

npx @visualq/cli run --api-key $VISUALQ_API_KEY --project my-website

Or install globally:

npm install -g @visualq/cli
visualq run --api-key $VISUALQ_API_KEY --project my-website

Authentication uses an API key with scope ci or mcp_full. Keys scoped mcp_read cannot trigger runs.

Quick start

export VISUALQ_API_KEY=vq_your_key_here

# Visual regression test (default CI use case)
visualq run --project my-website --environment staging

# Check an existing run
visualq status run_abc123

# List projects accessible with your key
visualq projects

When the API key is project-scoped, --project is optional — the key's associated project is used automatically.

Commands

CommandAPI typeDescription
visualq runtestCompare screenshots against baselines (VRT)
visualq baselinebaselineCapture new visual baselines
visualq perfperfRun a performance audit (Lighthouse / Core Web Vitals)
visualq seoseoRun an SEO audit
visualq a11ya11yRun an accessibility audit
visualq securitysecurityRun a security scan
visualq analyticstrackingRun an analytics / tracking plan audit
visualq status <runId>Print run status and results as JSON
visualq projectsList projects accessible with your API key
visualq helpShow usage help
visualq --versionPrint CLI version

All run commands (run, baseline, perf, …) trigger POST /api/ci/run, poll GET /api/ci/status/{runId} until completion (unless --no-wait), and exit with a non-zero code when the run fails or checks do not pass.

Options

These options apply to all run commands unless noted otherwise.

OptionEnv varDefaultDescription
--api-key <key>VISUALQ_API_KEY(required)API key sent as X-API-Key
--project <slug>Project slug (optional with project-scoped keys)
--scenarios <list>all scenariosComma-separated scenario labels
--browsers <list>chromiumComma-separated: chromium, firefox, webkit
--environment <env>project defaultEnvironment name or slug
--perf-budgets <json>JSON budgets — perf only. Keys: lcp, fcp, cls, tbt, ttfb, score
--api-url <url>VISUALQ_API_URLhttps://visualq.aiAPI base URL
--no-waitwait enabledTrigger the run and exit immediately with { "runId", "status": "started" }
--commit <sha>auto in CIGit commit SHA
--branch <name>auto in CIGit branch name
--pr <number>auto in CIPull request / merge request number
--pr-url <url>auto in some CIPull request URL
--jira-key <key>Jira issue key to link results (e.g. PROJ-123)
--ci <provider>auto in CICI provider name (e.g. gitlab, github-actions)
--locale <code>VISUALQ_LOCALE, LANGauto-detectOutput language for log messages (en, fr, …)

status and projects accept --api-key, --api-url, and --locale only.

Environment variables

VariableDescription
VISUALQ_API_KEYAPI key (alternative to --api-key)
VISUALQ_API_URLOverride API base URL (alternative to --api-url)
VISUALQ_LOCALEOutput language (alternative to --locale)

CI auto-detection

When running inside a supported CI environment, the CLI automatically fills --commit, --branch, --pr, --pr-url (where available), and --ci. Explicit flags always take priority.

CI providerDetected whenCommitBranchPR / MR
GitLab CI$GITLAB_CI$CI_COMMIT_SHA$CI_COMMIT_REF_NAME$CI_MERGE_REQUEST_IID
GitHub Actions$GITHUB_ACTIONS$GITHUB_SHA$GITHUB_HEAD_REF or $GITHUB_REF_NAMEParsed from $GITHUB_REF (refs/pull/N/)
CircleCI$CIRCLECI$CIRCLE_SHA1$CIRCLE_BRANCHParsed from $CIRCLE_PULL_REQUEST URL
Jenkins$JENKINS_URL$GIT_COMMIT$GIT_BRANCH (strips origin/)$CHANGE_ID
Travis CI$TRAVIS$TRAVIS_COMMIT$TRAVIS_BRANCH$TRAVIS_PULL_REQUEST
Bitbucket Pipelines$BITBUCKET_COMMIT$BITBUCKET_COMMIT$BITBUCKET_BRANCH$BITBUCKET_PR_ID
Azure Pipelines$BUILD_BUILDID$BUILD_SOURCEVERSION$BUILD_SOURCEBRANCH$SYSTEM_PULLREQUEST_PULLREQUESTID

On GitLab CI, --pr maps to the merge request IID (the number shown as !123 in the UI), not the internal MR ID.

Examples

Visual regression on staging

visualq run \
  --api-key $VISUALQ_API_KEY \
  --project my-website \
  --environment staging \
  --scenarios "Homepage,Login"

Capture baselines after deploy

visualq baseline \
  --api-key $VISUALQ_API_KEY \
  --project my-website \
  --environment production

Performance audit with budgets

visualq perf \
  --api-key $VISUALQ_API_KEY \
  --project my-website \
  --perf-budgets '{"lcp":2500,"cls":0.1,"score":75}'

The CLI exits with code 1 when any budget threshold is exceeded.

SEO, accessibility, security, analytics

visualq seo       --api-key $VISUALQ_API_KEY --project my-website
visualq a11y      --api-key $VISUALQ_API_KEY --project my-website --browsers chromium,firefox
visualq security  --api-key $VISUALQ_API_KEY --project my-website
visualq analytics --api-key $VISUALQ_API_KEY --project my-website

Fire-and-forget (manual status check)

visualq run --api-key $VISUALQ_API_KEY --project my-website --no-wait
# {"runId":"run_abc123","status":"started"}

visualq status run_abc123 --api-key $VISUALQ_API_KEY
visualq run \
  --api-key $VISUALQ_API_KEY \
  --project my-website \
  --jira-key PROJ-456

CI/CD integration examples

GitLab CI

visual-regression:
  stage: test
  image: node:20
  script:
    - npx @visualq/cli run --project "$VISUALQ_PROJECT" --environment staging
  variables:
    VISUALQ_API_KEY: $VISUALQ_API_KEY
    VISUALQ_PROJECT: my-website
  rules:
    - if: $CI_MERGE_REQUEST_IID

Commit SHA, branch, MR number, and provider are auto-detected — no extra flags needed.

Jenkins

stage('Visual Regression') {
    environment {
        VISUALQ_API_KEY = credentials('visualq-api-key')
    }
    steps {
        sh '''
            npx @visualq/cli run \
                --api-key "$VISUALQ_API_KEY" \
                --project my-website \
                --environment staging
        '''
    }
}

SEO gate before merge

seo-audit:
  stage: test
  image: node:20
  script:
    - npx @visualq/cli seo --project my-website --environment staging
  variables:
    VISUALQ_API_KEY: $VISUALQ_API_KEY
    VISUALQ_PROJECT: my-website

See Other CI systems for CircleCI, Jenkins declarative pipeline, and curl-based patterns.

Polling and timeouts

By default, run commands poll every 5 seconds for up to 5 minutes. While waiting, the CLI prints progress lines prefixed with [visualq].

When the run completes:

  • VRT / baseline / a11y / security / analytics — fails if summary.failed > 0
  • perf — fails if performance budgets are exceeded (perfBudgetResult.pass === false)
  • seo — fails if seoFailed > 0

Use --no-wait to skip polling and handle status yourself with visualq status.

Exit codes

CodeMeaning
0Success — all checks passed, budgets met, or --no-wait triggered
1Failure — missing API key, trigger error, visual diffs, failed checks, budget violation, SEO failures, run error, timeout, unknown command

Out of scope

The CLI covers CI-triggerable audits via /api/ci/run. It does not replace the VisualQ dashboard for:

CapabilityWhere to use it
FRT scenario authoring and feature runsVisualQ UI or MCP (run_frt_feature)
Full quality audit (all pillars at once)VisualQ UI (POST /api/tests/full-suite)
Approve visual diffsVisualQ UI or MCP (approve_vrt_results)
Project setup, pages, schedules, billingVisualQ UI

For agent-driven workflows beyond CI triggers, see the MCP integration.

On this page