# hive-mp-cli — 一键安装

## 安装步骤（中文）

复制以下命令喂给你的 AI Agent（Claude Code / Cursor / Codex / OpenClaw 等）：

> 帮我安装 hive-mp-cli：https://www.resopod.cn/install/hive-mp-cli.md

Agent 会读取本指南完成所有依赖安装。目标是安装 hive-mp-cli、安装 Chromium，并跑通 `hive-mp doctor`。

### Agent 执行细节

边界：
- 不要使用 `sudo`，除非用户明确授权。
- 不要在当前项目 workspace 写临时文件；临时文件放到 `/tmp/`。
- hive-mp-cli 的持久化数据放在 `~/.hive-mp/`。

步骤：

```bash
python3 --version
python3 -m pip install --user pipx -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pipx ensurepath
python3 -m pipx install "https://www.resopod.cn/packages/hive-mp-cli/latest/hive_mp_cli-0.2.2-py3-none-any.whl"
PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright/ pipx run --spec "https://www.resopod.cn/packages/hive-mp-cli/latest/hive_mp_cli-0.2.2-py3-none-any.whl" playwright install chromium
hive-mp doctor
```

如果 `hive-mp` 不在 PATH 中，先让用户重开 shell，或临时使用 `python3 -m pipx run --spec "https://www.resopod.cn/packages/hive-mp-cli/latest/hive_mp_cli-0.2.2-py3-none-any.whl" hive-mp doctor` 验证。

首次配置：

```bash
hive-mp login
hive-mp account add "<公众号名>"
hive-mp doctor
```

可选：安装配套 skill，让 Agent 后续知道如何稳定操作 CLI。

```bash
mkdir -p ~/.claude/skills/hive-mp-cli-skill/
curl -L "https://www.resopod.cn/skills/hive-mp-cli-skill.tar.gz" | tar -xz -C ~/.claude/skills/hive-mp-cli-skill/
```

排障：
- 如果系统提示 externally-managed environment，优先用 pipx，不要改系统 Python。
- 如果 Chromium 下载失败，确认 Playwright 下载镜像前缀已按当前站点替换。
- 如果 `hive-mp doctor` 提示 token 或账号缺失，引导用户运行 `hive-mp login` 和 `hive-mp account add "<公众号名>"`。

---

## Install Steps (English)

Copy the line below to your AI Agent (Claude Code / Cursor / Codex / OpenClaw / etc.):

> Install hive-mp-cli for me: https://www.resopod.cn/install/hive-mp-cli.md

The agent will read this guide and install all dependencies. The goal is to install hive-mp-cli, install Chromium, and pass `hive-mp doctor`.

### Agent Execution Details

Boundaries:
- Do not use `sudo` unless the user explicitly approves it.
- Do not write temporary files into the current project workspace; use `/tmp/`.
- hive-mp-cli persistent data belongs under `~/.hive-mp/`.

Steps:

```bash
python3 --version
python3 -m pip install --user pipx -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pipx ensurepath
python3 -m pipx install "https://www.resopod.cn/packages/hive-mp-cli/latest/hive_mp_cli-0.2.2-py3-none-any.whl"
PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright/ pipx run --spec "https://www.resopod.cn/packages/hive-mp-cli/latest/hive_mp_cli-0.2.2-py3-none-any.whl" playwright install chromium
hive-mp doctor
```

If `hive-mp` is not on PATH yet, ask the user to open a new shell, or temporarily verify with `python3 -m pipx run --spec "https://www.resopod.cn/packages/hive-mp-cli/latest/hive_mp_cli-0.2.2-py3-none-any.whl" hive-mp doctor`.

First-time setup:

```bash
hive-mp login
hive-mp account add "<public-account-name>"
hive-mp doctor
```

Optional: install the companion skill so future agents know how to operate the CLI reliably.

```bash
mkdir -p ~/.claude/skills/hive-mp-cli-skill/
curl -L "https://www.resopod.cn/skills/hive-mp-cli-skill.tar.gz" | tar -xz -C ~/.claude/skills/hive-mp-cli-skill/
```

Troubleshooting:
- If the system reports an externally managed environment, use pipx and do not modify system Python.
- If Chromium download fails, confirm that the Playwright download mirror prefix was replaced for the current site.
- If `hive-mp doctor` reports missing token or accounts, guide the user through `hive-mp login` and `hive-mp account add "<public-account-name>"`.
