"""Python wrapper for start_local.sh""" import os import subprocess from pathlib import Path def run_start_local( working_dir: str | None = None, env: dict[str, str] | None = None, capture_output: bool = True, check: bool = True, ) -> subprocess.CompletedProcess: """ Run start_local.sh shell script. Original script: app/start_local.sh Description: Start local development environment with Docker Requires Docker: True Requires Git: True Args: working_dir: Directory to run the script in env: Environment variables to set capture_output: Whether to capture stdout/stderr check: Whether to raise on non-zero exit code Returns: CompletedProcess with the result """ script_path = ( Path(__file__).parent.parent.parent.parent / "plandex" / "app/start_local.sh" ) if not script_path.exists(): raise FileNotFoundError(f"Script not found: {script_path}") # Merge environment variables run_env = os.environ.copy() if env: run_env.update(env) # Required environment variables: SCRIPT_DIR, BASH_SOURCE return subprocess.run( ["bash", str(script_path)], cwd=working_dir, env=run_env, capture_output=capture_output, check=check, text=True, )