Skip to content

Automate browser based workflows with AI

Add guided `skyvern setup` quickstart + rename signup to login (#4988)

Marc Kelechava6bf5b4fafae8
diff --git a/fern/integrations/cli.mdx b/fern/integrations/cli.mdx
index 76a71da84..461db0bfd 100644
--- a/fern/integrations/cli.mdx
+++ b/fern/integrations/cli.mdx
@@ -12,34 +12,28 @@ The `skyvern` CLI gives you direct access to browser automation, workflow manage
pip install skyvern
```
-Sign up and get your API key in one step:
+## Getting started
-```bash
-skyvern signup
-```
-
-This opens a browser, walks you through account creation (or login), and saves your API key locally. No manual copy-paste needed.
-
-Already have an API key? Set it directly:
+Two commands to go from install to working MCP:
```bash
-export SKYVERN_API_KEY="YOUR_KEY"
+skyvern login # opens browser, authenticates, saves API key
+skyvern setup # auto-detects your AI tools, configures MCP for all of them
```
-Optionally run the interactive setup wizard to configure your full environment (LLM provider, database, browser mode):
+`login` handles both new signups and returning users. `setup` detects Claude Code, Cursor, Windsurf, and Claude Desktop, then writes the correct MCP config for each one. Pass `--api-key YOUR_KEY` to either command if you already have a key.
-```bash
-skyvern init
-```
+<Tip>
+Don't want to install the CLI? You can also copy-paste the MCP config JSON directly — see [MCP Server](/integrations/mcp) for the zero-install path.
+</Tip>
## Command reference
### Onboarding
```bash
-skyvern signup # Sign up / login via browser — saves API key automatically
-skyvern init # Interactive setup wizard (LLM, database, browser)
-skyvern quickstart # One-command setup + start
+skyvern login # Authenticate via browser — saves API key locally
+skyvern setup # Auto-detect AI tools and configure MCP for all of them
```
### Services
@@ -156,25 +150,36 @@ skyvern block validate --file block.json # Validate a block definition
### MCP setup
-Register Skyvern's MCP server with your AI coding tool in one command:
+Register Skyvern's MCP server with your AI coding tools:
```bash
-skyvern setup claude-code # Register with Claude Code + install skills (/qa, etc.)
-skyvern setup claude-code --project # Register with Claude Code (project-level)
+skyvern setup # Auto-detect all tools and configure at once
+skyvern setup claude-code # Configure Claude Code only (global)
+skyvern setup claude-code --project # Configure Claude Code (project-level)
skyvern setup claude-code --skip-skills # MCP only, no skills
-skyvern setup claude-desktop # Register with Claude Desktop
-skyvern setup cursor # Register with Cursor
-skyvern setup windsurf # Register with Windsurf
-skyvern setup codex # Register with Codex
+skyvern setup claude # Configure Claude Desktop only
+skyvern setup cursor # Configure Cursor only
+skyvern setup windsurf # Configure Windsurf only
```
+Use bare `skyvern setup` to configure everything at once. The per-tool subcommands are for when you only want to target one tool.
+
`skyvern setup claude-code` writes the MCP config **and** copies bundled skills (including `/qa`) into your project's `.claude/skills/` directory. Use `--skip-skills` to opt out.
+### Self-hosted setup
+
+These commands are for running Skyvern on your own infrastructure. If you're using Skyvern Cloud, you don't need them — `skyvern login` + `skyvern setup` is all you need.
+
+```bash
+skyvern init # Full interactive wizard (PostgreSQL, LLM providers, browser, .env)
+skyvern init browser # Initialize browser configuration only
+skyvern quickstart # One-command init + start
+```
+
### Other
```bash
skyvern docs # Open documentation in your browser
-skyvern init browser # Initialize browser configuration only
```
## CLI vs MCP: when to use which
diff --git a/fern/integrations/mcp.mdx b/fern/integrations/mcp.mdx
index ec81ee8f6..c0eb08583 100644
--- a/fern/integrations/mcp.mdx
+++ b/fern/integrations/mcp.mdx
@@ -133,6 +133,10 @@ x-api-key = "SKYVERN_API_KEY"
That's it — no Python, no `pip install`, no local server. Your AI assistant connects directly to Skyvern Cloud over HTTPS. Claude Desktop uses [mcp-remote](https://www.npmjs.com/package/mcp-remote) to bridge the connection (requires Node.js >= 20).
+<Tip>
+Prefer a CLI? `pip install skyvern` then run `skyvern setup` — it auto-detects your AI tools and configures MCP for all of them at once.
+</Tip>
+
## Alternative: Local mode (self-hosted)
Use this if you are self-hosting Skyvern and want the MCP server to talk to your own instance instead of Skyvern Cloud. This runs a lightweight Python process on your machine that connects to your local Skyvern server.
@@ -205,7 +209,7 @@ Replace `/usr/bin/python3` with the output of `which python3`. For Skyvern Cloud
</Tabs>
<Tip>
-You can also run `skyvern init` to auto-detect installed clients and write configs automatically.
+You can also run `skyvern setup` to auto-detect installed clients and write configs automatically.
</Tip>
<Accordion title="Config file locations by client">
diff --git a/skyvern/cli/auth_command.py b/skyvern/cli/auth_command.py
index af6aa083c..b5012f2d7 100644
--- a/skyvern/cli/auth_command.py
+++ b/skyvern/cli/auth_command.py
@@ -109,8 +109,11 @@ class _CallbackHandler(http.server.BaseHTTPRequestHandler):
def run_signup(
base_url: str = _DEFAULT_FRONTEND_URL,
timeout: int = _CALLBACK_TIMEOUT,
-) -> None:
- """Core signup logic. Called by both the Typer command and init_command."""
+) -> str | None:
+ """Core signup logic. Called by both the Typer command and init_command.
+
+ Returns the API key on success, or None if signup failed before saving.
+ """
from .llm_setup import update_or_add_env_var
bound_socket = _find_free_port()
@@ -161,8 +164,10 @@ def run_signup(
console.print("API key saved to .env")
console.print(f"Base URL: {api_base_url}")
+ return api_key
+
-def signup(
+def login(
base_url: str = typer.Option(
_DEFAULT_FRONTEND_URL,
"--base-url",
@@ -171,8 +176,16 @@ def signup(
timeout: int = typer.Option(
_CALLBACK_TIMEOUT,
"--timeout",
- help="Timeout in seconds waiting for browser signup",
+ help="Timeout in seconds waiting for browser authentication",
),
) -> None:
- """Sign up for Skyvern Cloud and save your API key."""
+ """Authenticate with Skyvern Cloud and save your API key.
+
+ Opens a browser to sign up or log in. Your API key is saved locally
+ so you only need to do this once.
+ """
run_signup(base_url=base_url, timeout=timeout)
+
+
+# Backwards-compatible alias
+signup = login
diff --git a/skyvern/cli/commands/__init__.py b/skyvern/cli/commands/__init__.py
index ec757bd96..b49fbc621 100644
--- a/skyvern/cli/commands/__init__.py
+++ b/skyvern/cli/commands/__init__.py
@@ -6,6 +6,7 @@ from dotenv import load_dotenv
from skyvern.forge.sdk.forge_log import setup_logger as _setup_logger
from skyvern.utils.env_paths import resolve_backend_env_path
+from ..auth_command import login as login_command
from ..auth_command import signup as signup_command
from ..block import block_app
from ..credential import credential_app
@@ -83,7 +84,8 @@ cli_app.add_typer(
quickstart_app, name="quickstart", help="One-command setup and start for Skyvern (combines init and run)."
)
-cli_app.command(name="signup")(signup_command)
+cli_app.command(name="login")(login_command)
+cli_app.command(name="signup", hidden=True)(signup_command) # backwards compat
# Browser automation commands
cli_app.add_typer(browser_app, name="browser", help="Browser automation commands.")
diff --git a/skyvern/cli/setup_commands.py b/skyvern/cli/setup_commands.py
index bd2c61b14..ad3cebe93 100644
--- a/skyvern/cli/setup_commands.py
+++ b/skyvern/cli/setup_commands.py
@@ -2,18 +2,25 @@
from __future__ import annotations
+import copy
import json
import os
import platform
import shutil
import sys
+from dataclasses import dataclass
from pathlib import Path
+from typing import Callable
from urllib.parse import urlparse
import typer
from dotenv import load_dotenv
+from rich.panel import Panel
from rich.syntax import Syntax
+from rich.table import Table
+from skyvern.analytics import capture_setup_event
+from skyvern.cli.auth_command import run_signup
from skyvern.cli.console import console
from skyvern.cli.skill_commands import get_skill_dirs
from skyvern.utils.env_paths import resolve_backend_env_path
@@ -22,7 +29,10 @@ from skyvern.utils.env_paths import resolve_backend_env_path
# `skyvern init`. This module supersedes them with remote-first defaults,
# dry-run support, and API key protection. The init-path helpers should be
# migrated to use _upsert_mcp_config() in a follow-up.
-setup_app = typer.Typer(help="Register Skyvern MCP with AI coding tools.")
+setup_app = typer.Typer(
+ help="Register Skyvern MCP with AI coding tools.",
+ invoke_without_command=True,
+)
_DEFAULT_REMOTE_URL = "https://api.skyvern.com/mcp/"
@@ -103,6 +113,43 @@ def _has_api_key(entry: dict | None) -> bool:
return any(isinstance(a, str) and a.startswith("x-api-key:") for a in args)
+def _mask_key(key: str) -> str:
+ """Mask an API key for display. Always masks, even short keys."""
+ if len(key) > 8:
+ return key[:4] + "****" + key[-4:]
+ if len(key) > 2:
+ return key[:2] + "****"
+ return "****"
+
+
+def _mask_secrets(entry: dict) -> dict:
+ """Return a copy of an MCP config entry with API keys masked for display."""
+ masked = copy.deepcopy(entry)
+
+ # Remote HTTP format: headers.x-api-key
+ if "headers" in masked and "x-api-key" in masked["headers"]:
+ key = masked["headers"]["x-api-key"]
+ masked["headers"]["x-api-key"] = _mask_key(key)
+
+ # Local stdio format: env.SKYVERN_API_KEY
+ if "env" in masked and "SKYVERN_API_KEY" in masked["env"]:
+ key = masked["env"]["SKYVERN_API_KEY"]
+ masked["env"]["SKYVERN_API_KEY"] = _mask_key(key)
+
+ # mcp-remote bridge format: args contain "x-api-key:..."
+ if "args" in masked:
+ masked["args"] = [
+ (
+ "x-api-key:" + _mask_key(a[len("x-api-key:") :])
+ if isinstance(a, str) and a.startswith("x-api-key:")
+ else a
+ )
+ for a in masked["args"]
+ ]
+
+ return masked
+
+
def _upsert_mcp_config(
config_path: Path,
tool_name: str,
@@ -139,12 +186,12 @@ def _upsert_mcp_config(
if current is not None:
console.print(f"[yellow]Config differs from expected for {tool_name}[/yellow]")
console.print("\n[bold]Current:[/bold]")
- console.print(Syntax(json.dumps(current, indent=2), "json"))
+ console.print(Syntax(json.dumps(_mask_secrets(current), indent=2), "json"))
else:
console.print(f"[bold]Adding Skyvern MCP config for {tool_name}:[/bold]")
console.print("\n[bold]New:[/bold]")
- console.print(Syntax(json.dumps(skyvern_entry, indent=2), "json"))
+ console.print(Syntax(json.dumps(_mask_secrets(skyvern_entry), indent=2), "json"))
if dry_run:
console.print(f"\n[yellow]Dry run -- no changes written to {config_path}[/yellow]")
@@ -181,6 +228,121 @@ def _build_entry(
return _build_remote_mcp_entry(api_key, url=remote_url)
+# ---------------------------------------------------------------------------
+# Tool detection
+# ---------------------------------------------------------------------------
+
+
+@dataclass(frozen=True)
+class DetectedTool:
+ """Describes an AI coding tool that can be auto-detected and configured."""
+
+ name: str
+ config_path_fn: Callable[[], Path]
+ is_installed_fn: Callable[[], bool]
+ use_mcp_remote_bridge: bool = False
+
+
+def _is_claude_code_installed() -> bool:
+ return shutil.which("claude") is not None
+
+
+def _is_cursor_installed() -> bool:
+ return (Path.home() / ".cursor").is_dir()
+
+
+def _is_windsurf_installed() -> bool:
+ return (Path.home() / ".codeium" / "windsurf").is_dir()
+
+
+def _is_claude_desktop_installed() -> bool:
+ system = platform.system()
+ if system == "Darwin":
+ return (Path.home() / "Library" / "Application Support" / "Claude").is_dir()
+ if system == "Linux":
+ return (Path.home() / ".config" / "Claude").is_dir()
+ if system == "Windows":
+ appdata = os.environ.get("APPDATA", "")
+ return bool(appdata) and (Path(appdata) / "Claude").is_dir()
+ return False
+
+
+def _get_known_tools() -> list[DetectedTool]:
+ """Return all known AI coding tools in detection order.
+
+ Note: Codex is not included — it has no stable local config path to detect.
+ Users can configure it manually via `skyvern setup codex` if/when that subcommand is added.
+ """
+ return [
+ DetectedTool(
+ name="Claude Code",
+ config_path_fn=_claude_code_global_config_path,
+ is_installed_fn=_is_claude_code_installed,
+ ),
+ DetectedTool(
+ name="Cursor",
+ config_path_fn=_cursor_config_path,
+ is_installed_fn=_is_cursor_installed,
+ ),
+ DetectedTool(
+ name="Windsurf",
+ config_path_fn=_windsurf_config_path,
+ is_installed_fn=_is_windsurf_installed,
+ ),
+ DetectedTool(
+ name="Claude Desktop",
+ config_path_fn=_claude_desktop_config_path,
+ is_installed_fn=_is_claude_desktop_installed,
+ use_mcp_remote_bridge=True,
+ ),
+ ]
+
+
+def _detect_installed_tools() -> tuple[list[DetectedTool], list[DetectedTool]]:
+ """Detect which AI coding tools are installed.
+
+ Returns (detected, not_detected) lists.
+ """
+ detected: list[DetectedTool] = []
+ not_detected: list[DetectedTool] = []
+ for tool in _get_known_tools():
+ try:
+ if tool.is_installed_fn():
+ detected.append(tool)
+ else:
+ not_detected.append(tool)
+ except Exception:
+ not_detected.append(tool)
+ return detected, not_detected
+
+
+def _acquire_api_key(api_key_flag: str | None, yes: bool) -> str:
+ """Resolve an API key from flag, environment, or interactive login.
+
+ Priority: --api-key flag > env/dotenv > interactive browser login.
+ """
+ if api_key_flag:
+ return api_key_flag
+
+ env_key, _ = _get_env_credentials()
+ if env_key:
+ return env_key
+
+ if yes:
+ console.print(
+ "[red bold]Error:[/red bold] No API key found. Use --api-key to provide one, or run `skyvern login` first."
+ )
+ raise typer.Exit(code=1)
+
+ console.print("No API key found. Opening browser to log in...")
+ key = run_signup()
+ if not key:
+ console.print("[red]Login did not return an API key.[/red]")
+ raise typer.Exit(code=1)
+
+ return key
+
+
# ---------------------------------------------------------------------------
# Config path resolvers
# ---------------------------------------------------------------------------
@@ -245,10 +407,15 @@ def _run_setup(
*,
use_mcp_remote_bridge: bool = False,
) -> None:
- env_key, env_url = _get_env_credentials()
- key = api_key or env_key
+ resolved_key = _acquire_api_key(api_key, yes)
+ _, env_url = _get_env_credentials()
entry = _build_entry(
- key, env_url, local=local, use_python_path=use_python_path, url=url, use_mcp_remote_bridge=use_mcp_remote_bridge
+ resolved_key,
+ env_url,
+ local=local,
+ use_python_path=use_python_path,
+ url=url,
+ use_mcp_remote_bridge=use_mcp_remote_bridge,
)
_upsert_mcp_config(config_path, tool_name, entry, dry_run=dry_run, yes=yes)
@@ -294,6 +461,149 @@ def _install_skills(project_dir: Path, dry_run: bool = False) -> None:
console.print(f"[dim]Skills already installed: {', '.join(skipped)}[/dim]")
+# ---------------------------------------------------------------------------
+# Guided quickstart (bare `skyvern setup`)
+# ---------------------------------------------------------------------------
+
+
+@setup_app.callback(invoke_without_command=True)
+def setup_guided(
+ ctx: typer.Context,
+ api_key: str | None = _api_key_opt,
+ dry_run: bool = _dry_run_opt,
+ yes: bool = _yes_opt,
+ local: bool = _local_opt,
+ use_python_path: bool = _python_path_opt,
+ url: str | None = _url_opt,
+) -> None:
+ """Guided quickstart: detect installed AI tools and configure MCP for all of them."""
+ if ctx.invoked_subcommand is not None:
+ return
+
+ console.print(
+ Panel(
+ "[bold]Skyvern MCP Setup[/bold]\n\n"
+ "This wizard will:\n"
+ " 1. Find or create your Skyvern API key\n"
+ " 2. Detect installed AI coding tools\n"
+ " 3. Configure MCP for each detected tool",
+ border_style="blue",
+ )
+ )
+
+ # Step 1: API key
+ console.print("[bold]Step 1: API Key[/bold]")
+ resolved_key = _acquire_api_key(api_key, yes)
+ _, env_url = _get_env_credentials()
+ console.print("[green]API key ready.[/green]\n")
+ capture_setup_event("quickstart-api-key", success=True)
+
+ # Step 2: Detect tools
+ console.print("[bold]Step 2: Detecting installed AI tools...[/bold]")
+ detected, not_detected = _detect_installed_tools()
+
+ if detected:
+ table = Table(show_header=True, header_style="bold")
+ table.add_column("Tool")
+ table.add_column("Config Path")
+ table.add_column("Status")
+
+ for tool in detected:
+ try:
+ path = str(tool.config_path_fn())
+ except (typer.Exit, SystemExit):
+ path = "?"
+ table.add_row(tool.name, path, "[green]Detected[/green]")
+
+ console.print(table)
+
+ if not_detected:
+ names = ", ".join(t.name for t in not_detected)
+ console.print(f"Not detected: {names}\n")
+ else:
+ console.print()
+
+ capture_setup_event(
+ "quickstart-detect",
+ success=True,
+ extra_data={
+ "detected": [t.name for t in detected],
+ "not_detected": [t.name for t in not_detected],
+ },
+ )
+
+ if not detected:
+ console.print(
+ "[yellow]No supported AI tools detected.[/yellow]\n"
+ "You can configure a specific tool manually:\n"
+ " skyvern setup claude-code\n"
+ " skyvern setup cursor\n"
+ " skyvern setup windsurf\n"
+ " skyvern setup claude"
+ )
+ capture_setup_event("quickstart-no-tools", success=True)
+ return
+
+ # Step 3: Configure detected tools
+ tool_names = ", ".join(t.name for t in detected)
+ console.print(f"[bold]Step 3: Configuring {len(detected)} tool(s)...[/bold]")
+
+ if not yes and not dry_run:
+ if not typer.confirm(f"Configure Skyvern MCP for: {tool_names}?", default=True):
+ console.print("[yellow]Setup cancelled.[/yellow]")
+ raise typer.Abort()
+
+ configured: list[str] = []
+ failed: list[str] = []
+
+ for tool in detected:
+ try:
+ config_path = tool.config_path_fn()
+ use_bridge = tool.use_mcp_remote_bridge and not local
+ entry = _build_entry(
+ resolved_key,
+ env_url,
+ local=local,
+ use_python_path=use_python_path,
+ url=url,
+ use_mcp_remote_bridge=use_bridge,
+ )
+ _upsert_mcp_config(config_path, tool.name, entry, dry_run=dry_run, yes=True)
+ configured.append(tool.name)
+ except (typer.Exit, SystemExit):
+ failed.append(tool.name)
+ console.print(f"[red]Failed to configure {tool.name}[/red]")
+ except Exception as exc:
+ failed.append(tool.name)
+ console.print(f"[red]Failed to configure {tool.name}: {exc}[/red]")
+
+ console.print()
+
+ if configured:
+ configured_str = ", ".join(configured)
+ console.print(
+ Panel(
+ f"[bold green]Setup complete![/bold green]\n\n"
+ f"Configured {len(configured)} tool(s): {configured_str}\n\n"
+ f'Try asking your AI assistant:\n"Use Skyvern to navigate to example.com"',
+ border_style="green",
+ )
+ )
+ capture_setup_event(
+ "quickstart-complete",
+ success=True,
+ extra_data={"configured": configured, "failed": failed},
+ )
+ else:
+ console.print("[red]No tools were configured.[/red]")
+ capture_setup_event(
+ "quickstart-complete",
+ success=False,
+ error_type="all_tools_failed",
+ extra_data={"failed": failed},
+ )
+
+
# ---------------------------------------------------------------------------
# Commands
# ---------------------------------------------------------------------------
diff --git a/tests/unit/test_setup_quickstart.py b/tests/unit/test_setup_quickstart.py
new file mode 100644
index 000000000..eca0ea23a
--- /dev/null
+++ b/tests/unit/test_setup_quickstart.py
@@ -0,0 +1,115 @@
+"""Tests for the guided quickstart flow in `skyvern setup`.
+
+Covers the key behavioral contracts:
+- Detection exception resilience
+- API key priority (flag > env > signup) and --yes failure
+- Guided flow: writes config, respects --dry-run, subcommands still work
+"""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+
+import pytest
+from click.exceptions import Exit
+from typer.testing import CliRunner
+
+from skyvern.cli.setup_commands import _acquire_api_key, _detect_installed_tools, setup_app
+
+# Shared monkeypatch helpers ------------------------------------------------
+
+_FAKE_ENV = ("test-key", "https://api.skyvern.com")
+_NO_ENV = ("", "https://api.skyvern.com")
+
+
+def _patch_detection(monkeypatch: pytest.MonkeyPatch, *, claude_code: bool = False, cursor: bool = False) -> None:
+ monkeypatch.setattr("skyvern.cli.setup_commands._is_claude_code_installed", lambda: claude_code)
+ monkeypatch.setattr("skyvern.cli.setup_commands._is_cursor_installed", lambda: cursor)
+ monkeypatch.setattr("skyvern.cli.setup_commands._is_windsurf_installed", lambda: False)
+ monkeypatch.setattr("skyvern.cli.setup_commands._is_claude_desktop_installed", lambda: False)
+
+
+def _patch_env(monkeypatch: pytest.MonkeyPatch, env: tuple[str, str] = _FAKE_ENV) -> None:
+ monkeypatch.setattr("skyvern.cli.setup_commands._get_env_credentials", lambda: env)
+ monkeypatch.setattr("skyvern.cli.setup_commands.capture_setup_event", lambda *a, **kw: None)
+
+
+# Detection ------------------------------------------------------------------
+
+
+def test_detect_handles_exception_gracefully(monkeypatch: pytest.MonkeyPatch) -> None:
+ """If a detection function raises, the tool lands in not_detected (not a crash)."""
+ monkeypatch.setattr(
+ "skyvern.cli.setup_commands._is_claude_code_installed", lambda: (_ for _ in ()).throw(RuntimeError)
+ )
+ monkeypatch.setattr("skyvern.cli.setup_commands._is_cursor_installed", lambda: True)
+ monkeypatch.setattr("skyvern.cli.setup_commands._is_windsurf_installed", lambda: False)
+ monkeypatch.setattr("skyvern.cli.setup_commands._is_claude_desktop_installed", lambda: False)
+
+ detected, not_detected = _detect_installed_tools()
+ assert {t.name for t in detected} == {"Cursor"}
+ assert "Claude Code" in {t.name for t in not_detected}
+
+
+# API key acquisition --------------------------------------------------------
+
+
+def test_acquire_api_key_flag_beats_env() -> None:
+ assert _acquire_api_key("flag-key", yes=False) == "flag-key"
+
+
+def test_acquire_api_key_yes_without_key_fails(monkeypatch: pytest.MonkeyPatch) -> None:
+ _patch_env(monkeypatch, _NO_ENV)
+ with pytest.raises(Exit):
+ _acquire_api_key(None, yes=True)
+
+
+# Guided flow (CliRunner integration) ---------------------------------------
+
+
+def test_guided_writes_config(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ """Happy path: env key present, one tool detected, config file written."""
+ config = tmp_path / ".claude.json"
+ _patch_env(monkeypatch)
+ _patch_detection(monkeypatch, claude_code=True)
+ monkeypatch.setattr("skyvern.cli.setup_commands._claude_code_global_config_path", lambda: config)
+
+ result = CliRunner().invoke(setup_app, ["--yes"])
+ assert result.exit_code == 0
+ data = json.loads(config.read_text())
+ assert data["mcpServers"]["skyvern"]["headers"]["x-api-key"] == "test-key"
+ assert "Setup complete" in result.output
+
+
+def test_guided_dry_run_writes_nothing(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ config = tmp_path / ".claude.json"
+ _patch_env(monkeypatch)
+ _patch_detection(monkeypatch, claude_code=True)
+ monkeypatch.setattr("skyvern.cli.setup_commands._claude_code_global_config_path", lambda: config)
+
+ result = CliRunner().invoke(setup_app, ["--dry-run", "--yes"])
+ assert result.exit_code == 0
+ assert not config.exists()
+ assert "Dry run" in result.output
+
+
+def test_guided_no_tools_shows_manual_instructions(monkeypatch: pytest.MonkeyPatch) -> None:
+ _patch_env(monkeypatch)
+ _patch_detection(monkeypatch)
+
+ result = CliRunner().invoke(setup_app, ["--yes"])
+ assert result.exit_code == 0
+ assert "No supported AI tools detected" in result.output
+
+
+def test_subcommand_still_works(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ """Existing `setup claude-code` must not be broken by the callback."""
+ config = tmp_path / ".claude.json"
+ _patch_env(monkeypatch)
+ monkeypatch.setattr("skyvern.cli.setup_commands._claude_code_global_config_path", lambda: config)
+
+ result = CliRunner().invoke(setup_app, ["claude-code", "--yes"])
+ assert result.exit_code == 0
+ data = json.loads(config.read_text())
+ assert data["mcpServers"]["skyvern"]["headers"]["x-api-key"] == "test-key"