Skip to main content

Overview

The Stably CLI is a command-line tool for developers who prefer working in the terminal. It provides essential commands for authentication, coverage planning (stably plan), test generation (stably create), test execution (stably test), and automated maintenance with stably fix while keeping your tests and fixes in your local repository.
Browser-backed CLI agent commands can use a Stably-hosted browser with --browser=cloud or STABLY_CLOUD_BROWSER=1. See Cloud Browsers for Stably CLI.

Interactive Agent

Launch the interactive agent with stably:
This opens a conversational interface where you can work with the AI agent to:
  • Create tests — Describe what you want to test and the agent generates Playwright tests
  • Fix failing tests — Paste error output or describe issues and get fixes applied
  • Explore your test suite — Ask questions about coverage, flaky tests, or test structure
  • Get guidance — Learn best practices or troubleshoot problems interactively
The interactive agent is ideal when you want a flexible, back-and-forth workflow rather than running individual commands.

Cloud Browser Mode

The interactive agent can run in a Stably-hosted browser:
This is useful in remote dev environments, coding-agent sessions, or containers where local browser setup is undesirable.

Create Tests on Autopilot

stably create is a headless, one-shot command designed for automation pipelines, background agents, and batch processing. It generates tests and exits — making it ideal for CI/CD workflows, shell scripts, and integration with AI coding agents.
The prompt is optional. If no prompt is provided, Stably automatically analyzes:
  1. Current PR — If running in a CI environment with PR context
  2. Git diffs — Changes against origin/HEAD when running locally
This makes it easy to auto-generate tests for your recent changes without describing them manually.
For interactive, back-and-forth test creation, use the Interactive Agent instead. stably create is optimized for unattended execution.

Use Cases

Output Location

If --output is not specified, Stably automatically detects the output directory:
  1. playwright.config.ts — Uses testDir if defined
  2. Auto-detect — First existing: tests/e2e/__tests__/test/
  3. Fallback — Current working directory
The command prints created file paths, making it easy to parse in CI:

Integration Patterns

Avoid infinite PR loops. If a PR created by npx stably create triggers the same workflow, it can create an endless cycle of auto-generated PRs. Always add a precondition to skip the workflow when the PR author is stably-bot:

Plan Test Coverage

stably plan analyzes your repository, identifies likely coverage gaps, and generates user-reviewable test.fixme() plan files. Use it when you want a concrete test plan before generating or writing real tests.
Unlike stably verify, stably plan does not open a browser. Unlike stably create, it does not try to finish real tests in one pass. It stays focused on repo analysis and produces plan files you can review, refine, and turn into actual tests later. See the full Test Planning (stably plan) guide for examples and workflow guidance.

Running Tests

stably test runs your Playwright tests with the Stably reporter automatically configured — no manual setup needed.
Use --suiteName to set a custom name for the suite as it appears on the Stably dashboard and in Slack notifications. When omitted, the suite name defaults to the full list of Playwright project names being run (sorted alphabetically, joined with , ). See the full Run Tests guide for environment variables, CI workflows, debug mode, and more.

Fix Tests on Autopilot

stably fix automatically diagnoses test failures and applies AI-generated fixes — ideal for self-healing CI pipelines, background agents, and automated maintenance.
See the full Fix Tests (stably fix) guide for run ID detection, CI integration, diagnosis categories, monitoring, and configuration.

Verify App Behavior

stably verify checks whether your application works correctly by describing expected behavior in plain English. An AI agent launches a real browser, interacts with your app, and reports a structured PASS / FAIL / INCONCLUSIVE verdict — no test files generated.
Exit codes: 0 = PASS, 1 = FAIL, 2 = INCONCLUSIVE — making it composable in scripts and CI pipelines.
See the full Verify with AI Agents guide for detailed output examples, agent iteration workflows, and the stably-verify skill prompt.

Run History (stably runs)

stably runs lets you browse and inspect test run history from the terminal — filter by branch, status, source, and more.
See the full Run History (stably runs) guide for all filtering options, pagination, JSON output, and example workflows.

Test Health Analytics (stably analytics)

stably analytics surfaces your most problematic tests — ranked by flaky rate or failure rate — so you can prioritize fixes where they matter most.

Subcommands

Options

Both subcommands share the same options:

Examples


Agent Configuration

Configure CLI agent behavior using stably.yaml in your repository root and STABLY-CREATE.md for test generation rules. See Fix Tests (stably fix) — Configuration for the full agent.fix reference.

Command Reference

A complete reference of all available Stably CLI commands.

Commands

Setup

Core Workflow

Maintenance & Utility

Global Options

These options are available for all commands:

Environment Variables

Configure Stably CLI behavior using environment variables:
To disable telemetry, set any one of: STABLY_DISABLE_TELEMETRY=1, DO_NOT_TRACK=1, or use the --no-telemetry flag.
Setting environment variables:
Add to ~/.bashrc, ~/.zshrc, or ~/.profile for persistence.

Test Environment Variables

Beyond Stably configuration, you can pass your own variables to tests using --env and --env-file:
Variable precedence (highest priority wins):
  1. Stably internals (STABLY_API_KEY, STABLY_PROJECT_ID)
  2. process.env — system/shell environment
  3. --env-file — local .env file(s)
  4. --env — remote environment from Stably
See Environments for managing named environments on the Stably dashboard.

Exit Codes

Stably CLI uses standard exit codes for scripting and CI/CD integration: Example usage in scripts:

Debug Logging

The Stably CLI automatically writes detailed debug logs to help troubleshoot issues. Logs are organized by date with descriptive session names for easy discovery.

Log Location

Logs are stored in your system’s temp directory:
Naming convention: HH-MM-SS-{session-name}.log
  • Named commands use the command name (e.g., login, init, test)
  • stably create uses the prompt text (sanitized, max 100 chars)
  • stably fix uses fix-{runId}
  • Interactive chat uses the first message
Logs in /tmp are automatically cleaned up by your operating system on reboot or via system cleanup policies.

Verbose Mode

Use --verbose (or -v) to see debug output in your terminal and display the log file path:
Output:

Log Levels

You can also set the log level via environment variable:

Sharing Logs with Support

When errors occur, the CLI automatically displays the log file path (no --verbose required):
Attach this file when contacting support for faster resolution.
To see the log file path for successful runs, use --verbose. The path will be shown at startup and when you press Ctrl+C.

Troubleshooting

If you encounter browser-related errors:

Next Steps

GitHub Actions

Integrate with CI/CD

Test Reporter

Configure the Stably reporter