Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
added new CLi to stof skyvern sever (#2549)
Prakash Maheshwaran642994eaaedd
diff --git a/skyvern/cli/__init__.py b/skyvern/cli/__init__.pyindex ed1db13c0..153ec861a 100644--- a/skyvern/cli/__init__.py+++ b/skyvern/cli/__init__.py@@ -8,6 +8,7 @@ __all__ = ["tasks_app","docs_app","status_app",+ "stop_app","init_app",]@@ -16,5 +17,6 @@ from .docs import docs_appfrom .quickstart import quickstart_appfrom .run_commands import run_appfrom .status import status_app+from .stop_commands import stop_appfrom .tasks import tasks_appfrom .workflow import workflow_appdiff --git a/skyvern/cli/commands.py b/skyvern/cli/commands.pyindex 019ac9263..7dffdc0a7 100644--- a/skyvern/cli/commands.py+++ b/skyvern/cli/commands.py@@ -6,6 +6,7 @@ from .init_command import init, init_browserfrom .quickstart import quickstart_appfrom .run_commands import run_appfrom .status import status_app+from .stop_commands import stop_appfrom .tasks import tasks_appfrom .workflow import workflow_app@@ -23,6 +24,7 @@ cli_app.add_typer(workflow_app, name="workflow", help="Workflow management commacli_app.add_typer(tasks_app, name="tasks", help="Task management commands.")cli_app.add_typer(docs_app, name="docs", help="Open Skyvern documentation.")cli_app.add_typer(status_app, name="status", help="Check if Skyvern services are running.")+cli_app.add_typer(stop_app, name="stop", help="Stop Skyvern services like the API server.")init_app = typer.Typer(invoke_without_command=True,help="Interactively configure Skyvern and its dependencies.",diff --git a/skyvern/cli/stop_commands.py b/skyvern/cli/stop_commands.pynew file mode 100644index 000000000..ac8be7b83--- /dev/null+++ b/skyvern/cli/stop_commands.py@@ -0,0 +1,31 @@+import typer+from rich.panel import Panel+from rich.prompt import Confirm++from skyvern.config import settings++from .console import console+from .run_commands import get_pids_on_port, kill_pids++stop_app = typer.Typer(help="Stop Skyvern services like the API server.")+++@stop_app.command(name="server")+def stop_server(+ force: bool = typer.Option(False, "--force", "-f", help="Force kill without confirmation"),+) -> None:+ """Stop the Skyvern API server running on the configured port."""+ port = settings.PORT+ console.print(f"[bold green]Checking for process on port {port}...[/bold green]")+ pids = get_pids_on_port(port)+ if not pids:+ console.print(f"[yellow]No process found running on port {port}.[/yellow]")+ return+ if not force:+ prompt = f"Process{'es' if len(pids) > 1 else ''} running on port {port}. Kill them?"+ confirm = Confirm.ask(prompt)+ if not confirm:+ console.print("[yellow]Server not stopped.[/yellow]")+ return+ kill_pids(pids)+ console.print(Panel(f"Stopped server on port {port}", border_style="red"))