Files
Christian Gick bd8d96335e feat: add pipeline engine with approval flow and file triggers
Sequential step executor (script, claude_prompt, approval, api_call,
template, skyvern placeholder), reaction-based approvals, file upload
trigger matching, portal API state sync.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 17:06:07 +02:00

28 lines
831 B
Python

"""Script step — execute a shell command and capture output."""
import asyncio
import logging
logger = logging.getLogger(__name__)
async def execute_script(config: dict, **_kwargs) -> str:
"""Execute a shell script and return stdout."""
script = config.get("script", "")
if not script:
raise ValueError("Script step requires 'script' field")
proc = await asyncio.create_subprocess_shell(
script,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
stdout, stderr = await proc.communicate()
output = stdout.decode("utf-8", errors="replace").strip()
if proc.returncode != 0:
err = stderr.decode("utf-8", errors="replace").strip()
raise RuntimeError(f"Script exited with code {proc.returncode}: {err or output}")
return output