Synopsis
npx @refrainai/cli generate -- \
--url <url> \
--goal <goal> \
--output <path> \
[options]
AI opens a browser, explores the target web app to accomplish the given goal, records each action, reviews the steps, and outputs a clean runbook.
Required arguments
| Argument | Description |
|---|
--url <url> | Starting URL to begin exploration |
--goal <goal> | Goal to accomplish (natural language description) |
--output <path> | Output path for the generated runbook |
Optional arguments
Exploration
| Argument | Default | Description |
|---|
--max-iterations <num> | 20 | Maximum exploration loop iterations |
--step-delay <ms> | 500 | Wait time between steps (milliseconds) |
--headless <bool> | true | Set to false to show the browser window |
Context & secrets
| Argument | Default | Description |
|---|
--context <path> | - | Path to a supplemental context markdown file |
--secrets <path> | - | Path to secrets JSON file ({"key": "value"} format, all values treated as sensitive) |
Output & debugging
| Argument | Default | Description |
|---|
--screenshots <dir> | - | Directory to save screenshots |
--video <dir> | - | Directory for video recording output |
AI model
| Argument | Default | Description |
|---|
--model <id> | claude-sonnet-4-6 | AI model ID |
--model-provider <provider> | anthropic | AI provider: anthropic, openai, openai-compatible, google, azure, bedrock, vertex |
--model-base-url <url> | - | Base URL for OpenAI-compatible endpoints |
Advanced
| Argument | Default | Description |
|---|
--locale <code> | en | UI and AI prompt language: en or ja |
--stealth | false | Enable stealth mode (bot detection evasion) |
--proxy <url> | - | Proxy URL (e.g., http://user:pass@host:port) |
--skill <names> | - | Comma-separated skill plugin names (e.g., google-sheets) |
--stealth and --proxy require Pro plan or higher. --skill requires Pro plan or higher.
Examples
Basic generation
npx @refrainai/cli generate -- \
--url "https://app.example.com/login" \
--goal "Log in with email and password, then navigate to the settings page" \
--output ./login-settings.yaml \
--context ./context.md \
--secrets ./secrets.json \
--model "claude-sonnet-4-6" \
--model-provider anthropic
With browser visible
npx @refrainai/cli generate -- \
--url "https://staging.example.com" \
--goal "Create a new project named 'Test Project'" \
--output ./create-project.yaml \
--headless false
With context file
Provide additional context to help AI understand your app:
npx @refrainai/cli generate -- \
--url "https://app.example.com" \
--goal "Export the monthly report as CSV" \
--output ./export-report.yaml \
--context ./app-guide.md
With secrets
npx @refrainai/cli generate -- \
--url "https://app.example.com/login" \
--goal "Log in and view the dashboard" \
--output ./login.yaml \
--secrets ./secrets.json
Where secrets.json:
Using OpenAI
export OPENAI_API_KEY="sk-..."
npx @refrainai/cli generate -- \
--url "https://app.example.com" \
--goal "Fill out the contact form" \
--output ./contact-form.yaml \
--model "gpt-4o" \
--model-provider openai
With screenshots and video
npx @refrainai/cli generate -- \
--url "https://app.example.com" \
--goal "Complete the onboarding flow" \
--output ./onboarding.yaml \
--screenshots ./screenshots \
--video ./videos
Environment variables
| Variable | Description |
|---|
AI_MODEL_ID | Default for --model |
AI_MODEL_PROVIDER | Default for --model-provider |
REFRAIN_LOCALE | Default for --locale (en or ja) |