import subprocess

def xhs_publish(image_path: str, title: str, body: str) -> str:
    cmd = [
        "python", "xhs_publish_cli.py",
        "--image", image_path,
        "--title", title,
        "--body", body,
    ]
    r = subprocess.run(cmd, capture_output=True, text=True)
    if r.returncode == 0:
        return "小红书已发布✅"
    return f"发布失败❌\n{r.stdout}\n{r.stderr}"

print(xhs_publish("test.jpg", "从bot调用CLI测试", "这是一条从 subprocess 调用 CLI 的测试"))
