DiffyCli
Command-Line tool for interacting with Diffy.
Great for building integrations for your CI/CD tools. Allows taking screenshots, diffs, comparing environments.

Usage
Manual Installation
Download the latest release from https://github.com/DiffyWebsite/diffy-cli/releases page. Download just diffy.phar file. No need for all the source code. You can copy file to your executables so it is available everywhere.
wget -O /usr/local/bin/diffy https://github.com/diffywebsite/diffy-cli/releases/latest/download/diffy.phar
chmod a+x /usr/local/bin/diffy
Installation with Composer
composer require diffy-website/diffy-cli --with-all-dependencies
Authentication
You need to obtain a Key to interact with API. This can be done from Profile.
Once you have a key -- run
diffy auth:login xxxxxxxxxxxx
This will save the key for future usages, to ~/.diffy-cli/diffy-cli.yaml (set DIFFYCLI_CONFIG to use another file).
No account yet? Create one from the terminal:
diffy auth:register [email protected] --name="Jane Doe" --coupon=CODE
The account gets a random password that is never shown. We email a link to set your own password, which
you only need for the web dashboard. The command creates an API key and saves it, so you are logged in right
away. The coupon is optional; without one (or a paid plan) the account has no API access.
To check that the saved key works:
diffy auth:status
It exits with 0 when the key works, 1 when there is no valid key and 2 when the account has no API
access. To get a password reset email: diffy auth:reset-password [email protected].
To talk to another Diffy environment (e.g. staging) instead of production, set DIFFY_API_HOST to its
hostname for every command, and log in with a key created in that environment:
export DIFFY_API_HOST=staging.diffy.website
diffy auth:login xxxxxxxxxxxx
Use a separate DIFFYCLI_CONFIG file for it if you don't want to overwrite your production key.
Commands
Take screenshots
diffy screenshot:create PROJECT_ID ENVIRONMENT
PROJECT_ID is an ID of the project. You can get it from URL of your project.
ENVIRONMENT is one of "production", "staging", "development" (short options: "prod", "stage", "dev")
You can use --wait key to wait for the screenshot to be completed.
As a result, you will get an ID of the screenshot.
Get screenshot status
diffy screenshot:get-status SCREENSHOT_ID
Prints 1 when the set of screenshots is completed, and nothing while it is still being captured.
Add --format=json to get the capture state and progress instead:
diffy screenshot:get-status SCREENSHOT_ID --format=json
{"id":1421873,"state":3,"completed":true,"name":null,"environment":"Production","executionTime":"2min 6s","status":{"results":84,"items":84,"queue":0,"estimate":"under 1 minute","totalTime":126,"jobs":0,"inProgress":0}}
state is -1 stopped, 0 not started, 1 in progress, 2/3/4 completed. Note that the plain
output 1 means completed, while state of 1 means the capture is still in progress.
Compare screenshots (creating diff)
If you know your screenshots IDs the easiest would be:
diffy diff:create PROJECT_ID SCREENSHOT_ID1 SCREENSHOT_ID2
Also, you can create diff with custom name:
diffy diff:create PROJECT_ID SCREENSHOT_ID1 SCREENSHOT_ID2 --name="custom"
Shortcut to take screenshots and compare them right away
diffy project:compare PROJECT_ID production staging
or compare with baseline
diffy project:compare PROJECT_ID baseline staging
or in case of custom environments (also set the name for the diff to be "custom")
diffy project:compare PROJECT_ID prod custom --env2Url="https://custom.example.com" --name="custom"
or in case of custom environment with basic auth credentials
diffy project:compare PROJECT_ID prod custom --env2Url="https://custom.example.com" --env2User="user" --env2Pass="password"
Allowed environments are: prod, stage, dev, custom (long options: production, staging, development).
Add --wait to wait for the diff to complete (--max-wait seconds, 1200 by default). The diff ID is printed
first; the command then exits with a non-zero code if the diff fails or does not complete in time.
Send feedback on a comparison
diffy feedback:send DIFF_ID --rating=useful --comment="Caught a header overflow at 640px."