Metadata-Version: 2.4
Name: wecar-wechat-collector-cli
Version: 0.1.0
Summary: Standalone CLI for the WECAR WeChat collector HTTP API
Author: WECAR AI
Project-URL: Repository, http://gitlab4.weicheche.cn/lunjianxi/wechat-robot
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# Collector CLI MVP

## PyPI 安装

```powershell
pip install wecar-wechat-collector-cli
wecar-wechat-collector status
```

需要连接其他电脑上的采集器时，可临时指定地址：

```powershell
wecar-wechat-collector --url http://192.168.1.20:18765 status
```

也可以复制并修改包内的 `config/collector-cli.toml`，再通过
`--config 路径` 指定自己的配置文件。

该目录是云端 Agent Skill 使用的独立命令行客户端。它只使用 Python 标准库，不依赖
`wechat_mvp`、OpenCV、OCR 或 SQLite，可以将整个 `collector_cli/` 文件夹单独复制、
压缩并分发到其他电脑。

## 独立目录

```text
collector_cli/
├─ config/
│  └─ collector-cli.toml   API 地址、请求超时和默认查询条数
├─ __init__.py
├─ __main__.py
├─ cli.py
├─ client.py
├─ README.md
└─ API.md
```

需要 Python 3.11 或更高版本，不需要安装第三方依赖。

## 配置

编辑 `collector_cli/config/collector-cli.toml`：

```toml
[api]
base_url = "http://192.168.1.20:18765"
timeout_seconds = 5.0

[query]
default_next_limit = 30
default_history_limit = 50
```

`base_url` 必须填写采集机真实的局域网 IP。不要使用 `0.0.0.0`，它只能作为采集器
服务端监听地址。

## 使用

在包含 `collector_cli/` 的父目录执行：

```powershell
python -m collector_cli status
python -m collector_cli next --limit 30
python -m collector_cli history --conversation-id 12 --limit 50
python -m collector_cli ack --conversation-id 12 --through-message-id 105 --decision replied
```

也支持直接执行目录：

```powershell
python collector_cli status
```

`next` 只读，不会推进游标；发送失败时不要调用 `ack`。`ack` 成功后，后续 `next` 只返回该会话中更新的消息。

默认接口、请求超时以及 `next/history` 默认条数来自目录内部的
`config/collector-cli.toml`。全局 `--url`、`--timeout` 和各命令的 `--limit` 可临时
覆盖配置；使用其他配置文件时传入 `--config 路径`。

从局域网其他电脑读取时，`--url` 必须填写采集机的真实局域网 IP，例如：

```powershell
python -m collector_cli --url http://192.168.1.20:18765 status
```

不要使用 `http://0.0.0.0:18765`；`0.0.0.0` 只用于采集器监听全部网卡。

完整的 HTTP 路径、请求参数、消息字段、分页和消费游标语义见
[`API.md`](API.md)。
