CLI overview

The motionpr command, its global options, output modes and exit codes.

On this page
  1. Global options
  2. Exit codes
  3. JSON output
Shell
npx motionpr <command> [options]
CommandWhat it does
initCreate motionpr.config.ts with a guided setup
installDownload the Chromium build MotionPR uses
captureCapture the configured scenarios
compareCompare two captures and generate the report
runCapture, compare with the baseline, report: the everyday command
baselineApprove a capture as the baseline (accept), or show it (status)
reportOpen the most recent report, regenerating it if needed
doctorCheck Node.js, Chromium, the config, permissions and adapters
demoCapture the bundled demo app in two versions and open a real report

Global options

OptionDescription
-c, --config <path>Config file (default: motionpr.config.{ts,mts,cts,js,mjs,cjs} in the working directory)
--cwd <dir>Run as if started in <dir>
--env <name>Apply environments[name] from the config (also MOTIONPR_ENV)
--jsonMachine-readable result on stdout; human output goes to stderr
-q, --quietOnly print errors
--verbosePrint diagnostics and debug details (and error causes)
--no-colorDisable colours (also NO_COLOR=1; FORCE_COLOR=1 forces them)
--ciNon-interactive CI mode (also detected from CI, GITHUB_ACTIONS, GITLAB_CI, BUILDKITE)
-v, --versionPrint the version
-h, --helpHelp for any command

MotionPR never prompts in CI or when stdin or stderr is not a terminal. Where it would ask, it takes the safe answer and says which flag confirms the action: baseline accept refuses to replace a baseline without --yes (exit 2), and init leaves an existing config untouched without --force.

Exit codes

CodeMeaning
0Success; the comparison is within the configured thresholds
1A configured regression threshold was exceeded (comparison.failOn, --threshold)
2Configuration, execution or comparison error, including usage errors
130 / 143Interrupted by Ctrl+C / SIGTERM, after servers and the browser were shut down

See CI exit codes for how run decides between them.

JSON output

With --json, a command prints exactly one JSON document to stdout:

CommandShape
run, compareThe ComparisonResult plus report (and capture for run)
run without baseline{ status: "no-baseline", capture, report }
capture{ id, dir, scenarios: [{ key, status, checkpoints, error }] }
doctor{ ok, checks: [{ name, status, detail, fix }] }
errors{ error: { code, message, hint, issues } }
Shell
npx motionpr run --json > motionpr.json; echo "exit $?"
jq '.summary.counts' motionpr.json