@lark-project/meegle 0.0.13 → 0.0.14

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/LICENSE CHANGED
@@ -1,11 +1,21 @@
1
- Copyright (c) 2023 Lark Technologies Pte. Ltd.
1
+ MIT License
2
2
 
3
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
3
+ Copyright (c) 2026 Lark Technologies Pte. Ltd.
4
4
 
5
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
6
- IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
7
- INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
8
- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
9
- CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
10
- DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
11
- ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
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.
package/README.md CHANGED
@@ -1,393 +1,438 @@
1
1
  # Meegle CLI
2
2
 
3
- > **DEV** — 当前处于开发预览阶段,API 和命令可能发生变更。
3
+ > **DEV** — Currently in developer preview. APIs and commands may change.
4
4
 
5
- 飞书项目(Meegle)命令行工具。在终端中管理工作项、查看排期、搜索数据,无需打开浏览器。
5
+ Command-line tool for [Meegle](https://meegle.com?utm_source=github&utm_medium=readme&utm_campaign=meegle_cli) ([Lark Project](https://project.feishu.cn?utm_source=github&utm_medium=readme&utm_campaign=meegle_cli)). Manage work items, schedules, and data from your terminal — no browser needed.
6
6
 
7
- ## 安装
7
+ [中文文档](README.zh-CN.md)
8
+
9
+ ## Installation
8
10
 
9
11
  ```bash
10
12
  npm install -g @lark-project/meegle
11
13
  ```
12
14
 
13
- 要求 Node.js >= 18。
15
+ Requires Node.js >= 16.
14
16
 
15
- ## 快速开始
17
+ ## Quick Start
16
18
 
17
19
  ```bash
18
- # 1. 登录
20
+ # 1. Log in
19
21
  meegle auth login
20
22
 
21
- # 2. 查看本周待办
23
+ # 2. View this week's to-dos
22
24
  meegle mywork todo --action this_week --page-num 1
23
25
 
24
- # 3. 查看帮助
26
+ # 3. View help
25
27
  meegle --help
26
28
  meegle workitem --help
27
29
 
28
- # 4. 查看命令参数详情
30
+ # 4. Inspect command parameters
29
31
  meegle inspect workitem.create
30
32
  ```
31
33
 
32
- ## 命令一览
34
+ ## Commands
35
+
36
+ ### workitem — Work Items
37
+
38
+ | Command | Description |
39
+ |---------|-------------|
40
+ | `workitem create` | Create a work item |
41
+ | `workitem get` | View work item details |
42
+ | `workitem update` | Update work item fields |
43
+ | `workitem query` | Search work items using MQL |
44
+ | `workitem list-op-records` | View operation records |
45
+ | `workitem meta-types` | List work item types |
46
+ | `workitem meta-create-fields` | List fields available at creation |
47
+ | `workitem meta-fields` | List field configurations |
48
+ | `workitem meta-roles` | List role configurations |
49
+
50
+ ### workflow — Workflow
51
+
52
+ | Command | Description |
53
+ |---------|-------------|
54
+ | `workflow transition` | Transition or rollback a node |
55
+ | `workflow transition-state` | Transition a state-flow state |
56
+ | `workflow get-node` | View node details |
57
+ | `workflow update-node` | Update a node |
58
+ | `workflow meta-node-fields` | List node field configurations |
59
+ | `workflow list-state-transitions` | List available state transitions |
60
+ | `workflow list-state-required` | List required fields for transitions |
33
61
 
34
- ### workitem工作项域
62
+ ### subtaskSubtasks
35
63
 
36
- | 命令 | 说明 |
37
- |------|------|
38
- | `workitem create` | 创建工作项 |
39
- | `workitem get` | 查看工作项概况 |
40
- | `workitem update` | 修改工作项字段 |
41
- | `workitem query` | 使用 MQL 搜索工作项 |
42
- | `workitem list-op-records` | 查看操作记录 |
43
- | `workitem meta-types` | 查看工作项类型列表 |
44
- | `workitem meta-create-fields` | 查看创建时可用字段 |
45
- | `workitem meta-fields` | 查看字段配置 |
46
- | `workitem meta-roles` | 查看角色配置 |
64
+ | Command | Description |
65
+ |---------|-------------|
66
+ | `subtask update` | Create / update / complete / rollback subtasks |
47
67
 
48
- ### workflow工作流域
68
+ ### commentComments
49
69
 
50
- | 命令 | 说明 |
51
- |------|------|
52
- | `workflow transition` | 流转或回滚节点 |
53
- | `workflow get-node` | 查看节点详情 |
54
- | `workflow update-node` | 修改节点 |
55
- | `workflow meta-node-fields` | 查看节点字段配置 |
56
- | `workflow list-state-transitions` | 查看可流转状态 |
57
- | `workflow list-state-required` | 查看流转必填信息 |
70
+ | Command | Description |
71
+ |---------|-------------|
72
+ | `comment add` | Add a comment |
73
+ | `comment list` | List comments |
58
74
 
59
- ### subtask子任务
75
+ ### workhourWork Hours
60
76
 
61
- | 命令 | 说明 |
62
- |------|------|
63
- | `subtask update` | 创建/修改/完成/回滚子任务 |
77
+ | Command | Description |
78
+ |---------|-------------|
79
+ | `workhour list-records` | List work hour records |
80
+ | `workhour list-schedule` | View team member schedules |
64
81
 
65
- ### comment评论域
82
+ ### relationRelations
66
83
 
67
- | 命令 | 说明 |
68
- |------|------|
69
- | `comment add` | 添加评论 |
70
- | `comment list` | 查看评论列表 |
84
+ | Command | Description |
85
+ |---------|-------------|
86
+ | `relation list` | List related work items |
87
+ | `relation meta-definitions` | List relation type definitions |
71
88
 
72
- ### workhour工时域
89
+ ### myworkMy Work
73
90
 
74
- | 命令 | 说明 |
75
- |------|------|
76
- | `workhour list-records` | 查看工时登记记录 |
77
- | `workhour list-schedule` | 查看人员排期 |
91
+ | Command | Description |
92
+ |---------|-------------|
93
+ | `mywork todo` | View my to-dos / completed items |
78
94
 
79
- ### relation关系域
95
+ ### viewViews
80
96
 
81
- | 命令 | 说明 |
82
- |------|------|
83
- | `relation list` | 查看关联的工作项 |
84
- | `relation meta-definitions` | 查看关联关系定义 |
97
+ | Command | Description |
98
+ |---------|-------------|
99
+ | `view create-fixed` | Create a fixed view |
100
+ | `view get` | View details of a view |
101
+ | `view update-fixed` | Update a fixed view |
102
+ | `view search` | Search views by name |
85
103
 
86
- ### mywork工作台域
104
+ ### chartCharts
87
105
 
88
- | 命令 | 说明 |
89
- |------|------|
90
- | `mywork todo` | 查看我的待办/已办 |
106
+ | Command | Description |
107
+ |---------|-------------|
108
+ | `chart get` | View chart details |
109
+ | `chart list` | List charts under a view |
91
110
 
92
- ### view视图域
111
+ ### team / user People
93
112
 
94
- | 命令 | 说明 |
95
- |------|------|
96
- | `view create-fixed` | 创建固定视图 |
97
- | `view get` | 查看视图详情 |
98
- | `view update-fixed` | 更新固定视图 |
99
- | `view search` | 按名称搜索视图 |
113
+ | Command | Description |
114
+ |---------|-------------|
115
+ | `team list` | List teams in a project |
116
+ | `team list-members` | List team members |
117
+ | `user me` | View current logged-in user information |
118
+ | `user search` | Search user information |
100
119
 
101
- ### chart度量域
120
+ ### projectProjects
102
121
 
103
- | 命令 | 说明 |
104
- |------|------|
105
- | `chart get` | 查看图表详情 |
106
- | `chart list` | 查看视图下的图表列表 |
122
+ | Command | Description |
123
+ |---------|-------------|
124
+ | `project search` | Search projects |
107
125
 
108
- ### team / user 人员域
126
+ ### authAuthentication
109
127
 
110
- | 命令 | 说明 |
111
- |------|------|
112
- | `team list` | 查看空间下的团队列表 |
113
- | `team list-members` | 查看团队成员 |
114
- | `user search` | 搜索用户信息 |
128
+ | Command | Description |
129
+ |---------|-------------|
130
+ | `auth login` | Log in (browser or `--device-code`) |
131
+ | `auth logout` | Log out |
132
+ | `auth status` | View login status |
115
133
 
116
- ### project空间域
134
+ ### configConfiguration
117
135
 
118
- | 命令 | 说明 |
119
- |------|------|
120
- | `project search` | 搜索空间信息 |
136
+ | Command | Description |
137
+ |---------|-------------|
138
+ | `config init` | Initialize configuration |
139
+ | `config show` | Show current configuration |
140
+ | `config set` | Set a configuration value |
141
+ | `config get` | Get a configuration value |
142
+ | `config profile create\|list\|use\|current\|delete` | Manage configuration profiles |
121
143
 
122
- ### 其他命令
144
+ ### Other Commands
123
145
 
124
- | 命令 | 说明 |
125
- |------|------|
126
- | `inspect [command]` | 查看命令参数详情 |
146
+ | Command | Description |
147
+ |---------|-------------|
148
+ | `inspect [command]` | Inspect command parameters |
149
+ | `completion bash\|zsh\|fish` | Generate shell completion script |
150
+ | `completion install` | Auto-install shell completion |
127
151
 
128
- ## 常用示例
152
+ ## Common Examples
129
153
 
130
- ### 查看待办
154
+ ### To-dos
131
155
 
132
156
  ```bash
133
- # 本周待办
157
+ # This week's to-dos
134
158
  meegle mywork todo --action this_week --page-num 1
135
159
 
136
- # 已办事项
160
+ # Completed items
137
161
  meegle mywork todo --action done --page-num 1
138
162
 
139
- # 逾期事项
163
+ # Overdue items
140
164
  meegle mywork todo --action overdue --page-num 1
141
165
  ```
142
166
 
143
- ### 查询工作项
167
+ ### Querying Work Items
144
168
 
145
169
  ```bash
146
- # 查看工作项概况
170
+ # View work item details
147
171
  meegle workitem get --work-item-id 12345
148
172
 
149
- # 查看工作项的节点详情
173
+ # View workflow node details
150
174
  meegle workflow get-node --work-item-id 12345 --need-sub-task
151
175
  ```
152
176
 
153
- ### 创建工作项
177
+ ### Creating Work Items
154
178
 
155
179
  ```bash
156
- # 使用 --set 设置字段
180
+ # Use --set to set fields
157
181
  meegle workitem create --project-key PROJ --work-item-type story \
158
- --set name=优化登录流程 \
182
+ --set name="Optimize login flow" \
159
183
  --set priority=P1
160
184
 
161
- # 复杂字段传 JSON
185
+ # Pass JSON values for complex fields
162
186
  meegle workitem create --project-key PROJ --work-item-type story \
163
- --set name=排期任务 \
187
+ --set name="Scheduled task" \
164
188
  --set schedule='[1722182400000,1722355199999]'
165
189
  ```
166
190
 
167
- ### 修改字段
191
+ ### Updating Fields
168
192
 
169
193
  ```bash
170
- # 修改工作项名称
194
+ # Update work item name
171
195
  meegle workitem update --work-item-id 12345 \
172
- --set name=新标题
196
+ --set name="New title"
173
197
 
174
- # 同时修改多个字段
198
+ # Update multiple fields at once
175
199
  meegle workitem update --work-item-id 12345 \
176
- --set name=新标题 \
200
+ --set name="New title" \
177
201
  --set priority=P0
178
202
  ```
179
203
 
180
- ### MQL 搜索
204
+ ### MQL Search
181
205
 
182
206
  ```bash
183
- # 查询空间下的 P0 需求
207
+ # Query P0 stories in a project
184
208
  meegle workitem query --project-key PROJ \
185
- --mql "SELECT \`name\`, \`priority\` FROM \`空间名\`.\`需求\` WHERE \`priority\` = 'P0'"
209
+ --mql "SELECT \`name\`, \`priority\` FROM \`ProjectName\`.\`Story\` WHERE \`priority\` = 'P0'"
186
210
  ```
187
211
 
188
- ### 查看排期
212
+ ### Viewing Schedules
189
213
 
190
214
  ```bash
191
- # 查看团队成员排期
215
+ # View team member schedules
192
216
  meegle workhour list-schedule --project-key PROJ \
193
217
  --start-time 2026-03-01 --end-time 2026-03-31 \
194
- --user-keys "张三,李四,王五"
218
+ --user-keys "Alice,Bob,Charlie"
195
219
  ```
196
220
 
197
- ### 查看用户信息
221
+ ### Searching Users
198
222
 
199
223
  ```bash
200
- meegle user search --user-keys "张三,李四" --project-key PROJ
224
+ meegle user search --user-keys "Alice,Bob" --project-key PROJ
201
225
  ```
202
226
 
203
- ## 参数传递
227
+ ## Parameter Passing
204
228
 
205
- ### 基本 flag
229
+ ### Basic Flags
206
230
 
207
- 每个命令的参数通过 `--flag-name` 传递:
231
+ Each command takes parameters via `--flag-name`:
208
232
 
209
233
  ```bash
210
234
  meegle workitem get --work-item-id 12345 --project-key PROJ
211
235
  ```
212
236
 
213
- ### --set key=value(写入命令)
237
+ ### --set key=value (Write Commands)
214
238
 
215
- `workitem create`、`workitem update`、`workflow update-node`、`subtask update` 支持 `--set` 简便设置字段:
239
+ `workitem create`, `workitem update`, `workflow update-node`, and `subtask update` support `--set` for convenient field assignment:
216
240
 
217
241
  ```bash
218
- --set name=标题 # 字符串
219
- --set points=5 # 数字
220
- --set is_urgent=true # 布尔
221
- --set schedule='[1,2]' # JSON 数组
222
- --set role='{"role":"RD"}' # JSON 对象
242
+ --set name="Title" # String
243
+ --set points=5 # Number
244
+ --set is_urgent=true # Boolean
245
+ --set schedule='[1,2]' # JSON array
246
+ --set role='{"role":"RD"}' # JSON object
223
247
  ```
224
248
 
225
- `--set` 可重复使用,一次设置多个字段。
249
+ `--set` can be repeated to set multiple fields at once.
226
250
 
227
- ### --params JSON(兜底)
251
+ ### --params JSON (Fallback)
228
252
 
229
- 所有命令都支持 `--params` 传入完整 JSON 参数:
253
+ All commands support `--params` to pass a full JSON parameter body:
230
254
 
231
255
  ```bash
232
256
  meegle workitem create --project-key PROJ --work-item-type story \
233
- --params '{"fields":[{"field_key":"name","field_value":"标题"}]}'
257
+ --params '{"fields":[{"field_key":"name","field_value":"Title"}]}'
234
258
  ```
235
259
 
236
- ### 优先级
260
+ ### Priority
237
261
 
238
- `--set`、`--params` 和普通 flag 同时使用时:
262
+ When `--set`, `--params`, and regular flags are used together:
239
263
 
240
- 1. `--set` 覆盖 `--params` 中同名字段
241
- 2. 普通 flag(如 `--project-key`)覆盖 `--params` 中同名顶层 key
264
+ 1. `--set` overrides fields with the same name in `--params`
265
+ 2. Regular flags (e.g. `--project-key`) override top-level keys in `--params`
242
266
 
243
- ### 数组参数
267
+ ### Array Parameters
244
268
 
245
- 多个值用逗号分隔:
269
+ Separate multiple values with commas:
246
270
 
247
271
  ```bash
248
- --user-keys "张三,李四,王五"
272
+ --user-keys "Alice,Bob,Charlie"
249
273
  --field-keys "name,status,priority"
250
274
  ```
251
275
 
252
- ### 布尔参数
276
+ ### Boolean Parameters
253
277
 
254
- 直接加 flag 即为 true,不加即为 false
278
+ Add the flag to set `true`; omit it for `false`:
255
279
 
256
280
  ```bash
257
281
  meegle workflow get-node --work-item-id 12345 --need-sub-task
258
282
  ```
259
283
 
260
- ## 输出格式
284
+ ## Global Flags
285
+
286
+ | Flag | Short | Description |
287
+ |------|-------|-------------|
288
+ | `--format` | `-o` | Output format: `json` (default), `table`, `ndjson`, `yaml`, `markdown`, `raw` |
289
+ | `--select` | | Field projection with dot paths |
290
+ | `--set` | | Set nested parameters (repeatable) |
291
+ | `--params` | `-P` | Full JSON parameter body |
292
+ | `--dry-run` | | Render request without executing |
293
+ | `--verbose` | `-v` | Verbose output |
294
+ | `--profile` | | Use a specific configuration profile |
295
+
296
+ ## Output Formats
261
297
 
262
298
  ```bash
263
- # JSON(默认)
299
+ # JSON (default)
264
300
  meegle workitem get --work-item-id 12345
265
301
 
266
- # 选取输出属性(支持 dot path)
302
+ # Select output properties (supports dot paths)
267
303
  meegle workitem get --work-item-id 12345 --select "id,name,status"
268
304
  meegle mywork todo --action done --page-num 1 --select "list.work_item_info.work_item_name"
269
305
 
270
- # NDJSON(适合管道处理)
271
- meegle mywork todo --action this_week --page-num 1 --format ndjson
306
+ # NDJSON (suitable for piping)
307
+ meegle mywork todo --action this_week --page-num 1 -o ndjson
308
+
309
+ # Table
310
+ meegle mywork todo --action this_week --page-num 1 -o table
311
+
312
+ # YAML
313
+ meegle workitem get --work-item-id 12345 -o yaml
314
+
315
+ # Markdown table
316
+ meegle mywork todo --action this_week --page-num 1 -o markdown
272
317
 
273
- # 表格
274
- meegle mywork todo --action this_week --page-num 1 --format table
318
+ # Dry run (preview request without sending)
319
+ meegle workitem create --project-key PROJ --work-item-type story --set name="Test" --dry-run
275
320
  ```
276
321
 
277
- ### --select dot path
322
+ ### --select Dot Paths
278
323
 
279
- `--select` 支持用 `.` 访问嵌套属性,遇到数组时自动穿透:
324
+ `--select` supports `.` notation for nested properties, automatically traversing arrays:
280
325
 
281
326
  ```bash
282
- # 从嵌套结构中提取字段
327
+ # Extract fields from nested structures
283
328
  --select "list.work_item_info.work_item_name,list.state_info.end_state_key_name"
284
329
 
285
- # 混合顶层和嵌套
330
+ # Mix top-level and nested
286
331
  --select "total,list.work_item_info.work_item_name"
287
332
  ```
288
333
 
289
- ## 命令内省
334
+ ## Command Introspection
290
335
 
291
- 使用 `inspect` 查看命令的完整参数信息:
336
+ Use `inspect` to view full parameter information for a command:
292
337
 
293
338
  ```bash
294
- # 列出所有命令
339
+ # List all commands
295
340
  meegle inspect
296
341
 
297
- # 查看特定命令的参数详情
342
+ # View parameters for a specific command
298
343
  meegle inspect workitem.create
299
344
  ```
300
345
 
301
- ## 认证
346
+ ## Authentication
302
347
 
303
- ### 浏览器登录(默认)
348
+ ### Browser Login (Default)
304
349
 
305
350
  ```bash
306
351
  meegle auth login
307
352
  ```
308
353
 
309
- 自动打开浏览器完成 OAuth 授权。如果浏览器未打开,终端会显示授权地址,手动复制即可。
354
+ Automatically opens the browser for OAuth authorization. If the browser doesn't open, the terminal displays the authorization URL for manual copying.
310
355
 
311
- ### Device Code 登录(无浏览器环境)
356
+ ### Device Code Login (No Browser)
312
357
 
313
358
  ```bash
314
359
  meegle auth login --device-code
315
360
  ```
316
361
 
317
- 终端显示二维码和授权码,使用手机扫码授权。适用于 SSH 远程服务器等无浏览器环境。
362
+ The terminal displays a QR code and authorization code. Scan with your phone to authorize. Ideal for SSH remote servers and other headless environments.
318
363
 
319
- ### 其他认证命令
364
+ ### Other Auth Commands
320
365
 
321
366
  ```bash
322
- # 查看登录状态
367
+ # Check login status
323
368
  meegle auth status
324
369
 
325
- # 登出
370
+ # Log out
326
371
  meegle auth logout
327
372
  ```
328
373
 
329
- ## 配置
374
+ ## Configuration
330
375
 
331
- ### 配置文件
376
+ ### Config File
332
377
 
333
- 配置存储在 `~/.meegle/config.json`:
378
+ Configuration is stored in `~/.meegle/config.json`:
334
379
 
335
380
  ```bash
336
- # 初始化配置
381
+ # Initialize config
337
382
  meegle config init
338
383
 
339
- # 查看当前配置
384
+ # View current config
340
385
  meegle config show
341
386
 
342
- # 修改单个配置项
387
+ # Set a config value
343
388
  meegle config set host project.feishu.cn
344
389
 
345
- # 查看单个配置项
390
+ # Get a config value
346
391
  meegle config get host
347
392
  ```
348
393
 
349
- 主要配置项:
394
+ Main config options:
350
395
 
351
- | 字段 | 说明 | 示例 |
352
- |------|------|------|
353
- | `host` | 站点域名 | `project.feishu.cn`、`meegle.com` |
396
+ | Field | Description | Examples |
397
+ |-------|-------------|----------|
398
+ | `host` | Site domain | `project.feishu.cn`, `meegle.com` |
354
399
 
355
- ### 多环境 Profile
400
+ ### Multi-Environment Profiles
356
401
 
357
- 支持管理多个环境配置(不同站点、不同账号),每个 profile 独立存储 host 和认证信息。
402
+ Manage multiple environment configurations (different sites, different accounts). Each profile stores its own host and auth credentials independently.
358
403
 
359
404
  ```bash
360
- # 创建新环境(交互式引导 host 选择 + 登录)
405
+ # Create a new profile (interactive host selection + login)
361
406
  meegle config profile create staging
362
407
 
363
- # 查看所有环境
408
+ # List all profiles
364
409
  meegle config profile list
365
410
 
366
- # 切换默认环境
411
+ # Switch default profile
367
412
  meegle config profile use staging
368
413
 
369
- # 查看当前环境
414
+ # View current profile
370
415
  meegle config profile current
371
416
 
372
- # 临时使用其他环境(不改变默认)
417
+ # Temporarily use another profile (without changing default)
373
418
  meegle mywork todo --action this_week --page-num 1 --profile staging
374
419
 
375
- # 删除环境
420
+ # Delete a profile
376
421
  meegle config profile delete staging
377
422
  ```
378
423
 
379
- ## 常见问题
424
+ ## FAQ
380
425
 
381
- ### 命令列表为空
426
+ ### Empty Command List
382
427
 
383
- CLI 启动时会从服务端获取可用命令列表。如果网络不通或未登录,动态命令不会注册。请先确保已登录:
428
+ The CLI fetches available commands from the server at startup. If the network is unreachable or you're not logged in, dynamic commands won't be registered. Make sure you're logged in first:
384
429
 
385
430
  ```bash
386
431
  meegle auth login
387
432
  ```
388
433
 
389
- 命令列表会自动缓存,过期后在后台静默刷新,不影响使用。
434
+ The command list is cached automatically and refreshed silently in the background when expired.
390
435
 
391
436
  ## License
392
437
 
393
- [ISC](LICENSE) © Lark Technologies Pte. Ltd.
438
+ [MIT](LICENSE) © Lark Technologies Pte. Ltd.
@@ -0,0 +1,438 @@
1
+ # Meegle CLI
2
+
3
+ > **DEV** — 当前处于开发预览阶段,API 和命令可能发生变更。
4
+
5
+ 飞书项目([Meegle](https://meegle.com?utm_source=github&utm_medium=readme&utm_campaign=meegle_cli) / [Lark Project](https://project.feishu.cn?utm_source=github&utm_medium=readme&utm_campaign=meegle_cli))命令行工具。在终端中管理工作项、查看排期、搜索数据,无需打开浏览器。
6
+
7
+ [English](README.md)
8
+
9
+ ## 安装
10
+
11
+ ```bash
12
+ npm install -g @lark-project/meegle
13
+ ```
14
+
15
+ 要求 Node.js >= 16。
16
+
17
+ ## 快速开始
18
+
19
+ ```bash
20
+ # 1. 登录
21
+ meegle auth login
22
+
23
+ # 2. 查看本周待办
24
+ meegle mywork todo --action this_week --page-num 1
25
+
26
+ # 3. 查看帮助
27
+ meegle --help
28
+ meegle workitem --help
29
+
30
+ # 4. 查看命令参数详情
31
+ meegle inspect workitem.create
32
+ ```
33
+
34
+ ## 命令一览
35
+
36
+ ### workitem — 工作项域
37
+
38
+ | 命令 | 说明 |
39
+ |------|------|
40
+ | `workitem create` | 创建工作项 |
41
+ | `workitem get` | 查看工作项概况 |
42
+ | `workitem update` | 修改工作项字段 |
43
+ | `workitem query` | 使用 MQL 搜索工作项 |
44
+ | `workitem list-op-records` | 查看操作记录 |
45
+ | `workitem meta-types` | 查看工作项类型列表 |
46
+ | `workitem meta-create-fields` | 查看创建时可用字段 |
47
+ | `workitem meta-fields` | 查看字段配置 |
48
+ | `workitem meta-roles` | 查看角色配置 |
49
+
50
+ ### workflow — 工作流域
51
+
52
+ | 命令 | 说明 |
53
+ |------|------|
54
+ | `workflow transition` | 流转或回滚节点 |
55
+ | `workflow transition-state` | 流转状态流状态 |
56
+ | `workflow get-node` | 查看节点详情 |
57
+ | `workflow update-node` | 修改节点 |
58
+ | `workflow meta-node-fields` | 查看节点字段配置 |
59
+ | `workflow list-state-transitions` | 查看可流转状态 |
60
+ | `workflow list-state-required` | 查看流转必填信息 |
61
+
62
+ ### subtask — 子任务
63
+
64
+ | 命令 | 说明 |
65
+ |------|------|
66
+ | `subtask update` | 创建/修改/完成/回滚子任务 |
67
+
68
+ ### comment — 评论域
69
+
70
+ | 命令 | 说明 |
71
+ |------|------|
72
+ | `comment add` | 添加评论 |
73
+ | `comment list` | 查看评论列表 |
74
+
75
+ ### workhour — 工时域
76
+
77
+ | 命令 | 说明 |
78
+ |------|------|
79
+ | `workhour list-records` | 查看工时登记记录 |
80
+ | `workhour list-schedule` | 查看人员排期 |
81
+
82
+ ### relation — 关系域
83
+
84
+ | 命令 | 说明 |
85
+ |------|------|
86
+ | `relation list` | 查看关联的工作项 |
87
+ | `relation meta-definitions` | 查看关联关系定义 |
88
+
89
+ ### mywork — 工作台域
90
+
91
+ | 命令 | 说明 |
92
+ |------|------|
93
+ | `mywork todo` | 查看我的待办/已办 |
94
+
95
+ ### view — 视图域
96
+
97
+ | 命令 | 说明 |
98
+ |------|------|
99
+ | `view create-fixed` | 创建固定视图 |
100
+ | `view get` | 查看视图详情 |
101
+ | `view update-fixed` | 更新固定视图 |
102
+ | `view search` | 按名称搜索视图 |
103
+
104
+ ### chart — 度量域
105
+
106
+ | 命令 | 说明 |
107
+ |------|------|
108
+ | `chart get` | 查看图表详情 |
109
+ | `chart list` | 查看视图下的图表列表 |
110
+
111
+ ### team / user — 人员域
112
+
113
+ | 命令 | 说明 |
114
+ |------|------|
115
+ | `team list` | 查看空间下的团队列表 |
116
+ | `team list-members` | 查看团队成员 |
117
+ | `user me` | 查看当前登录用户信息 |
118
+ | `user search` | 搜索用户信息 |
119
+
120
+ ### project — 空间域
121
+
122
+ | 命令 | 说明 |
123
+ |------|------|
124
+ | `project search` | 搜索空间信息 |
125
+
126
+ ### auth — 认证域
127
+
128
+ | 命令 | 说明 |
129
+ |------|------|
130
+ | `auth login` | 登录(浏览器或 `--device-code`) |
131
+ | `auth logout` | 登出 |
132
+ | `auth status` | 查看登录状态 |
133
+
134
+ ### config — 配置域
135
+
136
+ | 命令 | 说明 |
137
+ |------|------|
138
+ | `config init` | 初始化配置 |
139
+ | `config show` | 查看当前配置 |
140
+ | `config set` | 设置配置项 |
141
+ | `config get` | 读取配置项 |
142
+ | `config profile create\|list\|use\|current\|delete` | 管理多环境 profile |
143
+
144
+ ### 其他命令
145
+
146
+ | 命令 | 说明 |
147
+ |------|------|
148
+ | `inspect [command]` | 查看命令参数详情 |
149
+ | `completion bash\|zsh\|fish` | 生成 Shell 补全脚本 |
150
+ | `completion install` | 自动安装 Shell 补全 |
151
+
152
+ ## 常用示例
153
+
154
+ ### 查看待办
155
+
156
+ ```bash
157
+ # 本周待办
158
+ meegle mywork todo --action this_week --page-num 1
159
+
160
+ # 已办事项
161
+ meegle mywork todo --action done --page-num 1
162
+
163
+ # 逾期事项
164
+ meegle mywork todo --action overdue --page-num 1
165
+ ```
166
+
167
+ ### 查询工作项
168
+
169
+ ```bash
170
+ # 查看工作项概况
171
+ meegle workitem get --work-item-id 12345
172
+
173
+ # 查看工作项的节点详情
174
+ meegle workflow get-node --work-item-id 12345 --need-sub-task
175
+ ```
176
+
177
+ ### 创建工作项
178
+
179
+ ```bash
180
+ # 使用 --set 设置字段
181
+ meegle workitem create --project-key PROJ --work-item-type story \
182
+ --set name=优化登录流程 \
183
+ --set priority=P1
184
+
185
+ # 复杂字段传 JSON 值
186
+ meegle workitem create --project-key PROJ --work-item-type story \
187
+ --set name=排期任务 \
188
+ --set schedule='[1722182400000,1722355199999]'
189
+ ```
190
+
191
+ ### 修改字段
192
+
193
+ ```bash
194
+ # 修改工作项名称
195
+ meegle workitem update --work-item-id 12345 \
196
+ --set name=新标题
197
+
198
+ # 同时修改多个字段
199
+ meegle workitem update --work-item-id 12345 \
200
+ --set name=新标题 \
201
+ --set priority=P0
202
+ ```
203
+
204
+ ### MQL 搜索
205
+
206
+ ```bash
207
+ # 查询空间下的 P0 需求
208
+ meegle workitem query --project-key PROJ \
209
+ --mql "SELECT \`name\`, \`priority\` FROM \`空间名\`.\`需求\` WHERE \`priority\` = 'P0'"
210
+ ```
211
+
212
+ ### 查看排期
213
+
214
+ ```bash
215
+ # 查看团队成员排期
216
+ meegle workhour list-schedule --project-key PROJ \
217
+ --start-time 2026-03-01 --end-time 2026-03-31 \
218
+ --user-keys "张三,李四,王五"
219
+ ```
220
+
221
+ ### 查看用户信息
222
+
223
+ ```bash
224
+ meegle user search --user-keys "张三,李四" --project-key PROJ
225
+ ```
226
+
227
+ ## 参数传递
228
+
229
+ ### 基本 flag
230
+
231
+ 每个命令的参数通过 `--flag-name` 传递:
232
+
233
+ ```bash
234
+ meegle workitem get --work-item-id 12345 --project-key PROJ
235
+ ```
236
+
237
+ ### --set key=value(写入命令)
238
+
239
+ `workitem create`、`workitem update`、`workflow update-node`、`subtask update` 支持 `--set` 简便设置字段:
240
+
241
+ ```bash
242
+ --set name=标题 # 字符串
243
+ --set points=5 # 数字
244
+ --set is_urgent=true # 布尔
245
+ --set schedule='[1,2]' # JSON 数组
246
+ --set role='{"role":"RD"}' # JSON 对象
247
+ ```
248
+
249
+ `--set` 可重复使用,一次设置多个字段。
250
+
251
+ ### --params JSON(兜底)
252
+
253
+ 所有命令都支持 `--params` 传入完整 JSON 参数:
254
+
255
+ ```bash
256
+ meegle workitem create --project-key PROJ --work-item-type story \
257
+ --params '{"fields":[{"field_key":"name","field_value":"标题"}]}'
258
+ ```
259
+
260
+ ### 优先级
261
+
262
+ 当 `--set`、`--params` 和普通 flag 同时使用时:
263
+
264
+ 1. `--set` 覆盖 `--params` 中同名字段
265
+ 2. 普通 flag(如 `--project-key`)覆盖 `--params` 中同名顶层 key
266
+
267
+ ### 数组参数
268
+
269
+ 多个值用逗号分隔:
270
+
271
+ ```bash
272
+ --user-keys "张三,李四,王五"
273
+ --field-keys "name,status,priority"
274
+ ```
275
+
276
+ ### 布尔参数
277
+
278
+ 直接加 flag 即为 true,不加即为 false:
279
+
280
+ ```bash
281
+ meegle workflow get-node --work-item-id 12345 --need-sub-task
282
+ ```
283
+
284
+ ## 全局 Flag
285
+
286
+ | Flag | 缩写 | 说明 |
287
+ |------|------|------|
288
+ | `--format` | `-o` | 输出格式:`json`(默认)、`table`、`ndjson`、`yaml`、`markdown`、`raw` |
289
+ | `--select` | | 字段投影(支持 dot path) |
290
+ | `--set` | | 设置嵌套参数(可重复) |
291
+ | `--params` | `-P` | 完整 JSON 参数体 |
292
+ | `--dry-run` | | 只渲染请求,不实际执行 |
293
+ | `--verbose` | `-v` | 详细输出 |
294
+ | `--profile` | | 指定配置 profile |
295
+
296
+ ## 输出格式
297
+
298
+ ```bash
299
+ # JSON(默认)
300
+ meegle workitem get --work-item-id 12345
301
+
302
+ # 选取输出属性(支持 dot path)
303
+ meegle workitem get --work-item-id 12345 --select "id,name,status"
304
+ meegle mywork todo --action done --page-num 1 --select "list.work_item_info.work_item_name"
305
+
306
+ # NDJSON(适合管道处理)
307
+ meegle mywork todo --action this_week --page-num 1 -o ndjson
308
+
309
+ # 表格
310
+ meegle mywork todo --action this_week --page-num 1 -o table
311
+
312
+ # YAML
313
+ meegle workitem get --work-item-id 12345 -o yaml
314
+
315
+ # Markdown 表格
316
+ meegle mywork todo --action this_week --page-num 1 -o markdown
317
+
318
+ # Dry run(预览请求,不实际发送)
319
+ meegle workitem create --project-key PROJ --work-item-type story --set name="测试" --dry-run
320
+ ```
321
+
322
+ ### --select dot path
323
+
324
+ `--select` 支持用 `.` 访问嵌套属性,遇到数组时自动穿透:
325
+
326
+ ```bash
327
+ # 从嵌套结构中提取字段
328
+ --select "list.work_item_info.work_item_name,list.state_info.end_state_key_name"
329
+
330
+ # 混合顶层和嵌套
331
+ --select "total,list.work_item_info.work_item_name"
332
+ ```
333
+
334
+ ## 命令内省
335
+
336
+ 使用 `inspect` 查看命令的完整参数信息:
337
+
338
+ ```bash
339
+ # 列出所有命令
340
+ meegle inspect
341
+
342
+ # 查看特定命令的参数详情
343
+ meegle inspect workitem.create
344
+ ```
345
+
346
+ ## 认证
347
+
348
+ ### 浏览器登录(默认)
349
+
350
+ ```bash
351
+ meegle auth login
352
+ ```
353
+
354
+ 自动打开浏览器完成 OAuth 授权。如果浏览器未打开,终端会显示授权地址,手动复制即可。
355
+
356
+ ### Device Code 登录(无浏览器环境)
357
+
358
+ ```bash
359
+ meegle auth login --device-code
360
+ ```
361
+
362
+ 终端显示二维码和授权码,使用手机扫码授权。适用于 SSH 远程服务器等无浏览器环境。
363
+
364
+ ### 其他认证命令
365
+
366
+ ```bash
367
+ # 查看登录状态
368
+ meegle auth status
369
+
370
+ # 登出
371
+ meegle auth logout
372
+ ```
373
+
374
+ ## 配置
375
+
376
+ ### 配置文件
377
+
378
+ 配置存储在 `~/.meegle/config.json`:
379
+
380
+ ```bash
381
+ # 初始化配置
382
+ meegle config init
383
+
384
+ # 查看当前配置
385
+ meegle config show
386
+
387
+ # 修改单个配置项
388
+ meegle config set host project.feishu.cn
389
+
390
+ # 查看单个配置项
391
+ meegle config get host
392
+ ```
393
+
394
+ 主要配置项:
395
+
396
+ | 字段 | 说明 | 示例 |
397
+ |------|------|------|
398
+ | `host` | 站点域名 | `project.feishu.cn`、`meegle.com` |
399
+
400
+ ### 多环境 Profile
401
+
402
+ 支持管理多个环境配置(不同站点、不同账号),每个 profile 独立存储 host 和认证信息。
403
+
404
+ ```bash
405
+ # 创建新环境(交互式引导 host 选择 + 登录)
406
+ meegle config profile create staging
407
+
408
+ # 查看所有环境
409
+ meegle config profile list
410
+
411
+ # 切换默认环境
412
+ meegle config profile use staging
413
+
414
+ # 查看当前环境
415
+ meegle config profile current
416
+
417
+ # 临时使用其他环境(不改变默认)
418
+ meegle mywork todo --action this_week --page-num 1 --profile staging
419
+
420
+ # 删除环境
421
+ meegle config profile delete staging
422
+ ```
423
+
424
+ ## 常见问题
425
+
426
+ ### 命令列表为空
427
+
428
+ CLI 启动时会从服务端获取可用命令列表。如果网络不通或未登录,动态命令不会注册。请先确保已登录:
429
+
430
+ ```bash
431
+ meegle auth login
432
+ ```
433
+
434
+ 命令列表会自动缓存,过期后在后台静默刷新,不影响使用。
435
+
436
+ ## License
437
+
438
+ [MIT](LICENSE) © Lark Technologies Pte. Ltd.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/bin/meegle.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@lark-project/meegle",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Agent-First CLI for Meegle (Lark Project)",
5
- "license": "ISC",
5
+ "license": "MIT",
6
6
  "bin": {
7
7
  "meegle": "bin/meegle.js"
8
8
  },
@@ -22,11 +22,15 @@
22
22
  "bin/meegle.js",
23
23
  "bin/meegle-*",
24
24
  "README.md",
25
+ "README.zh-CN.md",
25
26
  "LICENSE"
26
27
  ],
27
28
  "publishConfig": {
28
29
  "tag": "beta"
29
30
  },
31
+ "scripts": {
32
+ "prepublishOnly": "cp ../../README.md ./README.md && cp ../../README.zh-CN.md ./README.zh-CN.md && cp ../../LICENSE ./LICENSE"
33
+ },
30
34
  "keywords": [
31
35
  "meegle",
32
36
  "lark-project",