api-wecom-cli 0.1.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- api_wecom_cli-0.1.0a1/LICENSE +21 -0
- api_wecom_cli-0.1.0a1/PKG-INFO +7 -0
- api_wecom_cli-0.1.0a1/README.md +108 -0
- api_wecom_cli-0.1.0a1/api_wecom_cli.egg-info/PKG-INFO +7 -0
- api_wecom_cli-0.1.0a1/api_wecom_cli.egg-info/SOURCES.txt +33 -0
- api_wecom_cli-0.1.0a1/api_wecom_cli.egg-info/dependency_links.txt +1 -0
- api_wecom_cli-0.1.0a1/api_wecom_cli.egg-info/entry_points.txt +2 -0
- api_wecom_cli-0.1.0a1/api_wecom_cli.egg-info/top_level.txt +4 -0
- api_wecom_cli-0.1.0a1/apis/__init__.py +3 -0
- api_wecom_cli-0.1.0a1/apis/generated_client.py +4037 -0
- api_wecom_cli-0.1.0a1/cli/__init__.py +1 -0
- api_wecom_cli-0.1.0a1/cli/generated_commands.py +11167 -0
- api_wecom_cli-0.1.0a1/cli/help_formatter.py +217 -0
- api_wecom_cli-0.1.0a1/cli/main.py +145 -0
- api_wecom_cli-0.1.0a1/core/__init__.py +7 -0
- api_wecom_cli-0.1.0a1/core/auth.py +45 -0
- api_wecom_cli-0.1.0a1/core/config.py +53 -0
- api_wecom_cli-0.1.0a1/core/errors.py +29 -0
- api_wecom_cli-0.1.0a1/core/requester.py +193 -0
- api_wecom_cli-0.1.0a1/models/__init__.py +3 -0
- api_wecom_cli-0.1.0a1/models/common.py +10 -0
- api_wecom_cli-0.1.0a1/pyproject.toml +45 -0
- api_wecom_cli-0.1.0a1/setup.cfg +4 -0
- api_wecom_cli-0.1.0a1/tests/test_auth.py +117 -0
- api_wecom_cli-0.1.0a1/tests/test_build_agent_tasks.py +356 -0
- api_wecom_cli-0.1.0a1/tests/test_catalog_diff.py +261 -0
- api_wecom_cli-0.1.0a1/tests/test_cli.py +220 -0
- api_wecom_cli-0.1.0a1/tests/test_codegen.py +132 -0
- api_wecom_cli-0.1.0a1/tests/test_config.py +66 -0
- api_wecom_cli-0.1.0a1/tests/test_coverage.py +96 -0
- api_wecom_cli-0.1.0a1/tests/test_discovery.py +409 -0
- api_wecom_cli-0.1.0a1/tests/test_requester.py +161 -0
- api_wecom_cli-0.1.0a1/tests/test_run_catalog_sync.py +209 -0
- api_wecom_cli-0.1.0a1/tests/test_scaffold.py +223 -0
- api_wecom_cli-0.1.0a1/tests/test_sync_spec_docs.py +225 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CCLUCKY
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# WeCom CLI 🚀
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://github.com/astral-sh/ruff)
|
|
6
|
+
|
|
7
|
+
企业微信(WeCom)高效率命令行工具。
|
|
8
|
+
**37 个业务域,300+ 接口,100% 覆盖。**
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 💡 为什么选择 WeCom CLI?
|
|
13
|
+
|
|
14
|
+
- **工业级同步**:基于 API Menu 树自动发现接口,每日 GitHub Actions 自动巡检接口变更。
|
|
15
|
+
- **类型安全**:100% Mypy 静态类型覆盖,生成的 API Client 具备完整的 IDE 补全。
|
|
16
|
+
- **现代化体验**:支持中文帮助信息、领域分组导航、自动 Token 刷新。
|
|
17
|
+
- **开发者友好**:基于 YAML Spec 的代码生成架构,极易扩展和维护。
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📦 安装
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install -e .
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
*要求 Python >= 3.11*
|
|
28
|
+
|
|
29
|
+
## 🚀 快速上手
|
|
30
|
+
|
|
31
|
+
配置凭证(支持环境变量或配置文件):
|
|
32
|
+
|
|
33
|
+
**环境变量:**
|
|
34
|
+
```bash
|
|
35
|
+
export WECOM_CORP_ID="wwxxxxxxxxxxxxxxxx"
|
|
36
|
+
export WECOM_CORP_SECRET="xxxxxxxxxxxxxxxxxxxxxxxx"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**配置文件** `~/.wecom-cli/config.json`:
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"corp_id": "wwxxxxxxxxxxxxxxxx",
|
|
43
|
+
"corp_secret": "xxxxxxxxxxxxxxxxxxxxxxxx"
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 常用命令示例
|
|
48
|
+
```bash
|
|
49
|
+
# 查看帮助(交互式分组)
|
|
50
|
+
wecom --help
|
|
51
|
+
|
|
52
|
+
# 通讯录:列出成员
|
|
53
|
+
wecom contacts list --department-id 1 --fetch-child
|
|
54
|
+
|
|
55
|
+
# 消息:发送文本
|
|
56
|
+
wecom messages send-text --to-user zhangsan --agent-id 1000002 --content "hello"
|
|
57
|
+
|
|
58
|
+
# 客户联系:列出已配置成员
|
|
59
|
+
wecom customers list-follow-users
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## ✨ 核心特性
|
|
63
|
+
|
|
64
|
+
- **业务域全覆盖** — 通讯录、消息、客户、会议、文档、审批、打卡等所有 Endpoint。
|
|
65
|
+
- **自动化生命周期** — 自动获取和刷新 `access_token`,统一错误分类输出。
|
|
66
|
+
- **自愈式架构** — 每日自动扫描文档发现新接口,自动提交 PR 更新 Spec 和 Client。
|
|
67
|
+
- **强类型保障** — 拒绝 Any 类型,确保开发时的逻辑准确性。
|
|
68
|
+
|
|
69
|
+
## 🛠️ 开发者指南
|
|
70
|
+
|
|
71
|
+
我们使用 `pre-commit` 来保障代码质量。
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# 安装开发依赖
|
|
75
|
+
pip install -e ".[dev]"
|
|
76
|
+
|
|
77
|
+
# 安装并激活 pre-commit hooks
|
|
78
|
+
pre-commit install
|
|
79
|
+
|
|
80
|
+
# 手动运行全量检查
|
|
81
|
+
pre-commit run --all-files
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 自动化脚本
|
|
85
|
+
- **Catalog 同步**: `python scripts/run_catalog_sync.py --mode auto-apply`
|
|
86
|
+
- **代码生成**: `python scripts/codegen.py`
|
|
87
|
+
- **覆盖率检查**: `python scripts/check_api_coverage.py`
|
|
88
|
+
|
|
89
|
+
## 📚 文档中心
|
|
90
|
+
|
|
91
|
+
| 文档 | 说明 |
|
|
92
|
+
|------|------|
|
|
93
|
+
| [Architecture](docs/architecture.md) | 分层架构设计 |
|
|
94
|
+
| [CLI UX Spec](docs/cli-ux.md) | 命令命名、输出格式规范 |
|
|
95
|
+
| [Bootstrap](docs/bootstrap.md) | 环境初始化指南 |
|
|
96
|
+
| [Coverage](docs/coverage.md) | 100% 覆盖率保障机制 |
|
|
97
|
+
| [Sync Playbook](docs/sync-playbook.md) | 接口发现与同步流程 |
|
|
98
|
+
|
|
99
|
+
## 🤝 贡献指南
|
|
100
|
+
|
|
101
|
+
1. Fork 本仓库并创建特性分支。
|
|
102
|
+
2. 确保所有检查通过:`pre-commit run --all-files`。
|
|
103
|
+
3. 接口变更需更新对应 `specs/wecom/<domain>.yaml` 并重新 codegen。
|
|
104
|
+
4. 提交 PR 并在描述中说明背景。
|
|
105
|
+
|
|
106
|
+
## 📄 开源协议
|
|
107
|
+
|
|
108
|
+
本项目采用 [MIT License](LICENSE) 开源。
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
api_wecom_cli.egg-info/PKG-INFO
|
|
5
|
+
api_wecom_cli.egg-info/SOURCES.txt
|
|
6
|
+
api_wecom_cli.egg-info/dependency_links.txt
|
|
7
|
+
api_wecom_cli.egg-info/entry_points.txt
|
|
8
|
+
api_wecom_cli.egg-info/top_level.txt
|
|
9
|
+
apis/__init__.py
|
|
10
|
+
apis/generated_client.py
|
|
11
|
+
cli/__init__.py
|
|
12
|
+
cli/generated_commands.py
|
|
13
|
+
cli/help_formatter.py
|
|
14
|
+
cli/main.py
|
|
15
|
+
core/__init__.py
|
|
16
|
+
core/auth.py
|
|
17
|
+
core/config.py
|
|
18
|
+
core/errors.py
|
|
19
|
+
core/requester.py
|
|
20
|
+
models/__init__.py
|
|
21
|
+
models/common.py
|
|
22
|
+
tests/test_auth.py
|
|
23
|
+
tests/test_build_agent_tasks.py
|
|
24
|
+
tests/test_catalog_diff.py
|
|
25
|
+
tests/test_cli.py
|
|
26
|
+
tests/test_codegen.py
|
|
27
|
+
tests/test_config.py
|
|
28
|
+
tests/test_coverage.py
|
|
29
|
+
tests/test_discovery.py
|
|
30
|
+
tests/test_requester.py
|
|
31
|
+
tests/test_run_catalog_sync.py
|
|
32
|
+
tests/test_scaffold.py
|
|
33
|
+
tests/test_sync_spec_docs.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|