@lark-people/cli 0.0.14 → 0.0.15

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