53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
"""Python wrapper for start_local.sh"""
|
|
|
|
import subprocess
|
|
import os
|
|
from pathlib import Path
|
|
from typing import Optional, Dict, Any
|
|
|
|
|
|
def run_start_local(
|
|
working_dir: Optional[str] = None,
|
|
env: Optional[Dict[str, str]] = 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: BASH_SOURCE, SCRIPT_DIR
|
|
|
|
return subprocess.run(
|
|
["bash", str(script_path)],
|
|
cwd=working_dir,
|
|
env=run_env,
|
|
capture_output=capture_output,
|
|
check=check,
|
|
text=True,
|
|
)
|