feat: add workflow rpc server command

This commit is contained in:
lda
2026-06-03 07:12:10 +07:00 Verified
parent 66750a8386
commit 19e4c61257
3 changed files with 47 additions and 0 deletions
+1
View File
@@ -21,6 +21,7 @@ dependencies = [
[project.scripts]
wf = "wf_cli.app:main"
wf-mcp = "wf_mcp.cli:main"
wf-rpc-server = "wf_transport_rpc_http.cli:main"
[dependency-groups]
dev = [
+32
View File
@@ -0,0 +1,32 @@
from __future__ import annotations
from pathlib import Path
import typer
import uvicorn
from wf_server import build_local_static_workflow_server
from .app import create_rpc_app
app = typer.Typer(add_completion=False)
@app.callback(invoke_without_command=True)
def serve(
store_root: Path = typer.Option(
...,
"--store-root",
help="Directory containing workflow artifact, draft, and run stores.",
),
host: str = typer.Option("127.0.0.1", "--host"),
port: int = typer.Option(8765, "--port", min=1, max=65535),
) -> None:
"""Serve the local/static WorkflowApi over JSON-RPC HTTP."""
server = build_local_static_workflow_server(store_root)
rpc_app = create_rpc_app(server)
uvicorn.run(rpc_app, host=host, port=port, access_log=False)
def main() -> None:
app()
+14
View File
@@ -0,0 +1,14 @@
from __future__ import annotations
from typer.testing import CliRunner
from wf_transport_rpc_http.cli import app
def test_rpc_server_cli_help_mentions_store_root() -> None:
result = CliRunner().invoke(app, ["--help"])
assert result.exit_code == 0
assert "--store-root" in result.output
assert "--host" in result.output
assert "--port" in result.output