Documentation Index
Fetch the complete documentation index at: https://docs.stably.ai/llms.txt
Use this file to discover all available pages before exploring further.
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.
Interactive Agent
Launch the interactive agent withstably:
- 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
Example Session
Example Session
Cloud Browser Mode
The interactive agent can run in a Stably-hosted browser: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.
For interactive, back-and-forth test creation, use the Interactive Agent instead.
stably create is optimized for unattended execution.Use Cases
| Scenario | Example |
|---|---|
| CI/CD pipelines | Auto-generate tests for new features in PR workflows |
| Background agents | Let AI coding assistants create tests autonomously |
| Batch processing | Script bulk test generation across multiple features |
| Scheduled jobs | Generate tests for new API endpoints on a cron schedule |
Output Location
Output Directory Resolution
Output Directory Resolution
If
--output is not specified, Stably automatically detects the output directory:playwright.config.ts— UsestestDirif defined- Auto-detect — First existing:
tests/→e2e/→__tests__/→test/ - Fallback — Current working directory
Example Output
Example Output
Integration Patterns
GitHub Actions: Generate Tests for PR Changes
GitHub Actions: Generate Tests for PR Changes
GitHub Actions: Generate Tests from Staging Deployment
GitHub Actions: Generate Tests from Staging Deployment
Background Agent Integration
Background Agent Integration
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.
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.
--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.
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.
0 = PASS, 1 = FAIL, 2 = INCONCLUSIVE — making it composable in scripts and CI pipelines.
Run History (stably runs)
stably runs lets you browse and inspect test run history from the terminal — filter by branch, status, source, and more.
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
| Command | Description |
|---|---|
stably analytics flaky | Show most flaky tests ranked by flaky rate |
stably analytics failures | Show most failing tests ranked by failure rate |
Options
Both subcommands share the same options:| Option | Description |
|---|---|
--days <n> | Look-back window in days (1–90, default: 7) |
-b, --branch <name> | Filter by branch name |
-n, --limit <n> | Max rows returned (1–100, default: 10) |
--json | Output as JSON |
Examples
Agent Configuration
Configure CLI agent behavior usingstably.yaml in your repository root and STABLY-CREATE.md for test generation rules.
| Feature | Configuration | Scope |
|---|---|---|
stably fix custom rules | agent.fix in stably.yaml | Fix agent behavior |
stably create custom rules | STABLY-CREATE.md in project root | Test generation behavior |
| Scheduled runs | schedules in stably.yaml | Cloud runner schedules |
agent.fix reference.
Command Reference
A complete reference of all available Stably CLI commands.Commands
Setup
| Command | Description |
|---|---|
stably init | Initialize Playwright and Stably SDK in your project |
stably install | Install browser dependencies |
stably login | Authenticate via browser-based OAuth |
Core Workflow
| Command | Description |
|---|---|
stably | Start interactive agent session |
stably plan [prompt] | Discover coverage gaps and generate test.fixme() plan files |
stably create [prompt] | Generate tests directly from prompt, PR context, or git diffs |
stably test [options] [--suiteName <name>] | Run Playwright tests with Stably reporter |
stably verify <prompt> | Verify app behavior against a natural language description |
stably fix [runId] | Auto-fix failing tests (auto-detects run ID from last test run or CI) |
stably runs list | List recent test runs with filtering |
stably runs view <runId> | View detailed results for a specific run |
stably analytics flaky | Show most flaky tests ranked by flaky rate |
stably analytics failures | Show most failing tests ranked by failure rate |
Maintenance & Utility
| Command | Description |
|---|---|
stably upgrade | Upgrade Stably CLI to the latest version |
stably logout | Clear stored credentials |
stably whoami | Display current authentication status |
stably help [command] | Show help for a specific command |
Global Options
These options are available for all commands:| Option | Description |
|---|---|
--help, -h | Display help information |
--version | Display CLI version number |
--verbose, -v | Enable verbose output with debug information |
--no-telemetry | Disable anonymous telemetry for this session |
--browser <type> | Browser mode for browser-backed agent commands: local or cloud |
--env <name> | Load variables from a named environment stored in Stably |
--env-file <path> | Load variables from a local .env file (can be specified multiple times) |
-C, --cwd <path> | Change working directory before running the command |
Environment Variables
Configure Stably CLI behavior using environment variables:| Variable | Description | Required |
|---|---|---|
STABLY_API_KEY | API key for authentication (from Settings → API Keys) | Yes |
STABLY_PROJECT_ID | Project identifier (from app.stably.ai) | Yes |
STABLY_BASE_URL | Custom API endpoint (for enterprise deployments) | No |
STABLY_CLOUD_BROWSER | Set to 1 to default browser-backed agent commands to cloud mode | No |
STABLY_LOG_LEVEL | Console log level: error, warn, info, debug (default: warn) | No |
STABLY_DISABLE_TELEMETRY | Set to 1 to disable anonymous telemetry | No |
DO_NOT_TRACK | Standard opt-out for telemetry (set to 1) | No |
To disable telemetry, set any one of:
STABLY_DISABLE_TELEMETRY=1, DO_NOT_TRACK=1, or use the --no-telemetry flag.- Unix/macOS
- Windows (PowerShell)
- CI/CD
~/.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:
- Stably internals (
STABLY_API_KEY,STABLY_PROJECT_ID) process.env— system/shell environment--env-file— local.envfile(s)--env— remote environment from Stably
Exit Codes
Stably CLI uses standard exit codes for scripting and CI/CD integration:| Code | Description |
|---|---|
0 | Success — command completed successfully |
1 | Failure — command failed (test failures, errors, etc.) |
2 | Invalid usage — incorrect arguments or missing required options |
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:HH-MM-SS-{session-name}.log
- Named commands use the command name (e.g.,
login,init,test) stably createuses the prompt text (sanitized, max 100 chars)stably fixusesfix-{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:
Log Levels
You can also set the log level via environment variable:| Level | Description |
|---|---|
error | Unexpected errors and crashes |
warn | Configuration issues, auth failures (default console output) |
info | Normal operations (session start/end) |
debug | Detailed debugging (API calls, state changes) |
Sharing Logs with Support
When errors occur, the CLI automatically displays the log file path (no--verbose required):
Troubleshooting
Authentication Issues
Authentication Issues
Installation Issues
Installation Issues
If you encounter browser-related errors:
Next Steps
GitHub Actions
Integrate with CI/CD
Test Reporter
Configure the Stably reporter