From 92280d58905a9ba2a4ba39e77b2f5659378409b4 Mon Sep 17 00:00:00 2001 From: Stanislav Novosad Date: Thu, 4 Dec 2025 21:14:48 -0700 Subject: [PATCH] Improve quickstart cli (#4205) --- skyvern/cli/commands.py | 4 ++-- skyvern/cli/init_command.py | 8 +++++--- skyvern/cli/llm_setup.py | 3 +++ skyvern/cli/quickstart.py | 15 +++++++++++---- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/skyvern/cli/commands.py b/skyvern/cli/commands.py index 2387f2d1..c06fbf24 100644 --- a/skyvern/cli/commands.py +++ b/skyvern/cli/commands.py @@ -4,7 +4,7 @@ from dotenv import load_dotenv from skyvern.utils.env_paths import resolve_backend_env_path from .docs import docs_app -from .init_command import init, init_browser +from .init_command import init_browser, init_env from .quickstart import quickstart_app from .run_commands import run_app from .status import status_app @@ -46,7 +46,7 @@ def init_callback( ) -> None: """Run full initialization when no subcommand is provided.""" if ctx.invoked_subcommand is None: - init(no_postgres=no_postgres) + init_env(no_postgres=no_postgres) @init_app.command(name="browser") diff --git a/skyvern/cli/init_command.py b/skyvern/cli/init_command.py index 888a312e..9284bbec 100644 --- a/skyvern/cli/init_command.py +++ b/skyvern/cli/init_command.py @@ -19,9 +19,9 @@ from .llm_setup import setup_llm_providers, update_or_add_env_var from .mcp import setup_local_organization, setup_mcp -def init( +def init_env( no_postgres: bool = typer.Option(False, "--no-postgres", help="Skip starting PostgreSQL container"), -) -> None: +) -> bool: """Interactive initialization command for Skyvern.""" console.print( Panel( @@ -104,7 +104,7 @@ def init( api_key = Prompt.ask("Please re-enter your Skyvern API key", password=True) if not api_key: console.print("[bold red]Error: API key cannot be empty. Aborting initialization.[/bold red]") - return + return False update_or_add_env_var("SKYVERN_BASE_URL", base_url) analytics_id_input = Prompt.ask("Please enter your email for analytics (press enter to skip)", default="") @@ -134,6 +134,8 @@ def init( console.print("[bold]To start using Skyvern, run:[/bold]") console.print(Padding("skyvern run server", (1, 4), style="reverse green")) + return run_local + def init_browser() -> None: """Initialize only the browser configuration and install Chromium.""" diff --git a/skyvern/cli/llm_setup.py b/skyvern/cli/llm_setup.py index 4220b2a3..4a0f79ed 100644 --- a/skyvern/cli/llm_setup.py +++ b/skyvern/cli/llm_setup.py @@ -1,3 +1,5 @@ +import os + from dotenv import load_dotenv, set_key from rich.panel import Panel from rich.prompt import Confirm, Prompt @@ -51,6 +53,7 @@ def update_or_add_env_var(key: str, value: str) -> None: load_dotenv(env_path) set_key(env_path, key, value) + os.environ[key] = value def setup_llm_providers() -> None: diff --git a/skyvern/cli/quickstart.py b/skyvern/cli/quickstart.py index e026cba2..4e4ae192 100644 --- a/skyvern/cli/quickstart.py +++ b/skyvern/cli/quickstart.py @@ -9,7 +9,7 @@ from rich.progress import Progress, SpinnerColumn, TextColumn # Import console after skyvern.cli to ensure proper initialization from skyvern.cli.console import console -from skyvern.cli.init_command import init # init is used directly +from skyvern.cli.init_command import init_env # init is used directly from skyvern.cli.utils import start_services quickstart_app = typer.Typer(help="Quickstart command to set up and run Skyvern with one command.") @@ -59,7 +59,7 @@ def quickstart( try: # Initialize Skyvern console.print("\n[bold blue]Initializing Skyvern...[/bold blue]") - init(no_postgres=no_postgres) + run_local = init_env(no_postgres=no_postgres) # Skip browser installation if requested if not skip_browser_install: @@ -76,8 +76,15 @@ def quickstart( console.print("⏭️ [yellow]Skipping Chromium installation as requested.[/yellow]") # Start services - console.print("\n[bold blue]Starting Skyvern services...[/bold blue]") - asyncio.run(start_services(server_only=server_only)) + if run_local: + start_now = typer.confirm("\nDo you want to start Skyvern services now?", default=True) + if start_now: + console.print("\n[bold blue]Starting Skyvern services...[/bold blue]") + asyncio.run(start_services(server_only=server_only)) + else: + console.print( + "\n[yellow]Skipping service startup. You can start services later with 'skyvern run all'[/yellow]" + ) except KeyboardInterrupt: console.print("\n[bold yellow]Quickstart process interrupted by user.[/bold yellow]")