@lark-project/meegle 1.0.0 → 1.0.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 +23 -0
- package/README.md +145 -4
- package/README.zh-CN.md +133 -4
- package/bin/meegle-darwin-arm64 +0 -0
- package/bin/meegle-darwin-x64 +0 -0
- package/bin/meegle-linux-arm64 +0 -0
- package/bin/meegle-linux-x64 +0 -0
- package/bin/meegle-win32-arm64.exe +0 -0
- package/bin/meegle-win32-x64.exe +0 -0
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
|
|
6
|
+
post-release changes accumulate under `[Unreleased]` and graduate to a
|
|
7
|
+
versioned section on each npm release.
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
## [v1.0.1] - 2026-04-28
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- New `attachment` domain exposing Lark project's two-stage attachment protocol — basic `attachment prepare-upload` / `attachment prepare-download` for raw signed-URL preprocess payloads, and end-to-end shortcuts `attachment +upload` / `attachment +download` that chain the preprocess with the signed HTTP transfer client-side. Supports four resource types via `--resource-type`: `15` (workitem attachment field), `16` (rich-text field image), `13` (comment attachment), `14` (comment image); use `--work-item-id` for existing workitems and `--work-item-type` for the create-with-attachment path
|
|
16
|
+
- `meegle url decode` subcommand for parsing Meego URLs into structured fields, including trailing-wildcard URL rules and a `setting_other` fallback for unknown views
|
|
17
|
+
- `--params @file.json` syntax on every dynamic command so complex JSON payloads can be loaded from a file instead of a shell-escaped string
|
|
18
|
+
- `--refresh` global flag forces a fresh tool-schema discovery, bypassing the `~/.meegle/cache/tools.json` cache; `auth login` now also invalidates the cache so the next invocation picks up the new identity's command set
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Tool-schema cache now honors its 24h `DefaultTTL`. Previously `resolveTools` returned any cache hit regardless of age, so server-side schema changes (new flags, renamed parameters, new commands) only surfaced after manually deleting `~/.meegle/cache/tools.json`. A stale cache now triggers a fresh discovery, falling back to the stale snapshot only when the server is unreachable so offline users keep their last-known command set
|
|
23
|
+
- `meegle auth status` and the first-run auth check now route through the same `ResolveIdentity` path as runtime commands, so config-file tokens, env-var tokens, and store-backed tokens are treated consistently
|
|
24
|
+
- The OS-native credential store (macOS keychain, Linux `secret-tool`, Windows DPAPI) is now wrapped in a `FallbackStore` that transparently switches to the encrypted file store on the first runtime Save/Load failure — fixes the silent token-loss in sandboxed macOS, locked-keychain SSH sessions, and headless Linux containers reported in [larksuite/meegle-cli#3](https://github.com/larksuite/meegle-cli/issues/3) without writing a sentinel probe entry to the user's keychain on every CLI invocation
|
|
25
|
+
- `SecretToolStore.Load` no longer treats libsecret's "item absent from keyring" exit (exit 1, empty stdout, empty stderr) as a primary-store failure, so a fresh Linux user's first CLI run no longer permanently flips `FallbackStore` to the encrypted file store
|
|
26
|
+
- Failed token-store writes after a successful refresh are no longer silently dropped — a stderr warning is emitted so the next CLI invocation does not silently re-trigger a 401 / re-login loop
|
|
27
|
+
|
|
5
28
|
## [v1.0.0] - 2026-04-22
|
|
6
29
|
|
|
7
30
|
Initial public release of Meegle CLI, published on npm as `@lark-project/meegle`.
|
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ Command-line tool for [Meegle](https://meegle.com?utm_source=github&utm_medium=r
|
|
|
34
34
|
| 👥 [Team & User](#team--user--people) | List teams, team members, search users, view current login |
|
|
35
35
|
| 🗂️ [Projects](#project--projects) | Search projects by keyword |
|
|
36
36
|
| 🔐 [Auth & Config](#authentication) | OAuth login, device-code flow, multi-profile config, env-var injection |
|
|
37
|
+
| 🔗 [URL Parsing](#url--url-parsing) | Offline decode of Meegle / Feishu Project URLs into `url_kind` + structured fields |
|
|
37
38
|
| 🤖 [Agent Skill](#ai-agent-skill) | Pre-built skill for Trae / Claude Code / Cursor / Windsurf / Gemini CLI / Copilot |
|
|
38
39
|
|
|
39
40
|
## Installation
|
|
@@ -242,6 +243,15 @@ The agent consults the skill, picks the right `meegle` commands, and runs them f
|
|
|
242
243
|
|---------|-------------|
|
|
243
244
|
| `project search` | Search projects |
|
|
244
245
|
|
|
246
|
+
### attachment — Attachments
|
|
247
|
+
|
|
248
|
+
| Command | Description |
|
|
249
|
+
|---------|-------------|
|
|
250
|
+
| `attachment prepare-upload` | Upload preprocess — returns the signed object-storage URL and multipart plan |
|
|
251
|
+
| `attachment prepare-download` | Download preprocess — returns the signed object-storage URL and multipart plan |
|
|
252
|
+
| `attachment +upload` | End-to-end upload: preprocess + signed HTTP POST(s); returns the resulting `file_token` and file metadata |
|
|
253
|
+
| `attachment +download` | End-to-end download: preprocess + signed HTTP GET(s) + atomic write — for `file_url`s embedded in `workitem get` / `comment list` responses |
|
|
254
|
+
|
|
245
255
|
### auth — Authentication
|
|
246
256
|
|
|
247
257
|
| Command | Description |
|
|
@@ -260,6 +270,14 @@ The agent consults the skill, picks the right `meegle` commands, and runs them f
|
|
|
260
270
|
| `config get` | Get a configuration value |
|
|
261
271
|
| `config profile create\|list\|use\|current\|delete` | Manage configuration profiles |
|
|
262
272
|
|
|
273
|
+
### url — URL Parsing
|
|
274
|
+
|
|
275
|
+
Offline, no-network utility for parsing Meegle / Feishu Project URLs into structured fields. Skills and pipelines branch on the returned `url_kind` instead of guessing from raw paths.
|
|
276
|
+
|
|
277
|
+
| Command | Description |
|
|
278
|
+
|---------|-------------|
|
|
279
|
+
| `url decode --url <URL>` | Decode a URL into `url_kind` + `simple_name` / `work_item_type` / `work_item_id` / `view_id` / `chart_id` / `query` / `redirected_from` etc. Unrecognised URLs return `url_kind: "unknown"`. |
|
|
280
|
+
|
|
263
281
|
### Other Commands
|
|
264
282
|
|
|
265
283
|
| Command | Description |
|
|
@@ -297,8 +315,9 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
297
315
|
|
|
298
316
|
`workitem +batch-get` fans out to `workitem get` for each ID and aggregates the
|
|
299
317
|
results into one response. Shared flags (e.g. `--project-key`) apply to every
|
|
300
|
-
per-item call. The `+` prefix marks it as a scenario/sugar command
|
|
301
|
-
|
|
318
|
+
per-item call. The `+` prefix marks it as a scenario/sugar command — the CLI
|
|
319
|
+
composes multiple `get` calls client-side instead of mapping to a single
|
|
320
|
+
backend endpoint.
|
|
302
321
|
|
|
303
322
|
```bash
|
|
304
323
|
# Comma-separated IDs in one invocation
|
|
@@ -361,6 +380,102 @@ meegle workitem update --work-item-id 12345 \
|
|
|
361
380
|
]}'
|
|
362
381
|
```
|
|
363
382
|
|
|
383
|
+
### Attachments
|
|
384
|
+
|
|
385
|
+
The `attachment` domain exposes Lark project's two-stage attachment protocol
|
|
386
|
+
in two layers:
|
|
387
|
+
|
|
388
|
+
- **Basic commands** (`attachment prepare-upload`, `attachment prepare-download`)
|
|
389
|
+
return the raw signed-URL preprocess payload — handy for scripting your own
|
|
390
|
+
HTTP transfer or inspecting the multipart plan.
|
|
391
|
+
- **Shortcuts** (`attachment +upload`, `attachment +download`) chain the basic
|
|
392
|
+
preprocess with the signed HTTP POST/GET to object storage end-to-end. The
|
|
393
|
+
`+` prefix marks them as scenario commands — the CLI orchestrates the
|
|
394
|
+
preprocess output plus the out-of-band byte transfer client-side.
|
|
395
|
+
|
|
396
|
+
`--resource-type` tells the backend what the file will be attached to:
|
|
397
|
+
|
|
398
|
+
| `--resource-type` | Target |
|
|
399
|
+
|-------------------|--------|
|
|
400
|
+
| `15` | Workitem attachment field |
|
|
401
|
+
| `16` | Image embedded in a workitem rich-text field |
|
|
402
|
+
| `13` | Attachment on a comment |
|
|
403
|
+
| `14` | Image embedded in a comment |
|
|
404
|
+
|
|
405
|
+
**Scoping the preprocess**: every upload needs either `--work-item-id` or
|
|
406
|
+
`--work-item-type`. **Always prefer `--work-item-id`** when the target workitem
|
|
407
|
+
exists (update / comment scenarios); only use `--work-item-type` for the
|
|
408
|
+
create-with-attachment path where the workitem hasn't been created yet. If
|
|
409
|
+
both are supplied, `--work-item-id` wins and `--work-item-type` is ignored.
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
# Upload a file for a workitem attachment field (resource-type 15)
|
|
413
|
+
meegle attachment +upload ./a.pdf \
|
|
414
|
+
--resource-type 15 \
|
|
415
|
+
--project-key PROJ --work-item-id 12345 --field-key files_field
|
|
416
|
+
|
|
417
|
+
# Create-with-attachment path — workitem doesn't exist yet, pass --work-item-type
|
|
418
|
+
meegle attachment +upload ./a.pdf \
|
|
419
|
+
--resource-type 15 \
|
|
420
|
+
--project-key PROJ --work-item-type story --field-key files_field
|
|
421
|
+
|
|
422
|
+
# Upload an image for a rich-text field (resource-type 16)
|
|
423
|
+
meegle attachment +upload ./diagram.png \
|
|
424
|
+
--resource-type 16 \
|
|
425
|
+
--project-key PROJ --work-item-id 12345 --field-key spec_field
|
|
426
|
+
|
|
427
|
+
# Upload a comment attachment (resource-type 13)
|
|
428
|
+
meegle attachment +upload ./report.pdf \
|
|
429
|
+
--resource-type 13 \
|
|
430
|
+
--project-key PROJ --work-item-id 12345
|
|
431
|
+
|
|
432
|
+
# Upload a comment image (resource-type 14)
|
|
433
|
+
meegle attachment +upload ./screen.png \
|
|
434
|
+
--resource-type 14 \
|
|
435
|
+
--project-key PROJ --work-item-id 12345
|
|
436
|
+
|
|
437
|
+
# Download: pass the opaque file_url from another command's response.
|
|
438
|
+
URL=$(meegle workitem get --project-key PROJ --work-item-id 12345 \
|
|
439
|
+
--fields files_field --format json \
|
|
440
|
+
| jq -r '.fields.files_field[0].url')
|
|
441
|
+
meegle attachment +download "$URL" \
|
|
442
|
+
--project-key PROJ --work-item-id 12345 \
|
|
443
|
+
--output ./local.pdf --overwrite
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
`+upload` returns a JSON object with the file token and metadata:
|
|
447
|
+
|
|
448
|
+
```json
|
|
449
|
+
{
|
|
450
|
+
"file_token": "...",
|
|
451
|
+
"file_url": "https://...",
|
|
452
|
+
"name": "a.pdf",
|
|
453
|
+
"size": 12345,
|
|
454
|
+
"mime_type": "application/pdf"
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
To wire the result into a downstream command, parse the response with `jq`
|
|
459
|
+
or your scripting language of choice:
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
# Comment attachment — comment add takes file_token directly
|
|
463
|
+
TOKEN=$(meegle attachment +upload ./report.pdf --resource-type 13 \
|
|
464
|
+
--project-key PROJ --work-item-id 12345 | jq -r '.file_token')
|
|
465
|
+
meegle comment add --work-item-id 12345 --content "See attached" --file-token "$TOKEN"
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
**Field-level attachment formats** (how to assemble `--fields` payloads):
|
|
469
|
+
|
|
470
|
+
- **Workitem attachment field** (`--resource-type 15`) — `field_value` is a
|
|
471
|
+
JSON *string* whose parsed form is `[{"name","type","size","fileToken"}]`.
|
|
472
|
+
Note: `fileToken` is camelCase (other backend fields are snake_case) and
|
|
473
|
+
`size` is a string, not a number.
|
|
474
|
+
- **Rich-text field / comment image** (`--resource-type 16` / `14`) — embed
|
|
475
|
+
images as ` <!-- file_token -->`.
|
|
476
|
+
- **Comment attachment** (`--resource-type 13`) — `comment add --file-token`
|
|
477
|
+
takes `file_token` directly.
|
|
478
|
+
|
|
364
479
|
### MQL Search
|
|
365
480
|
|
|
366
481
|
```bash
|
|
@@ -429,6 +544,31 @@ meegle workitem create --project-key PROJ --work-item-type story \
|
|
|
429
544
|
--params '{"fields":[{"field_key":"name","field_value":"Title"}]}'
|
|
430
545
|
```
|
|
431
546
|
|
|
547
|
+
#### Reading from a file (`@file.json`)
|
|
548
|
+
|
|
549
|
+
Inline JSON is unergonomic on Windows because CMD requires `\"` escaping
|
|
550
|
+
and PowerShell mangles backslashes when forwarding native-command arguments.
|
|
551
|
+
Prefix the value with `@` to load the JSON from a file instead — works
|
|
552
|
+
identically on macOS, Linux, and Windows shells:
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
# body.json:
|
|
556
|
+
# {"fields":[{"field_key":"name","field_value":"Optimize login flow"}]}
|
|
557
|
+
|
|
558
|
+
meegle workitem create --project-key PROJ --work-item-type story \
|
|
559
|
+
--params @body.json
|
|
560
|
+
|
|
561
|
+
# Absolute path also works
|
|
562
|
+
meegle workitem update --work-item-id 12345 --params @/tmp/patch.json
|
|
563
|
+
|
|
564
|
+
# PowerShell — same syntax, no escaping headaches
|
|
565
|
+
meegle workitem create --project-key PROJ --work-item-type story --params '@body.json'
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
The path is read with the OS's default encoding; both relative and absolute
|
|
569
|
+
paths are accepted. A missing file fails with `PARAM_INVALID`; a file whose
|
|
570
|
+
contents are not valid JSON fails with `INVALID_PARAMS_JSON`.
|
|
571
|
+
|
|
432
572
|
### Priority
|
|
433
573
|
|
|
434
574
|
When `--set`, `--params`, and regular flags are used together:
|
|
@@ -460,10 +600,11 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
460
600
|
| `--format` | `-o` | Output format: `json` (default), `table`, `ndjson`, `raw` |
|
|
461
601
|
| `--select` | | Field projection with dot paths |
|
|
462
602
|
| `--set` | | Set nested parameters (repeatable) |
|
|
463
|
-
| `--params` | `-P` | Full JSON parameter body |
|
|
603
|
+
| `--params` | `-P` | Full JSON parameter body; prefix with `@` to read from a file (e.g. `--params @body.json`) |
|
|
464
604
|
| `--dry-run` | | Render request without executing |
|
|
465
605
|
| `--verbose` | `-v` | Verbose output |
|
|
466
606
|
| `--profile` | | Use a specific configuration profile |
|
|
607
|
+
| `--refresh` | | Refresh cached commands from server (bypass the local 24 h cache) |
|
|
467
608
|
|
|
468
609
|
## Advanced Usage
|
|
469
610
|
|
|
@@ -604,7 +745,7 @@ Two well-known environment variables are read directly at CLI startup and overri
|
|
|
604
745
|
export MEEGLE_HOST=project.feishu.cn
|
|
605
746
|
export MEEGLE_USER_ACCESS_TOKEN=<your-user-token>
|
|
606
747
|
export MEEGLE_USER_AGENT=ci-runner # optional; appended to User-Agent, highest priority over config.user_agent
|
|
607
|
-
meegle workitem get
|
|
748
|
+
meegle workitem get --work-item-id 123
|
|
608
749
|
```
|
|
609
750
|
|
|
610
751
|
Either variable may be set independently. When this path is taken, the CLI bypasses the keychain and does not attempt to refresh on 401 — the caller is responsible for rotating the env value.
|
package/README.zh-CN.md
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
| 👥 [团队与用户](#team--user--人员域) | 列出团队、团队成员、搜索用户、查看当前登录身份 |
|
|
35
35
|
| 🗂️ [空间](#project--空间域) | 按关键词搜索空间 |
|
|
36
36
|
| 🔐 [认证与配置](#认证) | OAuth 登录、Device Code 流程、多 profile 配置、环境变量注入 |
|
|
37
|
+
| 🔗 [URL 解析](#url--url-解析) | 离线解析飞书项目 / Meegle URL,输出 `url_kind` + 结构化字段 |
|
|
37
38
|
| 🤖 [Agent Skill](#ai-agent-skill) | 内置 skill 供 Trae / Claude Code / Cursor / Windsurf / Gemini / Copilot 使用 |
|
|
38
39
|
|
|
39
40
|
## 安装
|
|
@@ -242,6 +243,15 @@ Agent 会参考 skill,自动选择合适的 `meegle` 命令执行。配合 `--
|
|
|
242
243
|
|------|------|
|
|
243
244
|
| `project search` | 搜索空间信息 |
|
|
244
245
|
|
|
246
|
+
### attachment — 附件域
|
|
247
|
+
|
|
248
|
+
| 命令 | 说明 |
|
|
249
|
+
|------|------|
|
|
250
|
+
| `attachment prepare-upload` | 上传预处理 —— 返回带签名的对象存储 URL 与分片计划 |
|
|
251
|
+
| `attachment prepare-download` | 下载预处理 —— 返回带签名的对象存储 URL 与分片计划 |
|
|
252
|
+
| `attachment +upload` | 端到端上传:预处理 + 签名 HTTP POST,返回 `file_token` 与文件元信息 |
|
|
253
|
+
| `attachment +download` | 端到端下载:预处理 + 签名 HTTP GET + 原子写文件,用于消费 `workitem get` / `comment list` 返回的 `file_url` |
|
|
254
|
+
|
|
245
255
|
### auth — 认证域
|
|
246
256
|
|
|
247
257
|
| 命令 | 说明 |
|
|
@@ -260,6 +270,14 @@ Agent 会参考 skill,自动选择合适的 `meegle` 命令执行。配合 `--
|
|
|
260
270
|
| `config get` | 读取配置项 |
|
|
261
271
|
| `config profile create\|list\|use\|current\|delete` | 管理多环境 profile |
|
|
262
272
|
|
|
273
|
+
### url — URL 解析
|
|
274
|
+
|
|
275
|
+
离线、纯本地的 URL 解析工具,不发起任何网络调用。Skill 或 pipeline 解析飞书项目/Meegle URL 时优先走本命令,拿 `url_kind` 做分支,避免从原始路径猜字段。
|
|
276
|
+
|
|
277
|
+
| 命令 | 说明 |
|
|
278
|
+
|------|------|
|
|
279
|
+
| `url decode --url <URL>` | 将 URL 解析为 `url_kind` + `simple_name` / `work_item_type` / `work_item_id` / `view_id` / `chart_id` / `query` / `redirected_from` 等字段;未识别的 URL 返回 `url_kind: "unknown"`。 |
|
|
280
|
+
|
|
263
281
|
### 其他命令
|
|
264
282
|
|
|
265
283
|
| 命令 | 说明 |
|
|
@@ -297,8 +315,8 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
297
315
|
|
|
298
316
|
`workitem +batch-get` 会对每个 ID 分别调用 `workitem get` 并把结果聚合成一条响应。
|
|
299
317
|
共享 flag(如 `--project-key`)会应用到每一次 per-item 调用上。命令以 `+` 开头,
|
|
300
|
-
|
|
301
|
-
|
|
318
|
+
表示它是客户端侧的场景/语法糖命令,CLI 在 `get` 之上组合出批量语义,没有对应的
|
|
319
|
+
单一后端接口。
|
|
302
320
|
|
|
303
321
|
```bash
|
|
304
322
|
# 在一次调用里传入逗号分隔的多个 ID
|
|
@@ -360,6 +378,96 @@ meegle workitem update --work-item-id 12345 \
|
|
|
360
378
|
]}'
|
|
361
379
|
```
|
|
362
380
|
|
|
381
|
+
### 附件上传 / 下载
|
|
382
|
+
|
|
383
|
+
`attachment` 域把飞书项目的两段式附件协议拆成两层暴露:
|
|
384
|
+
|
|
385
|
+
- **基础命令**(`attachment prepare-upload` / `attachment prepare-download`)
|
|
386
|
+
返回带签名的 URL 预处理结果——适合自己写脚本做 HTTP 传输或调试分片计划。
|
|
387
|
+
- **快捷命令**(`attachment +upload` / `attachment +download`)把基础预处理与
|
|
388
|
+
签名后的对象存储 HTTP POST/GET 在客户端组合成端到端流程。`+` 前缀表示这是
|
|
389
|
+
场景命令——CLI 在客户端把预处理输出与字节传输串起来。
|
|
390
|
+
|
|
391
|
+
`--resource-type` 告诉后端这次上传/下载是给什么场景用:
|
|
392
|
+
|
|
393
|
+
| `--resource-type` | 用途 |
|
|
394
|
+
|-------------------|------|
|
|
395
|
+
| `15` | 工作项附件字段 |
|
|
396
|
+
| `16` | 工作项富文本字段里的图片 |
|
|
397
|
+
| `13` | 评论附件 |
|
|
398
|
+
| `14` | 评论正文里的图片 |
|
|
399
|
+
|
|
400
|
+
**上传作用域**:每次上传需要 `--work-item-id` 或 `--work-item-type` 之一。
|
|
401
|
+
**只要工作项已经存在,就优先用 `--work-item-id`**(update / comment 场景);
|
|
402
|
+
只有创建时带附件这种"工作项还不存在"的场景才用 `--work-item-type`。两者都传时,
|
|
403
|
+
`--work-item-id` 胜出,`--work-item-type` 被静默丢弃。
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
# 为工作项附件字段上传文件 (resource-type 15)
|
|
407
|
+
meegle attachment +upload ./a.pdf \
|
|
408
|
+
--resource-type 15 \
|
|
409
|
+
--project-key PROJ --work-item-id 12345 --field-key files_field
|
|
410
|
+
|
|
411
|
+
# 创建时带附件场景 —— 工作项还不存在,用 --work-item-type
|
|
412
|
+
meegle attachment +upload ./a.pdf \
|
|
413
|
+
--resource-type 15 \
|
|
414
|
+
--project-key PROJ --work-item-type story --field-key files_field
|
|
415
|
+
|
|
416
|
+
# 为富文本字段上传图片 (resource-type 16)
|
|
417
|
+
meegle attachment +upload ./diagram.png \
|
|
418
|
+
--resource-type 16 \
|
|
419
|
+
--project-key PROJ --work-item-id 12345 --field-key spec_field
|
|
420
|
+
|
|
421
|
+
# 为评论上传附件 (resource-type 13)
|
|
422
|
+
meegle attachment +upload ./report.pdf \
|
|
423
|
+
--resource-type 13 \
|
|
424
|
+
--project-key PROJ --work-item-id 12345
|
|
425
|
+
|
|
426
|
+
# 为评论上传图片 (resource-type 14)
|
|
427
|
+
meegle attachment +upload ./screen.png \
|
|
428
|
+
--resource-type 14 \
|
|
429
|
+
--project-key PROJ --work-item-id 12345
|
|
430
|
+
|
|
431
|
+
# 下载:把其他命令响应里的 opaque file_url 直接传进来。
|
|
432
|
+
URL=$(meegle workitem get --project-key PROJ --work-item-id 12345 \
|
|
433
|
+
--fields files_field --format json \
|
|
434
|
+
| jq -r '.fields.files_field[0].url')
|
|
435
|
+
meegle attachment +download "$URL" \
|
|
436
|
+
--project-key PROJ --work-item-id 12345 \
|
|
437
|
+
--output ./local.pdf --overwrite
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
`+upload` 输出 JSON 对象,包含 file_token 与文件元信息:
|
|
441
|
+
|
|
442
|
+
```json
|
|
443
|
+
{
|
|
444
|
+
"file_token": "...",
|
|
445
|
+
"file_url": "https://...",
|
|
446
|
+
"name": "a.pdf",
|
|
447
|
+
"size": 12345,
|
|
448
|
+
"mime_type": "application/pdf"
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
要把结果拼到下游命令里,用 `jq` 或脚本语言提取所需字段:
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
# 评论附件 —— comment add 直接接收 file_token
|
|
456
|
+
TOKEN=$(meegle attachment +upload ./report.pdf --resource-type 13 \
|
|
457
|
+
--project-key PROJ --work-item-id 12345 | jq -r '.file_token')
|
|
458
|
+
meegle comment add --work-item-id 12345 --content "看附件" --file-token "$TOKEN"
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
**字段级回灌格式**(拼接 `--fields` 时参考):
|
|
462
|
+
|
|
463
|
+
- **工作项附件字段** (`--resource-type 15`) —— `field_value` 是 JSON *字符串*,
|
|
464
|
+
解析后是 `[{"name","type","size","fileToken"}]`。注意:`fileToken` 是驼峰(其他
|
|
465
|
+
后端字段都是蛇形),`size` 是字符串不是数字。
|
|
466
|
+
- **富文本字段 / 评论图片** (`--resource-type 16` / `14`) —— 图片用
|
|
467
|
+
` <!-- file_token -->` 的 markdown 嵌入。
|
|
468
|
+
- **评论附件** (`--resource-type 13`) —— `comment add --file-token` 直接接收
|
|
469
|
+
`file_token`。
|
|
470
|
+
|
|
363
471
|
### MQL 搜索
|
|
364
472
|
|
|
365
473
|
```bash
|
|
@@ -428,6 +536,26 @@ meegle workitem create --project-key PROJ --work-item-type story \
|
|
|
428
536
|
--params '{"fields":[{"field_key":"name","field_value":"标题"}]}'
|
|
429
537
|
```
|
|
430
538
|
|
|
539
|
+
#### 从文件读取(`@file.json`)
|
|
540
|
+
|
|
541
|
+
Windows 上内联 JSON 体验很糟:CMD 必须把 `"` 写成 `\"`,PowerShell 把转义反斜杠传给原生命令时还会再吞一层。给 `--params` 加 `@` 前缀即可改为从文件读取,macOS、Linux、Windows 各种 shell 都能一致工作:
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
# body.json:
|
|
545
|
+
# {"fields":[{"field_key":"name","field_value":"优化登录流程"}]}
|
|
546
|
+
|
|
547
|
+
meegle workitem create --project-key PROJ --work-item-type story \
|
|
548
|
+
--params @body.json
|
|
549
|
+
|
|
550
|
+
# 绝对路径同样支持
|
|
551
|
+
meegle workitem update --work-item-id 12345 --params @/tmp/patch.json
|
|
552
|
+
|
|
553
|
+
# PowerShell 用法相同,无需任何转义
|
|
554
|
+
meegle workitem create --project-key PROJ --work-item-type story --params '@body.json'
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
读取走系统默认编码,相对路径与绝对路径都接受。文件不存在会返回 `PARAM_INVALID`;文件内容不是合法 JSON 会返回 `INVALID_PARAMS_JSON`。
|
|
558
|
+
|
|
431
559
|
### 优先级
|
|
432
560
|
|
|
433
561
|
当 `--set`、`--params` 和普通 flag 同时使用时:
|
|
@@ -459,10 +587,11 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
459
587
|
| `--format` | `-o` | 输出格式:`json`(默认)、`table`、`ndjson`、`raw` |
|
|
460
588
|
| `--select` | | 字段投影(支持 dot path) |
|
|
461
589
|
| `--set` | | 设置嵌套参数(可重复) |
|
|
462
|
-
| `--params` | `-P` | 完整 JSON
|
|
590
|
+
| `--params` | `-P` | 完整 JSON 参数体;以 `@` 开头改为从文件读取(如 `--params @body.json`) |
|
|
463
591
|
| `--dry-run` | | 只渲染请求,不实际执行 |
|
|
464
592
|
| `--verbose` | `-v` | 详细输出 |
|
|
465
593
|
| `--profile` | | 指定配置 profile |
|
|
594
|
+
| `--refresh` | | 从服务端刷新本地命令缓存(旁路 24 小时缓存) |
|
|
466
595
|
|
|
467
596
|
## 进阶用法
|
|
468
597
|
|
|
@@ -594,7 +723,7 @@ meegle config get host
|
|
|
594
723
|
export MEEGLE_HOST=project.feishu.cn
|
|
595
724
|
export MEEGLE_USER_ACCESS_TOKEN=<your-user-token>
|
|
596
725
|
export MEEGLE_USER_AGENT=ci-runner # 可选;追加到 User-Agent,优先级高于 config.user_agent
|
|
597
|
-
meegle workitem get
|
|
726
|
+
meegle workitem get --work-item-id 123
|
|
598
727
|
```
|
|
599
728
|
|
|
600
729
|
任一变量可以单独设置。走这个路径时 CLI 不访问 keychain,401 错误不会自动 refresh,由调用方自行轮转。
|
package/bin/meegle-darwin-arm64
CHANGED
|
Binary file
|
package/bin/meegle-darwin-x64
CHANGED
|
Binary file
|
package/bin/meegle-linux-arm64
CHANGED
|
Binary file
|
package/bin/meegle-linux-x64
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/meegle-win32-x64.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-project/meegle",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Agent-First CLI for Meegle (Lark Project)",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/larksuite/meegle-cli#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/larksuite/meegle-cli.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/larksuite/meegle-cli/issues"
|
|
13
|
+
},
|
|
6
14
|
"bin": {
|
|
7
15
|
"meegle": "bin/meegle.js"
|
|
8
16
|
},
|