Improve quickstart cli (#4205)

This commit is contained in:
Stanislav Novosad
2025-12-04 21:14:48 -07:00
committed by GitHub
parent 43e89d2991
commit 92280d5890
4 changed files with 21 additions and 9 deletions

View File

@@ -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")

View File

@@ -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."""

View File

@@ -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:

View File

@@ -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]")