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