@lark-people/cli 0.0.0-beta.1
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.
- package/CHANGELOG.md +324 -0
- package/LICENSE +21 -0
- package/README.md +232 -0
- package/README.zh.md +232 -0
- package/bin/people-cli_darwin_amd64 +0 -0
- package/bin/people-cli_darwin_arm64 +0 -0
- package/bin/people-cli_linux_amd64 +0 -0
- package/bin/people-cli_linux_arm64 +0 -0
- package/bin/people-cli_windows_amd64.exe +0 -0
- package/bin/people-cli_windows_arm64.exe +0 -0
- package/package.json +41 -0
- package/scripts/install-wizard.js +700 -0
- package/scripts/install.js +56 -0
- package/scripts/run.js +36 -0
- package/skills/people-attendance/SKILL.md +667 -0
- package/skills/people-attendance/references/people-attendance-submission.md +426 -0
- package/skills/people-attendance/scripts/resolve_date.py +894 -0
- package/skills/people-corehr/references/people-corehr-pre-hire-search.md +0 -0
- package/skills/people-corehr-employee/SKILL.md +111 -0
- package/skills/people-corehr-employee/references/people-corehr-employee-basic-info-query.md +97 -0
- package/skills/people-corehr-employee/references/people-corehr-employee-fields-list.md +87 -0
- package/skills/people-corehr-employee/references/people-corehr-employee-filter.md +403 -0
- package/skills/people-corehr-employee/references/people-corehr-employee-search.md +73 -0
- package/skills/people-corehr-job-change/SKILL.md +212 -0
- package/skills/people-corehr-job-change/references/people-job-change-business-rules.md +113 -0
- package/skills/people-corehr-job-change/references/people-job-change-lookup-filters.md +82 -0
- package/skills/people-corehr-job-change/references/people-job-change-output-and-empty.md +207 -0
- package/skills/people-corehr-job-change/references/people-job-change-search-advanced.md +226 -0
- package/skills/people-corehr-job-change/references/people-job-change-search-fields.md +119 -0
- package/skills/people-corehr-job-change/references/people-job-change-search-option.md +72 -0
- package/skills/people-corehr-job-change/references/people-job-change-search.md +215 -0
- package/skills/people-corehr-offboarding/SKILL.md +188 -0
- package/skills/people-corehr-offboarding/references/people-corehr-offboarding-business-knowledge.md +27 -0
- package/skills/people-corehr-offboarding/references/people-corehr-offboarding-search-option.md +187 -0
- package/skills/people-corehr-offboarding/references/people-corehr-offboarding-search.md +54 -0
- package/skills/people-corehr-organization/SKILL.md +42 -0
- package/skills/people-corehr-organization/references/aggregate.md +11 -0
- package/skills/people-corehr-organization/references/detail.md +39 -0
- package/skills/people-corehr-organization/references/field-values.md +44 -0
- package/skills/people-corehr-organization/references/hierarchy.md +61 -0
- package/skills/people-corehr-organization/references/lookup.md +41 -0
- package/skills/people-corehr-organization/references/metadata.md +40 -0
- package/skills/people-corehr-organization/references/tree.md +45 -0
- package/skills/people-corehr-prehire/SKILL.md +160 -0
- package/skills/people-corehr-prehire/references/command-resolution.md +48 -0
- package/skills/people-corehr-prehire/references/filter-fields.md +151 -0
- package/skills/people-corehr-prehire/references/return-fields.md +153 -0
- package/skills/people-corehr-prehire/references/templates.md +202 -0
- package/skills/people-corehr-prehire/references/troubleshooting.md +93 -0
- package/skills/people-corehr-query-id-by-name/SKILL.md +154 -0
- package/skills/people-corehr-renewal/SKILL.md +186 -0
- package/skills/people-corehr-renewal/references/people-corehr-renewal-fields-query.md +62 -0
- package/skills/people-corehr-renewal/references/people-corehr-renewal-routing.md +54 -0
- package/skills/people-corehr-renewal/references/people-corehr-renewal-search.md +137 -0
- package/skills/people-corehr-renewal/references/people-corehr-renewal.md +39 -0
- package/skills/people-corehr-workforce-plan/SKILL.md +52 -0
- package/skills/people-corehr-workforce-plan/references/people-corehr-workforce-plan-detail-list.md +238 -0
- package/skills/people-corehr-workforce-plan/references/people-corehr-workforce-plan-detail-summary.md +221 -0
- package/skills/people-corehr-workforce-plan/references/people-corehr-workforce-plan.md +79 -0
- package/skills/people-hire/SKILL.md +255 -0
- package/skills/people-hire/references/people-hire-application.md +334 -0
- package/skills/people-hire/references/people-hire-evaluation-task-list.md +233 -0
- package/skills/people-hire/references/people-hire-evaluation.md +127 -0
- package/skills/people-hire/references/people-hire-interview-record.md +109 -0
- package/skills/people-hire/references/people-hire-interview-task-list.md +250 -0
- package/skills/people-hire/references/people-hire-interview.md +146 -0
- package/skills/people-hire/references/people-hire-job-process.md +93 -0
- package/skills/people-hire/references/people-hire-job-requirement.md +227 -0
- package/skills/people-hire/references/people-hire-job.md +277 -0
- package/skills/people-hire/references/people-hire-minutes.md +91 -0
- package/skills/people-hire/references/people-hire-talent.md +105 -0
- package/skills/people-hire/references/people-hire-test.md +197 -0
- package/skills/people-overtime/SKILL.md +992 -0
- package/skills/people-overtime/references/people-attendance-overtime-apply.md +491 -0
- package/skills/people-overtime/references/people-attendance-overtime.md +51 -0
- package/skills/people-overtime/references/people-attendance-submission.md +203 -0
- package/skills/people-overtime/scripts/resolve_date.py +894 -0
- package/skills/people-shared/SKILL.md +94 -0
package/README.zh.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# people-cli
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://go.dev/)
|
|
5
|
+
|
|
6
|
+
[中文版](./README.zh.md) | [English](./README.md)
|
|
7
|
+
|
|
8
|
+
飞书 People 域官方 CLI 工具。`people-cli` 当前覆盖 CoreHR、Attendance、Hire 等 People 域能力,并提供少量配套工作流辅助命令,例如 Drive 文件上传下载。
|
|
9
|
+
|
|
10
|
+
[安装](#安装与快速开始) · [认证](#认证) · [命令](#命令调用体系) · [进阶用法](#进阶用法) · [贡献](#贡献)
|
|
11
|
+
|
|
12
|
+
## 为什么选 people-cli?
|
|
13
|
+
|
|
14
|
+
- **聚焦 People 域** — 一套 CLI 覆盖 CoreHR、Attendance、Hire,以及周边工作流辅助能力
|
|
15
|
+
- **Shortcut 优先,API 完整** — 常见场景优先走高级快捷命令,复杂需求可下钻到服务命令和通用 API
|
|
16
|
+
- **AI 友好** — 结构化输出和稳定命令形态,适合 AI Agent 与自动化集成
|
|
17
|
+
- **上手快** — 引导式配置、按域授权、Schema 自省,缩短从安装到首次成功调用的路径
|
|
18
|
+
- **安全可控** — 输入防注入、终端输出净化、系统原生密钥链存储凭证
|
|
19
|
+
- **开源可扩展** — MIT 协议,适合本地开发、自动化脚本和二次封装
|
|
20
|
+
|
|
21
|
+
## 功能
|
|
22
|
+
|
|
23
|
+
| 类别 | 能力 |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| `corehr` | 部门查询、员工搜索、员工基本信息、任职信息、待入职查询、假期余额/休假记录、编制查询、名称转 ID 快捷命令 |
|
|
26
|
+
| `attendance` | 考勤审批与加班审批记录查询 |
|
|
27
|
+
| `hire` | 招聘职位、投递、面试、评估、人才等招聘数据查询 |
|
|
28
|
+
| 辅助能力 | Drive 文件上传下载等周边工作流辅助命令 |
|
|
29
|
+
|
|
30
|
+
## 安装与快速开始
|
|
31
|
+
|
|
32
|
+
### 环境要求
|
|
33
|
+
|
|
34
|
+
开始之前,请确保具备以下条件:
|
|
35
|
+
|
|
36
|
+
- Go `v1.23`+ 和 Python 3(源码构建需要)
|
|
37
|
+
|
|
38
|
+
### 快速开始
|
|
39
|
+
|
|
40
|
+
#### 安装
|
|
41
|
+
|
|
42
|
+
从源码编译安装:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Clone 仓库
|
|
46
|
+
git clone https://code.byted.org/people/cli.git
|
|
47
|
+
cd cli
|
|
48
|
+
|
|
49
|
+
# 编译并安装
|
|
50
|
+
make install
|
|
51
|
+
|
|
52
|
+
# 验证安装
|
|
53
|
+
people-cli --version
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### 配置与使用
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# 1. 配置应用凭证(仅需一次,交互式引导完成)
|
|
60
|
+
people-cli config init
|
|
61
|
+
|
|
62
|
+
# 2. 按 People 域登录授权
|
|
63
|
+
people-cli auth login --domain corehr --recommend
|
|
64
|
+
|
|
65
|
+
# 3. 开始使用快捷命令
|
|
66
|
+
people-cli corehr +prehire-search --format table
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 认证
|
|
70
|
+
|
|
71
|
+
| 命令 | 说明 |
|
|
72
|
+
| --------------- | -------------------------------------------------- |
|
|
73
|
+
| `auth login` | OAuth 登录,支持交互式选择或命令行参数指定 scope |
|
|
74
|
+
| `auth logout` | 登出并删除已存储的凭证 |
|
|
75
|
+
| `auth status` | 查看当前登录状态和已授权的 scope |
|
|
76
|
+
| `auth check` | 校验指定 scope(exit 0 = 有权限,1 = 缺失) |
|
|
77
|
+
| `auth scopes` | 列出应用的所有可用 scope |
|
|
78
|
+
| `auth list` | 列出所有已认证的用户 |
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 交互式登录
|
|
82
|
+
people-cli auth login
|
|
83
|
+
|
|
84
|
+
# 按 People 域授权
|
|
85
|
+
people-cli auth login --domain corehr --recommend
|
|
86
|
+
people-cli auth login --domain attendance
|
|
87
|
+
people-cli auth login --domain hire
|
|
88
|
+
|
|
89
|
+
# 精确 scope
|
|
90
|
+
people-cli auth login --scope "corehr:department:read"
|
|
91
|
+
|
|
92
|
+
# Agent 模式:立即返回验证 URL,不阻塞
|
|
93
|
+
people-cli auth login --no-wait
|
|
94
|
+
# 稍后恢复轮询
|
|
95
|
+
people-cli auth login --device-code <DEVICE_CODE>
|
|
96
|
+
|
|
97
|
+
# 身份切换:以用户或机器人身份执行命令
|
|
98
|
+
people-cli attendance user_approval_over_time list --as user --params '{"check_date_from":"20260401","check_date_to":"20260430","status":"2"}'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 命令调用体系
|
|
102
|
+
|
|
103
|
+
CLI 提供三种粒度的调用方式,覆盖从快速操作到完全自定义的全部场景:
|
|
104
|
+
|
|
105
|
+
### 1. 快捷命令(Shortcuts)
|
|
106
|
+
|
|
107
|
+
以 `+` 为前缀,对人类与 AI 友好化封装,内置智能默认值、表格输出和 dry-run 预览。
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# 搜索待入职员工
|
|
111
|
+
people-cli corehr +prehire-search --format table
|
|
112
|
+
|
|
113
|
+
# 查询当前员工的假期余额
|
|
114
|
+
people-cli attendance +leave-balances --format pretty
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 2. API 命令
|
|
118
|
+
|
|
119
|
+
从飞书 OAPI 元数据自动生成,经过评测与准入筛选。
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# 获取部门列表
|
|
123
|
+
people-cli corehr department list --params '{"page_size":50}'
|
|
124
|
+
|
|
125
|
+
# 查询加班审批记录
|
|
126
|
+
people-cli attendance user_approval_over_time list --params '{"check_date_from":"20260401","check_date_to":"20260430","status":"2"}'
|
|
127
|
+
|
|
128
|
+
# 查询招聘评估任务
|
|
129
|
+
people-cli hire evaluation_task list --params '{"page_size":10}'
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 3. 通用 API 调用
|
|
133
|
+
|
|
134
|
+
直接调用任意飞书开放平台端点。
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
people-cli api POST /open-apis/corehr/v2/common/query_id_by_name --data '{"business_scene":"team","target_object_api_name":"department","query_name":"研发部"}'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 进阶用法
|
|
141
|
+
|
|
142
|
+
### 输出格式
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
--format json # 完整 JSON 响应(默认)
|
|
146
|
+
--format pretty # 人性化格式输出(适用于部分命令,如 shortcuts / schema)
|
|
147
|
+
--format table # 易读表格
|
|
148
|
+
--format ndjson # 换行分隔 JSON(适合管道处理)
|
|
149
|
+
--format csv # 逗号分隔值
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 分页
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
--page-all # 自动翻页获取所有数据
|
|
156
|
+
--page-limit 5 # 最多获取 5 页
|
|
157
|
+
--page-delay 500 # 每页请求间隔 500ms
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Dry Run
|
|
161
|
+
|
|
162
|
+
对可能产生副作用的命令,建议先用 --dry-run 预览请求:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
people-cli api POST /open-apis/corehr/v2/common/query_id_by_name --data '{"business_scene":"team","target_object_api_name":"department","query_name":"研发部"}' --dry-run
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Schema 自省
|
|
169
|
+
|
|
170
|
+
使用 schema 查看任意 API 方法的参数、请求体、响应结构、支持身份和 scopes:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
people-cli schema
|
|
174
|
+
people-cli schema corehr.job_change.search --format pretty
|
|
175
|
+
people-cli schema attendance.user_approval_over_time.list
|
|
176
|
+
people-cli schema hire.evaluation_task.list
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### 配置管理
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# 初始化配置
|
|
183
|
+
people-cli config init
|
|
184
|
+
|
|
185
|
+
# 查看当前配置
|
|
186
|
+
people-cli config show
|
|
187
|
+
|
|
188
|
+
# 设置默认身份
|
|
189
|
+
people-cli config default-as user
|
|
190
|
+
|
|
191
|
+
# 删除配置
|
|
192
|
+
people-cli config remove
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 健康检查
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# 检查配置、认证和连通性
|
|
199
|
+
people-cli doctor
|
|
200
|
+
|
|
201
|
+
# 离线检查(跳过网络)
|
|
202
|
+
people-cli doctor --offline
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## 安全与风险提示(使用前必读)
|
|
206
|
+
|
|
207
|
+
本工具可供 AI Agent 调用以自动化操作飞书开放平台,存在模型幻觉、执行不可控、提示词注入等固有风险;授权飞书权限后,AI Agent 将以您的用户身份在授权范围内执行操作,可能导致敏感数据泄露、越权操作等高风险后果,请您谨慎操作和使用。
|
|
208
|
+
|
|
209
|
+
为降低上述风险,工具已在多个层面启用默认安全保护,但上述风险仍然存在。我们强烈建议不要主动修改任何默认安全配置;一旦放开相关限制,上述风险将显著提高,由此产生的后果需由您自行承担。
|
|
210
|
+
|
|
211
|
+
我们建议您将对接本工具的飞书机器人作为私人对话助手使用,请勿将其拉入群聊或允许其他用户与其交互,以避免权限被滥用或数据泄露。
|
|
212
|
+
|
|
213
|
+
请您充分知悉全部使用风险,使用本工具即视为您自愿承担相关所有责任。
|
|
214
|
+
|
|
215
|
+
## 贡献
|
|
216
|
+
|
|
217
|
+
欢迎社区贡献!如果你发现 bug 或有功能建议,请提交 [Issue](https://code.byted.org/people/cli/issues) 或 [Merge Request](https://code.byted.org/people/cli/merge_requests)。
|
|
218
|
+
|
|
219
|
+
对于较大的改动,建议先通过 Issue 与我们讨论。
|
|
220
|
+
|
|
221
|
+
## 相关项目
|
|
222
|
+
|
|
223
|
+
- [people-cli-registry](https://code.byted.org/people/people-cli-registry) — API 注册表生成器,为 `people-cli` 提供 People 域 API 元数据和命令生成配置
|
|
224
|
+
|
|
225
|
+
## 许可证
|
|
226
|
+
|
|
227
|
+
本项目基于 **MIT 许可证** 开源。
|
|
228
|
+
该软件运行时会调用飞书开放平台的 API,使用这些 API 需要遵守如下协议和隐私政策:
|
|
229
|
+
|
|
230
|
+
- [飞书用户服务协议](https://www.feishu.cn/terms)
|
|
231
|
+
- [飞书隐私政策](https://www.feishu.cn/privacy)
|
|
232
|
+
- [飞书开放平台独立软件服务商安全管理运营规范](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/management-practice/app-service-provider-security-management-specifications)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lark-people/cli",
|
|
3
|
+
"version": "0.0.0-beta.1",
|
|
4
|
+
"description": "The official CLI for People open platform",
|
|
5
|
+
"bin": {
|
|
6
|
+
"people-cli": "scripts/run.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node scripts/install.js"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@clack/prompts": "^1.2.0"
|
|
13
|
+
},
|
|
14
|
+
"os": [
|
|
15
|
+
"darwin",
|
|
16
|
+
"linux",
|
|
17
|
+
"win32"
|
|
18
|
+
],
|
|
19
|
+
"cpu": [
|
|
20
|
+
"x64",
|
|
21
|
+
"arm64"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=16"
|
|
25
|
+
},
|
|
26
|
+
"author": "People Team",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"registry": "https://registry.npmjs.org",
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"bin/people-cli_*",
|
|
34
|
+
"skills/",
|
|
35
|
+
"!skills/people-skill-maker/",
|
|
36
|
+
"scripts/install.js",
|
|
37
|
+
"scripts/install-wizard.js",
|
|
38
|
+
"scripts/run.js",
|
|
39
|
+
"CHANGELOG.md"
|
|
40
|
+
]
|
|
41
|
+
}
|