Skip to content

CLI Reference ​

The shiplightai CLI is the entry point for every local Shiplight workflow: scaffolding a new project, running YAML E2E tests alongside Playwright tests, debugging a test interactively, and regenerating HTML reports. It ships as an npm package (shiplightai) and is invoked through bun run shiplight <command> from any project that has it installed.

This page covers how to install and keep the CLI up to date, and then every subcommand with its flags. If you are looking for the YAML E2E test format, see YAML E2E Test Format. If you are looking for browser automation features, see Guides.

Installation ​

The CLI is meant to be installed as a project dependency inside the same directory as your tests. Never globally. The easiest way to get started is the built-in scaffolder:

bash
bunx --package shiplightai@latest shiplight create ./my-tests
cd my-tests
cp .env.example .env                       # then set credentials in .env (see below)
bun install
bun run shiplight setup-api-token              # or set an AI provider API key in .env instead
bun run playwright install chromium
bun run shiplight debug tests/example.test.yaml --open

For credentials, either run bun run shiplight setup-api-token to write a Shiplight API token to .env, or set an AI provider API key such as GOOGLE_API_KEY there yourself. See LLM Providers.

The scaffold includes tests/example.test.yaml, a self-contained starter test that fills in and submits a public demo web form and verifies the confirmation message. The final command opens it in the visual debugger so you can step through each statement live before writing your own tests.

The @latest prefix is only needed for the first invocation, before anything is installed. Once the scaffolder has written a package.json with shiplightai as a dependency and you have run bun install, invoke commands with bun run shiplight <command> from inside the project.

Why not a global install ​

Global installs pin once and never auto-update, so the CLI and library silently drift apart from what's live on npm. shiplightai refuses to run when installed globally. If you have one from an earlier attempt, remove it:

bash
npm uninstall -g shiplightai # for a legacy npm global install

Upgrading ​

Scaffolded projects depend on shiplightai with a caret range starting at the version that created them, for example:

json
{
  "dependencies": {
    "shiplightai": "^0.1.107"
  }
}

To pick up newer versions within that range, run bun update from inside your project:

bash
bun update shiplightai

This updates the lockfile to the newest release the range allows. Below version 1.0.0 a caret range stays within one minor line, so ^0.1.107 never reaches 0.2.0. To move to a newer minor line, install it explicitly:

bash
bun add shiplightai@latest

CI keeps running the version captured in your lockfile until you commit an updated lockfile, so updating locally is the mechanism for propagating new releases. There is no silent auto-update in CI.

Freshness warning ​

On every invocation, the CLI compares the running version against the latest published version on npm (cached locally for ~1 hour) and prints a yellow warning if you are behind:

⚠ shiplightai 0.1.49 is available (you have 0.1.47).
  Run: npm update shiplightai

The warning is a best-effort nag: completely silent on network failure, always skipped when CI=true is set in the environment (every major CI provider sets this automatically), and checks npm for updates once per hour. The published CLI currently shows this warning in npm projects with a package-lock.json. Bun projects do not get the warning; check for updates with bun update shiplightai. The warning appears whenever the background check resolves: typically before your command output on a warm cache, or mid-run on a cold cache. Short-lived commands like --version may exit before the check completes, which is fine.

Node and Playwright requirements ​

  • Node.js >= 22 and Bun 1.4 or newer — Bun installs dependencies and invokes CLI commands; Node executes the CLI and Playwright tests.
  • @playwright/test — declared as a peer dependency of shiplightai (pinned to an exact version that the current CLI was built against). bun install picks it up automatically; you do not need to list it yourself.
  • Chromium — only needed for browsers that use it. Install on demand with bun run playwright install chromium.

Commands ​

All commands are invoked via bun run shiplight <command> from inside a project that has shiplightai installed locally. Bun also puts node_modules/.bin on PATH for project scripts such as bun run test.

CommandPurpose
shiplight setup-api-tokenCreate or restore a personal Shiplight API token for local use
shiplight createScaffold a new Shiplight test project
shiplight testRun YAML E2E tests alongside Playwright tests
shiplight debugLaunch the interactive visual debugger for a YAML E2E test
shiplight reportRegenerate the HTML report from saved artifacts
shiplight transpileTranspile YAML E2E tests to Playwright .spec.ts files
shiplight inspectParse a YAML E2E test and print its parsed form as JSON
shiplight specPrint the YAML language or action reference
shiplight --versionPrint the installed CLI version
shiplight --helpPrint top-level usage and list subcommands

shiplight setup-api-token ​

Authenticates the CLI with the Shiplight platform and writes a personal API token to the current project's .env file:

bash
bun run shiplight setup-api-token

The command opens a browser for Shiplight account authentication, asks you to select an organization, and creates or restores a personal shp_pat_… token as SHIPLIGHT_API_TOKEN. The browser-authenticated device session is used only during setup; the CLI does not persist it. If your organization does not have an active paid plan, the browser opens its Billing page after approval.

Use this command for local development only. For CI or other shared automation, create an organization token at app.shiplight.ai/api-tokens and store it in your CI secret manager.

By default the command signs in to the public service at app.shiplight.ai. For a self-hosted or enterprise Shiplight service, set SHIPLIGHT_API_URL (see Shiplight service) before running it. The API returns the browser verification URL. In CI, or when SHIPLIGHT_NO_BROWSER=1 is set, the command does not open a browser; it prints that URL for you to open.

To stop using the token in a project, remove SHIPLIGHT_API_TOKEN from its .env file. To invalidate the token everywhere, revoke it from API Tokens.

shiplight create ​

Scaffolds a new Shiplight test project at the given path. See Installation above for the full first-run recipe. Used for manual terminal onboarding, the alternative to having a coding agent scaffold via /shiplight create-yaml-tests.

bash
bunx --package shiplightai@latest shiplight create <path> [options]

Generated files:

  • package.json — declares shiplightai as a dependency, with a caret range starting at the version that ran create (see Upgrading), plus test and test:headed scripts. @playwright/test is installed automatically as a peer dependency of shiplightai, so it does not need to be listed.
  • playwright.config.ts — uses shiplightConfig() from shiplightai and wires up the Shiplight reporter
  • .gitignore — excludes node_modules/, .env, .auth, .shiplight/, test-results/, shiplight-report/, transpiled .yaml.spec.ts files
  • .env.example — a starter file with commented entries for SHIPLIGHT_API_TOKEN and each supported AI provider key
  • .mcp.json — registers the Shiplight MCP server (@shiplightai/mcp) for coding agents that read this file
  • auth/example.login.ts — an example login helper for tests that need authentication
  • tests/example.test.yaml — a self-contained starter test you can run immediately to verify your install works

Options:

OptionDescriptionDefault
<path>Directory where the project should be created (positional). Use . to scaffold into the current repository— (required)
--name <name>package.json name field. Must be a valid lowercase npm package name (letters, digits, hyphens, underscores, dots).basename of <path>
--jsonPrint the result as one JSON object instead of prose. For each existing file left untouched, it includes the template and a merge strategy for an agent to apply—
--help, -hPrint usage for this subcommand—

You can run create against an existing repository. It never overwrites a file that already exists: it writes the missing files and reports each existing one (for example package.json or playwright.config.ts) as a conflict for you, or your coding agent, to merge by hand.

shiplight test ​

Runs your test suite. The CLI transpiles any YAML E2E test files (*.test.yaml) to .yaml.spec.ts on the fly so they execute alongside your regular *.test.ts files in the same run. Any argument you pass after shiplight test is forwarded to Playwright, so the full Playwright CLI surface is available:

bash
bun run shiplight test                                  # run everything
bun run shiplight test --headed                         # show the browser
bun run shiplight test my-saas-app/                     # run one project
bun run shiplight test tests/login.test.yaml            # run one file
bun run shiplight test --grep "checkout"                # run by name pattern
bun run shiplight test --workers 4                      # control parallelism
bun run shiplight test --vars TEST_USER=standard_user   # override a {{VAR}} for this run

shiplight test also accepts these Shiplight options; it removes them before forwarding the rest to Playwright:

OptionDescription
--vars KEY=VAL[,KEY=VAL...]Override runtime {{VAR}} values for this run. Repeatable. A comma separates pairs, so values cannot contain commas; use --vars-file for those. Use --vars=KEY=--value for a value that starts with --
--vars-file <path>JSON file of overrides ({ "KEY": "value" }). Values must be strings. --vars wins over the file for the same key
--offlineSkip the pre-test call to the Shiplight service for organization settings and run on built-in model defaults. Same as SHIPLIGHT_OFFLINE=1

Overrides take precedence over the variables defined in playwright.config.ts, and keep the sensitive setting declared there.

shiplight test sets PWDEBUG=console by default, so that self-healed actions are cached as durable locators rather than positional XPaths. This also defines a window.playwright global on every page. If the site under test detects that marker, set PWDEBUG=0; cached locator quality then degrades.

After the run completes, the CLI prints the report location. Each run writes its report to shiplight-report/<run-id>/, and shiplight-report/latest points to the most recent run, so open shiplight-report/latest/index.html to see results with per-step screenshots, videos, and traces. Set SHIPLIGHT_REPORT_DIR to write the report to a fixed folder instead. See shiplight report to regenerate or merge reports, and shiplight transpile if you want to inspect the generated .yaml.spec.ts code.

See Local Testing for the full project flow: environment variables, authentication, CI/CD integration, and project structure.

shiplight debug ​

Launches a visual debugger for a YAML E2E test file. Opens a local web UI where you can browse tests, step through statements one at a time, inspect the page, edit YAML and re-run, all in real time against a live browser.

bash
bun run shiplight debug                                    # browse current directory
bun run shiplight debug tests/                             # browse tests/ directory
bun run shiplight debug tests/login.test.yaml              # open a specific test
bun run shiplight debug tests/login.test.yaml --open       # also launch in browser

Options:

OptionDescriptionDefault
--port <n>Port for the debugger's local web server6174
--url <url>Starting URL for a newly created test—
--newCreate the target file if it does not exist—
--openAuto-open the debugger in your default browser—
--no-openDo not auto-open the browser (default)—
--headedForce a visible Chromium window (overrides use.headless)—
--offlineSkip the pre-flight call to the Shiplight service for organization settings and use built-in model defaults. Same as SHIPLIGHT_OFFLINE=1—

Creating a new test while debugging:

bash
bun run shiplight debug tests/checkout.test.yaml --new --url https://myapp.com/checkout --open

This creates tests/checkout.test.yaml from a starter template if it does not exist, then opens the debugger pointed at it.

The debugger auto-detects your playwright.config.ts and uses its settings (browser, baseURL, storage state, etc.). If no config is found, it runs in standalone mode with a built-in browser sandbox, useful for writing tests before your project has any Playwright setup.

shiplight report ​

Regenerates or merges HTML reports from saved Playwright artifacts. Useful when you want to view a report without re-running tests, or to combine reports from parallel shards into one.

bash
bun run shiplight report                         # regenerate the latest run's report
bun run shiplight report my-report               # regenerate a different folder
bun run shiplight report my-report --open        # regenerate and open in browser
bun run shiplight report --merge shard-1 shard-2 # merge multiple shard outputs
bun run shiplight report --merge shard-*/ -o combined-report --github-summary

Options:

OptionDescription
[folder]Report folder (positional). Default: the latest run (./shiplight-report/latest), or ./shiplight-report when there is no latest link
--openOpen the generated report in your default browser
--merge <dirs...>Merge multiple report directories into one combined report
-o, --output <dir>Output directory for a merged report. Default: ./shiplight-report
--github-summaryWith --merge, write a test summary to $GITHUB_STEP_SUMMARY
--trigger <name>Label the uploaded run with this trigger instead of detecting it. Detection recognizes GitHub Actions, GitLab CI, and CircleCI, and falls back to Local elsewhere

With SHIPLIGHT_API_TOKEN set, shiplight test uploads its completed report automatically. shiplight report also uploads by default when it regenerates a report. Set SHIPLIGHT_REPORT_TO_CLOUD=0 (or the legacy REPORT_TO_CLOUD=0 when the canonical variable is unset) to keep reports local; 1, true, yes and on explicitly enable upload. See CI/CD for setup.

The reporter is also wired up automatically by shiplightConfig() in your playwright.config.ts, so you do not normally need to run shiplight report after a regular shiplight test: the report is generated as part of the run. See Run Locally → Report for how to customize the reporter output during a run.

shiplight transpile ​

Transpiles YAML E2E test files to standalone Playwright .yaml.spec.ts files. You normally do not need to run this manually: shiplight test transpiles on the fly, but it is useful when you want to inspect the generated code, check it into source control, or run it with a vanilla bun run playwright test command.

bash
bun run shiplight transpile                            # transpile all **/*.test.yaml
bun run shiplight transpile "tests/**/*.test.yaml"     # transpile a specific glob
bun run shiplight transpile --strict                   # fail on unenriched drafts

Options:

OptionDescriptionDefault
[glob]Glob pattern of YAML E2E test files to transpile (positional)**/*.test.yaml
--strictTreat low action coverage as an error instead of a warning. Use it when tests are generated programmatically: bare drafts transpile, but re-detect every element with the model at run time—

The generated .yaml.spec.ts files live alongside their .test.yaml sources. Add *.yaml.spec.ts to your .gitignore if you do not want to track them: the scaffolder does this by default.

shiplight inspect ​

Parses a YAML E2E test file and prints the parsed test as JSON. Useful for checking how a YAML file is read.

bash
bun run shiplight inspect tests/login.test.yaml                  # pretty-printed JSON
bun run shiplight inspect tests/suite.test.yaml --stats          # statement statistics only
bun run shiplight inspect tests/login.test.yaml --compact | jq . # compact JSON

Options:

OptionDescription
<file>YAML E2E test file (positional)
--prettyPretty-print the JSON (default)
--compactPrint compact JSON
--statsPrint statement statistics only

shiplight spec ​

Prints an authoring reference shipped with the installed CLI, so it always matches the version you run. Coding agents use it when writing tests.

bash
bun run shiplight spec yaml                 # the YAML test language: statement types, keys, grammar
bun run shiplight spec actions              # every action a statement can name, with its parameters
bun run shiplight spec yaml > yaml-spec.md  # save it to a file

Environment variables ​

Shiplight reads CLI settings directly and forwards SDK settings through an explicit allowlist. Arbitrary shell variables are not automatically exposed to the agent's internal SDK config.

All of these should be set in your project's .env file (auto-discovered by shiplightConfig()) or in your shell environment before running shiplight test.

LLM providers ​

Provider API keys (GOOGLE_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY), model selection (WEB_AGENT_MODEL, WEB_AGENT_FALLBACK_MODELS, COMPUTER_USE_MODEL), the per-request timeout (WEB_AGENT_LLM_TIMEOUT_MS), custom endpoints (OPENAI_BASE_URL, ANTHROPIC_BASE_URL), Vertex AI routing (ANTHROPIC_MODELS_USE_VERTEXAI, GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION), and the Shiplight LLM proxy (SHIPLIGHT_API_TOKEN, with WEB_AGENT_TIER to pick a tier) are documented together on LLM Providers.

Shiplight service ​

VariableDescriptionDefault
SHIPLIGHT_API_TOKENShiplight API token. Used for the LLM proxy, the cloud action cache, report uploads, and organization settings—
SHIPLIGHT_API_URLBase URL of the Shiplight API. Required for a self-hosted or enterprise Shiplight service; every API call (LLM proxy, cache, uploads, settings) goes theresee below
SHIPLIGHT_OFFLINE1 skips the organization-settings call before test and debug (same as --offline)—
SHIPLIGHT_REPORT_TO_CLOUD0 disables automatic report upload; 1, true, yes or on enables it. Upload defaults on when SHIPLIGHT_API_TOKEN is set.token dependent
SHIPLIGHT_NO_BROWSER1 stops setup-api-token from opening a browser; it prints the sign-in URL instead—

When SHIPLIGHT_API_URL is unset, the CLI uses the public Shiplight service (api.shiplight.ai and app.shiplight.ai) for shp_ tokens. A self-hosted or enterprise deployment must set SHIPLIGHT_API_URL, so tokens and test data go to that service. The API also supplies browser verification URLs and serves as the base for service links.

Reports ​

VariableDescriptionDefault
SHIPLIGHT_REPORT_DIRWrite the HTML report to this fixed folder instead of shiplight-report/<run-id>/. latest is not updated, so pass the folder to shiplight reportshiplight-report/<run-id>/

Action cache ​

VariableValuesDefault
SHIPLIGHT_ACTION_CACHE_BACKENDauto: cloud with CI and a token, otherwise local. local: force file storage. cloud: force cloud storage; requires SHIPLIGHT_API_TOKEN.auto

This is a CLI setting, not an SDK allowlist entry. Unknown values are errors. .env values override shell and CI settings. local stores cache under .shiplight/action-cache/ and makes no action-cache API calls; it does not change AI routing or report uploads. See Action cache in CI for persistence through GitHub Actions cache storage or Git commits.

Tools ​

VariableDescriptionDefault
MAILGUN_API_KEYMailgun API key, required by the extract_email_content tool—
MAILGUN_DOMAINMailgun domain, required by extract_email_content—

Logging ​

VariableDescriptionDefault
SDK_LOG_LEVELSDK log verbosity. One of debug, info, warn, error, silent (case-insensitive).info

Telemetry ​

The CLI sends one usage event per command: the subcommand name and the shape of the machine, never arguments, paths, URLs, test content, or account identifiers. Each event carries a pseudonymous install ID, a one-way hash of the machine and OS user (the raw hostname and username are not sent), so events from the same machine can be linked across runs.

VariableDescription
SHIPLIGHT_TELEMETRYSet to 0 to disable usage telemetry
DO_NOT_TRACKSet to 1 to disable usage telemetry

Variables the agent does not receive ​

The CLI forwards raw environment variables to the test agent only from an allowlist. Settings it resolves itself, such as WEB_AGENT_MODEL and WEB_AGENT_FALLBACK_MODELS, still apply. A variable outside the allowlist has no effect on AI steps, even when it is set in .env or the shell. These pages document the supported settings; the allowlist also carries a few internal switches. Your own test code and playwright.config.ts can still read any variable through process.env.

Troubleshooting ​

shiplight: command not found ​

You are running shiplight as a bare command from your shell, but node_modules/.bin is not on your PATH. This is expected: the CLI is intentionally not designed for global installation. Use bun run shiplight <command> instead, or run it through an npm script (bun run test, etc.), which automatically puts node_modules/.bin on PATH.

"cannot be run from a global install" ​

You hit the hard block on startup. The fix is in the error message itself:

bash
npm uninstall -g shiplightai # for a legacy npm global install
cd <your-project>
bun add shiplightai
bun run shiplight <command>

"A global shiplightai install was detected" ​

You have a project-local install (good) but also a leftover global install (not good). The coexisting global install can shadow your project's copy in some contexts. Remove it:

bash
npm uninstall -g shiplightai # for a legacy npm global install

The warning is non-blocking: your command still ran, but the global install is a ticking time bomb for version skew, so clean it up.

The freshness warning keeps firing after bun update ​

If bun update shiplightai ran but the warning still shows the same numbers on the next invocation, check two things:

  1. Your package.json version range. The scaffolder writes a caret range such as "^0.1.107", and bun update only moves within that range. Below 1.0.0, a caret range stays on one minor line, so when a newer minor ships (for example 0.2.0), bun update silently does nothing. Run bun add shiplightai@latest to move to it.
  2. The local version cache. The CLI caches the latest-version lookup for ~1 hour in ~/.shiplight/version-check.json. If the cache is fresh but wrong, rm ~/.shiplight/version-check.json and try again.

Running in CI and want the warning silenced ​

The warning is automatically suppressed when the CI environment variable is set to a truthy value: all major CI providers (GitHub Actions, GitLab, CircleCI, Jenkins, etc.) do this for you. If you are running in an environment that does not set CI but still want the warning silenced, set it yourself:

bash
CI=true bun run shiplight test

The scaffolded project has deprecation warnings on bun install ​

Some warnings come from transitive dependencies (for example node-domexception) and are outside the CLI's direct control. These are non-fatal.

  • Local Testing — project structure, authentication, environment variables, CI/CD
  • YAML E2E Test Format — statement types, actions, locators, variables, templates
  • Guides — persistent profiles, mobile emulation, extension testing

Released under the MIT License.