@lark-people/cli 0.0.14-beta.1 → 0.0.14-beta.3

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-people/cli",
3
- "version": "0.0.14-beta.1",
3
+ "version": "0.0.14-beta.3",
4
4
  "description": "The official CLI for People open platform",
5
5
  "bin": {
6
6
  "people-cli": "scripts/run.js"
@@ -85,7 +85,7 @@ people-cli auth status --verify
85
85
  只有确认用户身份可用后,才能继续业务命令。判断规则:
86
86
 
87
87
  - 输出 `identity=user`,且没有 token 不存在、过期或 server rejected 等错误:继续。
88
- - 未配置应用:执行 `people-cli config init --new`,把命令输出的配置链接原样发给用户,等待用户完成。
88
+ - 如果未配置应用,使用 `people-cli config init --new` 配置应用,但要尤其注意:`people-cli config init --new`是长阻塞命令,会一直等待用户在浏览器完成配置。所以必须后台运行该命令,启动后立即读取 stdout/stderr 或日志里的配置链接,拿到链接后立刻原样发给用户;禁止前台阻塞等待命令结束,禁止使用 `TaskOutput block=true` 等待完成,禁止用 `| head`/管道截断输出。
89
89
  - 未登录、token 不存在、token 过期或服务端拒绝:先根据业务域执行用户授权。
90
90
 
91
91
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: people-corehr-employee
3
3
  version: 1.0.0
4
- description: "飞书人事 - 员工信息查询:搜索员工、查询当前登录员工基本信息、检查员工应用权限、查询员工可筛选字段、按条件筛选员工。触发词:员工搜索、按姓名找人、查我自己、员工列表、员工权限、部门员工、职级员工、员工字段、employee search、employee filter、employee permission。适用边界:仅处理 employee search、basic info、permission check、fields、filter,不覆盖待入职、异动、离职、任职历史、审批、导出。"
4
+ description: "飞书人事 - 员工信息查询:搜索员工、查询当前登录员工基本信息、查询员工可筛选字段、按条件筛选员工。触发词:员工搜索、按姓名找人、查我自己、员工列表、部门员工、职级员工、员工字段、employee search、employee filter。适用边界:仅处理 employee search、basic info、fields、filter,不覆盖待入职、异动、离职、任职历史、审批、导出。"
5
5
  metadata:
6
6
  requires:
7
7
  bins: ["people-cli"]
@@ -12,13 +12,12 @@ metadata:
12
12
 
13
13
  ## Scope
14
14
 
15
- 只处理以下五类员工查询能力:
15
+ 只处理以下四类员工查询能力:
16
16
 
17
17
  1. `+employee-search`:按姓名、工号、邮箱搜索员工。
18
18
  2. `+employee-basic-info-query`:查询当前登录员工的基本信息。
19
- 3. `+employee-perm-check`:检查当前登录用户的员工应用权限。
20
- 4. `+employee-fields-query`:查询员工字段元数据,确认哪些字段可筛选、可排序、可展示。
21
- 5. `+employee-filter`:按字段条件筛选员工列表。
19
+ 3. `+employee-fields-query`:查询员工字段元数据,确认哪些字段可筛选、可排序、可展示。
20
+ 4. `+employee-filter`:按字段条件筛选员工列表。
22
21
 
23
22
  不处理待入职、入职名单、入职记录、入职流程、异动、离职、任职历史、审批/修改、导出文件、跨模块复杂统计。命中这些边界时,停止使用本 skill,改走对应 skill 或直接说明当前能力不覆盖。
24
23
 
@@ -28,17 +27,11 @@ metadata:
28
27
  2. **最短路径执行**:
29
28
  - 按姓名/工号/邮箱找员工:直接执行 `+employee-search`。
30
29
  - 查我自己、查我的工号、查我的 `employment_id`:直接执行 `+employee-basic-info-query`。
31
- - 查当前账号是否有员工相关应用权限:直接执行 `+employee-perm-check`。
32
30
  - 问哪些字段可筛选/可排序/可展示:直接执行 `+employee-fields-query`,该命令本身就是终点。
33
31
  - 按部门、职级、序列、工作地点、上级、团队等条件查员工:先执行 `+employee-fields-query` 校准字段,再执行 `+employee-filter`。
34
- 3. **权限场景选择**:`+employee-search`、`+employee-filter`、`+employee-fields-query` 会先执行 `+employee-perm-check` 等价的权限检查并选择 `app_key`。
35
- - 同时有 `team` 和 `members` 权限:默认使用 `team`(团队成员),并提示用户同时具备团队成员和花名册权限;如需花名册场景,用户必须显式指定 `--app-key members`。
36
- - 只有 `team` 权限:直接使用 `team`,并告知当前按团队成员场景查询。
37
- - 只有 `members` 权限:直接使用 `members`,并告知当前按花名册场景查询。
38
- - 指定 `--app-key` 但无该场景权限:停止查询并返回无权限错误。
39
- 4. **字段校准**:凡是要构造 `+employee-filter` 的 `--filters`、`--sort-fields`、`--display-fields`,字段名都必须来自本轮真实 `+employee-fields-query` 返回的 `api_name`,禁止猜字段、禁止省略命名空间前缀。
40
- 5. **真实执行**:条件一旦可落地,必须执行对应的最终命令。不要停在字段解释、命令草稿或搜索预演。
41
- 6. **完成态校验并回答**:答案必须来自最后一次真实命令返回。若结果分页,必须明确说明当前页数量和是否还有下一页;不要静默截断。
32
+ 3. **字段校准**:凡是要构造 `+employee-filter` 的 `--filters`、`--sort-fields`、`--display-fields`,字段名都必须来自本轮真实 `+employee-fields-query` 返回的 `api_name`,禁止猜字段、禁止省略命名空间前缀。
33
+ 4. **真实执行**:条件一旦可落地,必须执行对应的最终命令。不要停在字段解释、命令草稿或搜索预演。
34
+ 5. **完成态校验并回答**:答案必须来自最后一次真实命令返回。若结果分页,必须明确说明当前页数量和是否还有下一页;不要静默截断。
42
35
 
43
36
  ## Route Templates
44
37
 
@@ -46,7 +39,6 @@ metadata:
46
39
  | --- | --- |
47
40
  | 按姓名、工号、邮箱找员工 | 直接 `+employee-search` |
48
41
  | 查我自己当前账号对应的员工信息 | 直接 `+employee-basic-info-query` |
49
- | 查当前账号员工应用权限 | 直接 `+employee-perm-check` |
50
42
  | 问哪些字段能筛选/排序/展示 | 直接 `+employee-fields-query` |
51
43
  | 查某部门、某职级、某序列、某地点的员工 | `+employee-fields-query` → `+employee-filter` |
52
44
  | 查我的团队 / 我的下级 | `+employee-basic-info-query` 取自己的 `employment_id` → `+employee-filter` |
@@ -56,8 +48,6 @@ metadata:
56
48
  ## Hard Rules
57
49
 
58
50
  - 禁止用本 skill 处理待入职、异动、离职、任职历史、审批、导出文件;这些都不属于 employee 能力边界。
59
- - `+employee-search`、`+employee-filter`、`+employee-fields-query` 不要绕过权限检查直接假定 `app_key=team`;运行时必须以权限检查结果或用户显式 `--app-key` 为准。
60
- - 当用户说“团队成员”时使用 `--app-key team`;当用户说“花名册”时使用 `--app-key members`。用户未指定且双权限都存在时默认不追问,使用 `team` 并提示可显式指定花名册。
61
51
  - 对 `+employee-filter` 而言,所有 `field_api_name` 都必须来自 `+employee-fields-query` 返回结果,且必须使用完整字段名,例如 `employment.department`,禁止写成 `department`、`job_level`、`workforce_type` 这类省略前缀的形式。
62
52
  - 若用户要求的筛选字段不存在,或 `filterable=false`,必须停止并明确告知该字段不支持筛选;不要尝试其他接口、相邻字段、组合字段或本地兜底。
63
53
  - 若用户要求排序字段不存在,或 `sortable=false`,必须停止并重新按 `+employee-fields-query` 返回值校准;不要凭经验继续执行。
@@ -81,14 +71,12 @@ metadata:
81
71
 
82
72
  - `+employee-search`:按 `姓名`、`工号`、`employment_id` 的顺序输出候选结果。
83
73
  - `+employee-basic-info-query`:输出 `常用姓名`、`工号`、`employment_id`、`邮箱`。
84
- - `+employee-perm-check`:输出 `app_key`、`has_permission`。
85
74
  - `+employee-fields-query`:保留字段元数据的核心列,至少包含 `name`、`api_name`、`type`、`filterable`、`sortable`、`displayable`、`operators`。
86
75
  - `+employee-filter`:
87
76
  - 默认只展示姓名和工号。
88
77
  - 用户显式要求的展示字段,按用户诉求追加。
89
78
  - 若接口返回 `Count`、`Has more`、`Next page` 等分页信息,答复中必须体现当前已返回多少条,以及是否还能继续查看下一页。
90
79
  - 若命令报错、字段不支持、名称解析失败或结果不具备唯一性,必须清楚说明失败类型,禁止编造人数或员工名单。
91
- - 对 `+employee-search`、`+employee-filter`、`+employee-fields-query` 的回答必须包含当前实际使用的查询场景:团队成员或花名册;双权限默认 `team` 时还要说明如需花名册需显式指定。
92
80
 
93
81
  ## Command Patterns
94
82
 
@@ -96,21 +84,12 @@ metadata:
96
84
  # 按姓名、工号、邮箱搜索员工
97
85
  people-cli corehr +employee-search --keyword <关键词>
98
86
 
99
- # 明确使用花名册场景搜索员工
100
- people-cli corehr +employee-search --keyword <关键词> --app-key members
101
-
102
87
  # 查询当前登录员工基本信息
103
88
  people-cli corehr +employee-basic-info-query --format json
104
89
 
105
- # 检查当前账号员工应用权限
106
- people-cli corehr +employee-perm-check --format table
107
-
108
90
  # 查询员工字段元数据
109
91
  people-cli corehr +employee-fields-query --format table
110
92
 
111
- # 查询花名册场景的员工字段元数据
112
- people-cli corehr +employee-fields-query --app-key members --format table
113
-
114
93
  # 默认场景:只返回姓名 + 工号
115
94
  people-cli corehr +employee-filter \
116
95
  --filters '[{"field_api_name":"employment.department","operator":"in","value_names":["技术部"],"is_strand_id_in":true}]' \
@@ -122,19 +101,11 @@ people-cli corehr +employee-filter \
122
101
  --filters '[{"field_api_name":"employment.department","operator":"in","value_names":["技术部"],"is_strand_id_in":true}]' \
123
102
  --display-fields '["employment.person.preferred_name","employment.employee_number","employment.department","employment.job_level"]' \
124
103
  --format table
125
-
126
- # 明确使用花名册场景筛选
127
- people-cli corehr +employee-filter \
128
- --app-key members \
129
- --filters '[{"field_api_name":"employment.department","operator":"in","value_names":["技术部"],"is_strand_id_in":true}]' \
130
- --display-fields '["employment.person.preferred_name","employment.employee_number"]' \
131
- --format table
132
104
  ```
133
105
 
134
106
  ## Minimal References
135
107
 
136
108
  - [people-corehr-employee-search.md](references/people-corehr-employee-search.md):员工搜索的输入识别、输出字段顺序与基本示例。
137
109
  - [people-corehr-employee-basic-info-query.md](references/people-corehr-employee-basic-info-query.md):当前登录员工基本信息查询与常见联动场景。
138
- - [people-corehr-employee-perm-check.md](references/people-corehr-employee-perm-check.md):当前登录用户员工应用权限检查。
139
110
  - [people-corehr-employee-fields-list.md](references/people-corehr-employee-fields-list.md):字段元数据、字段类型、可用操作符与筛选/排序/展示能力判断。
140
111
  - [people-corehr-employee-filter.md](references/people-corehr-employee-filter.md):员工筛选、默认展示字段铁律、`value_names` 解析与分页约束。
@@ -10,10 +10,9 @@ people-cli corehr +employee-fields-query [flags]
10
10
 
11
11
  ## 参数
12
12
 
13
- | Flag | 类型 | 必填 | 默认值 | 说明 |
14
- |------|------|------|--------|-------------------------------------------------------|
15
- | `--app-key` | string | 否 | 自动选择 | 查询场景:`team`(团队成员)或 `members`(花名册);不传时先鉴权,双权限默认 `team` |
16
- | `--accept-language` | string | 否 | `zh-CN` | 响应语言:`zh-CN`(中文)、`en-US`(英文) |
13
+ | Flag | 类型 | 必填 | 默认值 | 说明 |
14
+ |------|------|------|--------|------|
15
+ | `--accept-language` | string | 否 | `zh-CN` | 响应语言:`zh-CN`(中文)、`en-US`(英文) |
17
16
 
18
17
  ### accept-language 选择策略
19
18
 
@@ -116,7 +116,6 @@ people-cli corehr +employee-filter --help
116
116
  | `--display-fields` | string (JSON) | 否 | - | 展示字段,JSON 数组格式 |
117
117
  | `--limit` | int | 否 | `30` | 返回结果数量上限(最大 100) |
118
118
  | `--search_after` | string | 否 | - | 分页游标,用于分页(首次请求为空,后续请求使用上次返回的 search_after 值,返回结果数量上限(最大 100) |
119
- | `--app-key` | string | 否 | 自动选择 | 查询场景:`team`(团队成员)或 `members`(花名册);不传时先鉴权,双权限默认 `team` |
120
119
  | `--accept-language` | string | 否 | `zh-CN` | 响应语言:`zh-CN`(中文)、`en-US`(英文) |
121
120
 
122
121
  ### accept-language 选择策略
@@ -10,11 +10,10 @@ people-cli corehr +employee-search --keyword <关键词> [flags]
10
10
 
11
11
  ## 参数
12
12
 
13
- | Flag | 类型 | 必填 | 默认值 | 说明 |
14
- | ------------------- | ------ | -- | ------- |-------------------------------------------------------|
15
- | `--keyword` | string | 是 | - | 搜索关键词(员工姓名、工号或邮箱) |
16
- | `--app-key` | string | 否 | 自动选择 | 查询场景:`team`(团队成员)或 `members`(花名册);不传时先鉴权,双权限默认 `team` |
17
- | `--accept-language` | string | 否 | `zh-CN` | 响应语言:`zh-CN`(中文)、`en-US`(英文) |
13
+ | Flag | 类型 | 必填 | 默认值 | 说明 |
14
+ | ------------------- | ------ | -- | ------- | ---------------------------- |
15
+ | `--keyword` | string | 是 | - | 搜索关键词(员工姓名、工号或邮箱) |
16
+ | `--accept-language` | string | 否 | `zh-CN` | 响应语言:`zh-CN`(中文)、`en-US`(英文) |
18
17
 
19
18
  ### accept-language 选择策略
20
19
 
@@ -62,9 +61,6 @@ people-cli corehr +employee-search --keyword user
62
61
 
63
62
  # 英文输出
64
63
  people-cli corehr +employee-search --keyword 李 --accept-language en-US
65
-
66
- # 明确按花名册场景搜索
67
- people-cli corehr +employee-search --keyword 李 --app-key members
68
64
  ```
69
65
  ### 查看帮助
70
66
 
@@ -1,71 +0,0 @@
1
- # +employee-perm-check
2
-
3
- 检查当前登录用户的 CoreHR 员工应用权限。
4
-
5
- ## 用法
6
-
7
- ```bash
8
- people-cli corehr +employee-perm-check [flags]
9
- ```
10
-
11
- ## 参数
12
-
13
- 无业务参数。支持通用 `--format` 输出控制。
14
-
15
- ## 所需权限
16
-
17
- | Scope |
18
- |-------|
19
- | `corehr:employment_info_filter:read` |
20
-
21
- ## 输出
22
-
23
- | 字段 | 说明 |
24
- |------|------|
25
- | `app_key` | 应用标识 |
26
- | `has_permission` | 当前登录用户是否有该应用权限 |
27
-
28
- ## 场景语义
29
-
30
- | app_key | 场景 |
31
- |---------|------|
32
- | `team` | 团队成员 |
33
- | `members` | 花名册 |
34
-
35
- `+employee-search`、`+employee-filter`、`+employee-fields-query` 在执行前会先做同等权限检查:
36
-
37
- - 同时有 `team` 和 `members` 权限:默认使用 `team`,并提示用户如需花名册场景请显式传 `--app-key members`。
38
- - 只有 `team` 权限:使用团队场景。
39
- - 只有 `members` 权限:使用花名册场景。
40
- - 用户显式传入无权限的 `--app-key` 时停止查询。
41
-
42
- ## 输出示例
43
-
44
- ```json
45
- {
46
- "ok": true,
47
- "data": [
48
- {
49
- "app_key": "team",
50
- "has_permission": true
51
- },
52
- {
53
- "app_key": "members",
54
- "has_permission": false
55
- }
56
- ],
57
- "meta": {
58
- "count": 2
59
- }
60
- }
61
- ```
62
-
63
- ## 示例
64
-
65
- ```bash
66
- # 表格格式输出
67
- people-cli corehr +employee-perm-check --format table
68
-
69
- # JSON 格式输出
70
- people-cli corehr +employee-perm-check --format json
71
- ```