import subprocess
import sys

backend_dir = '/root/cma-management/backend'

# Run task1 - insert data source
print("=== 子任务1: 插入数据源 ===")
result = subprocess.run(
    [sys.executable, 'scripts/_task1_insert_source.py'],
    cwd=backend_dir,
    capture_output=True,
    text=True,
)
print(result.stdout)
if result.stderr:
    print(f"STDERR: {result.stderr}")

# Run task4 - create Excel template
print("\n=== 子任务4: 创建Excel模板 ===")
result = subprocess.run(
    [sys.executable, 'scripts/_task4_create_template.py'],
    cwd=backend_dir,
    capture_output=True,
    text=True,
)
print(result.stdout)
if result.stderr:
    print(f"STDERR: {result.stderr}")
