Metadata-Version: 2.4
Name: cloud-doc-monitor
Version: 0.1.0
Summary: 通用云文档监控 skill 包，支持抓取、搜索、变更检测、对比、总结和通知
Author: Ayizibaalimujiang
License-Expression: MIT
Keywords: cloud,monitor,docs,skill,crawler,llm
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: lxml>=4.9.0
Requires-Dist: pyyaml>=6.0.0
Provides-Extra: bos
Requires-Dist: baidubce>=0.8.3; extra == "bos"
Provides-Extra: publish
Requires-Dist: build>=1.2.2; extra == "publish"
Requires-Dist: twine>=6.0.1; extra == "publish"
Dynamic: license-file

# cloud-doc-monitor

一个通用的云厂商文档监控 skill 包。

对外只暴露 6 个 skill：

- `fetch_doc`
- `search_docs`
- `check_changes`
- `compare_docs`
- `summarize_diff`
- `run_monitor`

所有 skill 都统一返回：

- `machine`: 给 OpenClaw、Claude Code、工作流系统读
- `human`: 给人读

## 运行环境

- Python `>=3.9`
- 如果需要 BOS 上传，安装额外依赖：`pip install cloud-doc-monitor[bos]`

## 安装

从 PyPI 安装：

```bash
pip install cloud-doc-monitor
```

如果需要 BOS：

```bash
pip install 'cloud-doc-monitor[bos]'
```

本地开发：

```bash
pip install -e .
```

## Python 调用

```python
from cloud_doc_monitor import CloudDocMonitorSkillSet

skills = CloudDocMonitorSkillSet(config_path="/abs/path/config.yaml")
result = skills.fetch_doc(cloud="baidu", product="VPC", doc_ref="0jwvytzll")
print(result["machine"]["title"])
print(result["human"]["summary_text"])
```

## CLI 调用

列出 skill：

```bash
cloud-doc-monitor list-skills
```

抓取单篇文档：

```bash
cloud-doc-monitor run fetch_doc \
  --config /abs/path/config.yaml \
  --payload '{"cloud":"baidu","product":"VPC","doc_ref":"0jwvytzll","with_summary":true}'
```

查最近变更：

```bash
cloud-doc-monitor run check_changes \
  --config /abs/path/config.yaml \
  --payload '{"cloud":"aliyun","product":"/vpc","days":7,"max_pages":20,"with_summary":true}'
```

运行巡检：

```bash
cloud-doc-monitor run run_monitor \
  --config /abs/path/config.yaml \
  --payload '{"clouds":["aliyun","tencent","baidu","volcano"],"products":["vpc","eni"],"days":1,"max_pages":20,"with_summary":true,"send_notification":false,"output_format":"both"}'
```

更多可复制示例：

- [examples/python_fetch_doc.py](/Users/ayizibaalimujiang/baidu/personal-code/testab/examples/python_fetch_doc.py)
- [examples/cli-examples.sh](/Users/ayizibaalimujiang/baidu/personal-code/testab/examples/cli-examples.sh)

## 配置依赖

关键配置：

- `storage.backend = local|bos`
- `storage.database`
- `storage.local_root`
- `storage.report_dir`
- `storage.bos.*`
- `crawler.temp_dir`
- `llm.*`
- `notifications[*]`
- `monitor.default_clouds`
- `monitor.default_products`

参考：

- `config.example.yaml`
- [config.md](/Users/ayizibaalimujiang/baidu/personal-code/testab/references/config.md)

## 对外 skill 说明

### fetch_doc

适合：
- 抓取某篇文档
- 打开某个产品说明页

输入：

```json
{
  "cloud": "aliyun|tencent|baidu|volcano",
  "doc_ref": "url|alias|slug|doc_id",
  "product": "optional",
  "with_summary": true
}
```

### search_docs

适合：
- 某个产品有哪些文档
- 帮我找相关说明页

### check_changes

适合：
- 最近更新了什么
- 最近 7 天阿里云 VPC 有什么变化

### compare_docs

适合：
- 对比腾讯云和百度云 ENI
- 对比不同云厂商某个功能的文档能力描述

### summarize_diff

适合：
- 总结两个版本差异
- 把 diff 讲人话

### run_monitor

适合：
- 运行巡检
- 生成日报
- 发通知

## 发包

本地构建：

```bash
./scripts/build_dist.sh
```

上传到 TestPyPI：

```bash
./scripts/publish_dist.sh testpypi
```

上传到 PyPI：

```bash
./scripts/publish_dist.sh pypi
```

常见环境变量：

```bash
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=pypi-xxxxxxxx
```

如果你不想走脚本，也可以直接：

```bash
python3 -m build --sdist --wheel
python3 -m twine check dist/*
python3 -m twine upload dist/*
```

## 目录结构

```text
cloud-doc-monitor/
├── SKILL.md
├── scripts/
├── references/
├── assets/
├── examples/
└── cloud_doc_monitor/
    ├── skill.py
    ├── tools/
    ├── crawlers/
    ├── llm.py
    ├── diffing.py
    ├── storage.py
    └── notifications.py
```
