@lark-project/meegle 1.0.0 → 1.0.2
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 +34 -0
- package/README.md +187 -19
- package/README.zh-CN.md +174 -19
- 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/bin/meegle.js +0 -0
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
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.2] - 2026-05-14
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- New `view list-multi-project-workitems` command exposing the upstream `list_multi_project_view_workitems` MCP tool — lists work items the caller can access under a multi-project ("panoramic") view, identified by a `multiProjectView` URL's `view_id`; takes `--project-key`, `--view-id`, and an optional `--page-num` (50 items per page, 1-based)
|
|
16
|
+
- Top-level parameters merged via `--params` / `--set` are now validated against the tool's declared flag set. Unknown arguments emit a one-line stderr warning at run time and appear under `validation.unknown_params` in `--dry-run` output, pointing users at `--params '{"fields":[...]}'` for work-item field values. Validation is advisory: unknown keys are still forwarded to the backend so a stale local tool-schema cache cannot block legitimate calls (refresh with `--refresh`)
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Clarified `--params` documentation: the built-in flag's `--help` description and the README now state that top-level keys are merged as CLI flags (not a free-form payload), with a common-pitfall example showing that work-item field values must be wrapped in `fields[]`
|
|
21
|
+
|
|
22
|
+
## [v1.0.1] - 2026-04-28
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- 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
|
|
27
|
+
- `meegle url decode` subcommand for parsing Meego URLs into structured fields, including trailing-wildcard URL rules and a `setting_other` fallback for unknown views
|
|
28
|
+
- `--params @file.json` syntax on every dynamic command so complex JSON payloads can be loaded from a file instead of a shell-escaped string
|
|
29
|
+
- `--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
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- 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
|
|
34
|
+
- `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
|
|
35
|
+
- 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
|
|
36
|
+
- `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
|
|
37
|
+
- 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
|
|
38
|
+
|
|
5
39
|
## [v1.0.0] - 2026-04-22
|
|
6
40
|
|
|
7
41
|
Initial public release of Meegle CLI, published on npm as `@lark-project/meegle`.
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Command-line tool for [Meegle](https://meegle.com?utm_source=github&utm_medium=r
|
|
|
13
13
|
## Why Meegle CLI?
|
|
14
14
|
|
|
15
15
|
- **Agent-Native** — Ships a bundled [AI Agent Skill](#ai-agent-skill) that teaches Trae, Claude Code, Cursor, Windsurf, Gemini CLI and other agents how to drive Meegle with one command. Every CLI command is designed for both humans and agents, with structured JSON output, `--dry-run` previews, and `--device-code` flows for non-TTY environments
|
|
16
|
-
- **Broad Coverage** —
|
|
16
|
+
- **Broad Coverage** — 13 business domains (work items, workflow, subtasks, comments, work hours, relations, my-work, views, charts, team, user, project, attachments) and 40+ commands mapping to Meegle's core capabilities
|
|
17
17
|
- **Two-Layer Parameters** — Ergonomic `--flag-name` for everyday use, fallback `--params <json>` for complex payloads like `fields[]` — pick the right granularity per call
|
|
18
18
|
- **Flexible Output** — `json` / `table` / `ndjson` / `raw`, with `--select` dot-path projection for piping to other tools
|
|
19
19
|
- **Secure by Default** — OS keychain credential storage, `${VAR}` env-var templating so secrets never land in config files, multi-profile switching for staging / prod
|
|
@@ -33,7 +33,9 @@ Command-line tool for [Meegle](https://meegle.com?utm_source=github&utm_medium=r
|
|
|
33
33
|
| 📊 [Charts](#chart--charts) | List charts under a view, fetch chart details |
|
|
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
|
+
| 📎 [Attachments](#attachment--attachments) | Two-stage upload/download protocol — `prepare-*` basic commands plus `+upload` / `+download` end-to-end shortcuts |
|
|
36
37
|
| 🔐 [Auth & Config](#authentication) | OAuth login, device-code flow, multi-profile config, env-var injection |
|
|
38
|
+
| 🔗 [URL Parsing](#url--url-parsing) | Offline decode of Meegle / Feishu Project URLs into `url_kind` + structured fields |
|
|
37
39
|
| 🤖 [Agent Skill](#ai-agent-skill) | Pre-built skill for Trae / Claude Code / Cursor / Windsurf / Gemini CLI / Copilot |
|
|
38
40
|
|
|
39
41
|
## Installation
|
|
@@ -219,6 +221,7 @@ The agent consults the skill, picks the right `meegle` commands, and runs them f
|
|
|
219
221
|
| `view get` | View details of a view |
|
|
220
222
|
| `view update-fixed` | Update a fixed view |
|
|
221
223
|
| `view search` | Search views by name |
|
|
224
|
+
| `view list-multi-project-workitems` | List work items under a multi-project (panoramic) view |
|
|
222
225
|
|
|
223
226
|
### chart — Charts
|
|
224
227
|
|
|
@@ -242,6 +245,15 @@ The agent consults the skill, picks the right `meegle` commands, and runs them f
|
|
|
242
245
|
|---------|-------------|
|
|
243
246
|
| `project search` | Search projects |
|
|
244
247
|
|
|
248
|
+
### attachment — Attachments
|
|
249
|
+
|
|
250
|
+
| Command | Description |
|
|
251
|
+
|---------|-------------|
|
|
252
|
+
| `attachment prepare-upload` | Upload preprocess — returns the signed object-storage URL and multipart plan |
|
|
253
|
+
| `attachment prepare-download` | Download preprocess — returns the signed object-storage URL and multipart plan |
|
|
254
|
+
| `attachment +upload` | End-to-end upload: preprocess + signed HTTP POST(s); returns the resulting `file_token` and file metadata |
|
|
255
|
+
| `attachment +download` | End-to-end download: preprocess + signed HTTP GET(s) + atomic write — for `file_url`s embedded in `workitem get` / `comment list` responses |
|
|
256
|
+
|
|
245
257
|
### auth — Authentication
|
|
246
258
|
|
|
247
259
|
| Command | Description |
|
|
@@ -260,6 +272,14 @@ The agent consults the skill, picks the right `meegle` commands, and runs them f
|
|
|
260
272
|
| `config get` | Get a configuration value |
|
|
261
273
|
| `config profile create\|list\|use\|current\|delete` | Manage configuration profiles |
|
|
262
274
|
|
|
275
|
+
### url — URL Parsing
|
|
276
|
+
|
|
277
|
+
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.
|
|
278
|
+
|
|
279
|
+
| Command | Description |
|
|
280
|
+
|---------|-------------|
|
|
281
|
+
| `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"`. |
|
|
282
|
+
|
|
263
283
|
### Other Commands
|
|
264
284
|
|
|
265
285
|
| Command | Description |
|
|
@@ -297,8 +317,9 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
297
317
|
|
|
298
318
|
`workitem +batch-get` fans out to `workitem get` for each ID and aggregates the
|
|
299
319
|
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
|
-
|
|
320
|
+
per-item call. The `+` prefix marks it as a scenario/sugar command — the CLI
|
|
321
|
+
composes multiple `get` calls client-side instead of mapping to a single
|
|
322
|
+
backend endpoint.
|
|
302
323
|
|
|
303
324
|
```bash
|
|
304
325
|
# Comma-separated IDs in one invocation
|
|
@@ -361,6 +382,102 @@ meegle workitem update --work-item-id 12345 \
|
|
|
361
382
|
]}'
|
|
362
383
|
```
|
|
363
384
|
|
|
385
|
+
### Attachments
|
|
386
|
+
|
|
387
|
+
The `attachment` domain exposes Lark project's two-stage attachment protocol
|
|
388
|
+
in two layers:
|
|
389
|
+
|
|
390
|
+
- **Basic commands** (`attachment prepare-upload`, `attachment prepare-download`)
|
|
391
|
+
return the raw signed-URL preprocess payload — handy for scripting your own
|
|
392
|
+
HTTP transfer or inspecting the multipart plan.
|
|
393
|
+
- **Shortcuts** (`attachment +upload`, `attachment +download`) chain the basic
|
|
394
|
+
preprocess with the signed HTTP POST/GET to object storage end-to-end. The
|
|
395
|
+
`+` prefix marks them as scenario commands — the CLI orchestrates the
|
|
396
|
+
preprocess output plus the out-of-band byte transfer client-side.
|
|
397
|
+
|
|
398
|
+
`--resource-type` tells the backend what the file will be attached to:
|
|
399
|
+
|
|
400
|
+
| `--resource-type` | Target |
|
|
401
|
+
|-------------------|--------|
|
|
402
|
+
| `15` | Workitem attachment field |
|
|
403
|
+
| `16` | Image embedded in a workitem rich-text field |
|
|
404
|
+
| `13` | Attachment on a comment |
|
|
405
|
+
| `14` | Image embedded in a comment |
|
|
406
|
+
|
|
407
|
+
**Scoping the preprocess**: every upload needs either `--work-item-id` or
|
|
408
|
+
`--work-item-type`. **Always prefer `--work-item-id`** when the target workitem
|
|
409
|
+
exists (update / comment scenarios); only use `--work-item-type` for the
|
|
410
|
+
create-with-attachment path where the workitem hasn't been created yet. If
|
|
411
|
+
both are supplied, `--work-item-id` wins and `--work-item-type` is ignored.
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
# Upload a file for a workitem attachment field (resource-type 15)
|
|
415
|
+
meegle attachment +upload ./a.pdf \
|
|
416
|
+
--resource-type 15 \
|
|
417
|
+
--project-key PROJ --work-item-id 12345 --field-key files_field
|
|
418
|
+
|
|
419
|
+
# Create-with-attachment path — workitem doesn't exist yet, pass --work-item-type
|
|
420
|
+
meegle attachment +upload ./a.pdf \
|
|
421
|
+
--resource-type 15 \
|
|
422
|
+
--project-key PROJ --work-item-type story --field-key files_field
|
|
423
|
+
|
|
424
|
+
# Upload an image for a rich-text field (resource-type 16)
|
|
425
|
+
meegle attachment +upload ./diagram.png \
|
|
426
|
+
--resource-type 16 \
|
|
427
|
+
--project-key PROJ --work-item-id 12345 --field-key spec_field
|
|
428
|
+
|
|
429
|
+
# Upload a comment attachment (resource-type 13)
|
|
430
|
+
meegle attachment +upload ./report.pdf \
|
|
431
|
+
--resource-type 13 \
|
|
432
|
+
--project-key PROJ --work-item-id 12345
|
|
433
|
+
|
|
434
|
+
# Upload a comment image (resource-type 14)
|
|
435
|
+
meegle attachment +upload ./screen.png \
|
|
436
|
+
--resource-type 14 \
|
|
437
|
+
--project-key PROJ --work-item-id 12345
|
|
438
|
+
|
|
439
|
+
# Download: pass the opaque file_url from another command's response.
|
|
440
|
+
URL=$(meegle workitem get --project-key PROJ --work-item-id 12345 \
|
|
441
|
+
--fields files_field --format json \
|
|
442
|
+
| jq -r '.fields.files_field[0].url')
|
|
443
|
+
meegle attachment +download "$URL" \
|
|
444
|
+
--project-key PROJ --work-item-id 12345 \
|
|
445
|
+
--output ./local.pdf --overwrite
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
`+upload` returns a JSON object with the file token and metadata:
|
|
449
|
+
|
|
450
|
+
```json
|
|
451
|
+
{
|
|
452
|
+
"file_token": "...",
|
|
453
|
+
"file_url": "https://...",
|
|
454
|
+
"name": "a.pdf",
|
|
455
|
+
"size": 12345,
|
|
456
|
+
"mime_type": "application/pdf"
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
To wire the result into a downstream command, parse the response with `jq`
|
|
461
|
+
or your scripting language of choice:
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
# Comment attachment — comment add takes file_token directly
|
|
465
|
+
TOKEN=$(meegle attachment +upload ./report.pdf --resource-type 13 \
|
|
466
|
+
--project-key PROJ --work-item-id 12345 | jq -r '.file_token')
|
|
467
|
+
meegle comment add --work-item-id 12345 --content "See attached" --file-token "$TOKEN"
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
**Field-level attachment formats** (how to assemble `--fields` payloads):
|
|
471
|
+
|
|
472
|
+
- **Workitem attachment field** (`--resource-type 15`) — `field_value` is a
|
|
473
|
+
JSON *string* whose parsed form is `[{"name","type","size","fileToken"}]`.
|
|
474
|
+
Note: `fileToken` is camelCase (other backend fields are snake_case) and
|
|
475
|
+
`size` is a string, not a number.
|
|
476
|
+
- **Rich-text field / comment image** (`--resource-type 16` / `14`) — embed
|
|
477
|
+
images as ` <!-- file_token -->`.
|
|
478
|
+
- **Comment attachment** (`--resource-type 13`) — `comment add --file-token`
|
|
479
|
+
takes `file_token` directly.
|
|
480
|
+
|
|
364
481
|
### MQL Search
|
|
365
482
|
|
|
366
483
|
```bash
|
|
@@ -394,17 +511,6 @@ Each command takes parameters via `--flag-name`:
|
|
|
394
511
|
meegle workitem get --work-item-id 12345 --project-key PROJ
|
|
395
512
|
```
|
|
396
513
|
|
|
397
|
-
### Writing `fields[]` (Write Commands)
|
|
398
|
-
|
|
399
|
-
`workitem create`, `workitem update`, `workflow update-node`, and `subtask update` expect the `fields[]` payload. Pass it through `--params`:
|
|
400
|
-
|
|
401
|
-
```bash
|
|
402
|
-
--params '{"fields":[
|
|
403
|
-
{"field_key":"name","field_value":"Title"},
|
|
404
|
-
{"field_key":"priority","field_value":"P1"}
|
|
405
|
-
]}'
|
|
406
|
-
```
|
|
407
|
-
|
|
408
514
|
### --set key=value (Generic)
|
|
409
515
|
|
|
410
516
|
`--set` is an alternate syntax for writing **top-level** parameters — `--set key=value` is equivalent to typing `--key value`. Useful when scripting with a uniform `key=value` form, or for writing nested top-level params via dot-path. Values are auto-typed (int / float / bool / string).
|
|
@@ -420,15 +526,76 @@ meegle mywork todo --set action=this_week --set page_num=1
|
|
|
420
526
|
|
|
421
527
|
`--set` only writes **top-level** parameters. To write a work item's `fields[]`, use `--params '{"fields":[...]}'` (see below).
|
|
422
528
|
|
|
423
|
-
### --params JSON
|
|
529
|
+
### --params JSON
|
|
424
530
|
|
|
425
|
-
|
|
531
|
+
`--params` takes a JSON object; **each top-level key is merged in as a CLI flag**.
|
|
532
|
+
The key must be a valid flag of the current command — it is not a free-form payload.
|
|
533
|
+
|
|
534
|
+
```bash
|
|
535
|
+
# These two are equivalent:
|
|
536
|
+
meegle workitem get --work-item-id 12345 --project-key PROJ
|
|
537
|
+
meegle workitem get --params '{"work_item_id":12345,"project_key":"PROJ"}'
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
Use `--params` when:
|
|
541
|
+
|
|
542
|
+
- the value is a nested object or array (`fields[]`, `schedule{}`) — too awkward to inline as a flag
|
|
543
|
+
- you want to set many parameters at once, or feed a payload from a file (see `@file.json` below)
|
|
426
544
|
|
|
427
545
|
```bash
|
|
428
546
|
meegle workitem create --project-key PROJ --work-item-type story \
|
|
429
547
|
--params '{"fields":[{"field_key":"name","field_value":"Title"}]}'
|
|
430
548
|
```
|
|
431
549
|
|
|
550
|
+
#### Common pitfall: not every name is a top-level flag
|
|
551
|
+
|
|
552
|
+
Some values that *look* like top-level fields are actually work-item field
|
|
553
|
+
values, and must be wrapped in `fields[]` rather than placed at the top
|
|
554
|
+
level. For example, on `workitem update` the `priority` value belongs to
|
|
555
|
+
the work item's fields, not to the command's flags:
|
|
556
|
+
|
|
557
|
+
```bash
|
|
558
|
+
# ❌ "priority" is not a flag of workitem update — CLI prints a stderr warning, backend ignores it
|
|
559
|
+
meegle workitem update --work-item-id 12345 --params '{"priority":"P1"}'
|
|
560
|
+
|
|
561
|
+
# ✓ Wrap field values inside fields[]
|
|
562
|
+
meegle workitem update --work-item-id 12345 \
|
|
563
|
+
--params '{"fields":[{"field_key":"priority","field_value":"P1"}]}'
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
The CLI surfaces unknown top-level keys as a `validation.unknown_params`
|
|
567
|
+
list under `--dry-run`, and as a one-line stderr warning at run time. They
|
|
568
|
+
are still forwarded to the backend (in case your local tool-schema cache
|
|
569
|
+
is stale — refresh with `--refresh`).
|
|
570
|
+
|
|
571
|
+
Run `meegle workitem meta-fields --project-key PK --work-item-type TK`
|
|
572
|
+
to look up valid `field_key`s for a work item type.
|
|
573
|
+
|
|
574
|
+
#### Reading from a file (`@file.json`)
|
|
575
|
+
|
|
576
|
+
Inline JSON is unergonomic on Windows because CMD requires `\"` escaping
|
|
577
|
+
and PowerShell mangles backslashes when forwarding native-command arguments.
|
|
578
|
+
Prefix the value with `@` to load the JSON from a file instead — works
|
|
579
|
+
identically on macOS, Linux, and Windows shells:
|
|
580
|
+
|
|
581
|
+
```bash
|
|
582
|
+
# body.json:
|
|
583
|
+
# {"fields":[{"field_key":"name","field_value":"Optimize login flow"}]}
|
|
584
|
+
|
|
585
|
+
meegle workitem create --project-key PROJ --work-item-type story \
|
|
586
|
+
--params @body.json
|
|
587
|
+
|
|
588
|
+
# Absolute path also works
|
|
589
|
+
meegle workitem update --work-item-id 12345 --params @/tmp/patch.json
|
|
590
|
+
|
|
591
|
+
# PowerShell — same syntax, no escaping headaches
|
|
592
|
+
meegle workitem create --project-key PROJ --work-item-type story --params '@body.json'
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
The path is read with the OS's default encoding; both relative and absolute
|
|
596
|
+
paths are accepted. A missing file fails with `PARAM_INVALID`; a file whose
|
|
597
|
+
contents are not valid JSON fails with `INVALID_PARAMS_JSON`.
|
|
598
|
+
|
|
432
599
|
### Priority
|
|
433
600
|
|
|
434
601
|
When `--set`, `--params`, and regular flags are used together:
|
|
@@ -460,10 +627,11 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
460
627
|
| `--format` | `-o` | Output format: `json` (default), `table`, `ndjson`, `raw` |
|
|
461
628
|
| `--select` | | Field projection with dot paths |
|
|
462
629
|
| `--set` | | Set nested parameters (repeatable) |
|
|
463
|
-
| `--params` | `-P` | Full JSON parameter body |
|
|
630
|
+
| `--params` | `-P` | Full JSON parameter body; prefix with `@` to read from a file (e.g. `--params @body.json`) |
|
|
464
631
|
| `--dry-run` | | Render request without executing |
|
|
465
632
|
| `--verbose` | `-v` | Verbose output |
|
|
466
633
|
| `--profile` | | Use a specific configuration profile |
|
|
634
|
+
| `--refresh` | | Refresh cached commands from server (bypass the local 24 h cache) |
|
|
467
635
|
|
|
468
636
|
## Advanced Usage
|
|
469
637
|
|
|
@@ -604,10 +772,10 @@ Two well-known environment variables are read directly at CLI startup and overri
|
|
|
604
772
|
export MEEGLE_HOST=project.feishu.cn
|
|
605
773
|
export MEEGLE_USER_ACCESS_TOKEN=<your-user-token>
|
|
606
774
|
export MEEGLE_USER_AGENT=ci-runner # optional; appended to User-Agent, highest priority over config.user_agent
|
|
607
|
-
meegle workitem get
|
|
775
|
+
meegle workitem get --work-item-id 123
|
|
608
776
|
```
|
|
609
777
|
|
|
610
|
-
Either variable may be set independently. When
|
|
778
|
+
Either variable may be set independently. When `MEEGLE_USER_ACCESS_TOKEN` is set, the CLI bypasses the keychain and does not attempt to refresh on 401 — the caller is responsible for rotating the env value. Setting only `MEEGLE_HOST` (without a token) still uses the keychain-stored credentials.
|
|
611
779
|
|
|
612
780
|
### Custom Auth Header
|
|
613
781
|
|
package/README.zh-CN.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
## 为什么选择 Meegle CLI?
|
|
14
14
|
|
|
15
15
|
- **Agent 友好** — 附带一份 [AI Agent Skill](#ai-agent-skill),一条命令即可把 Meegle 操作手册喂给 Trae、Claude Code、Cursor、Windsurf、Gemini CLI 等主流 Agent。CLI 命令同时面向人类和 Agent 设计,结构化 JSON 输出、`--dry-run` 预览、`--device-code` 无 TTY 流程
|
|
16
|
-
- **覆盖完整** —
|
|
16
|
+
- **覆盖完整** — 13 个业务域(工作项、工作流、子任务、评论、工时、关联、我的工作、视图、图表、团队、用户、空间、附件),40+ 命令映射到 Meegle 核心能力
|
|
17
17
|
- **两层参数模型** — 日常用 `--flag-name` 轻便直接,复杂载荷(如 `fields[]`)用 `--params <json>` 兜底 —— 按场景选择合适粒度
|
|
18
18
|
- **输出格式灵活** — 支持 `json` / `table` / `ndjson` / `raw`,配合 `--select` 点路径投影可直接 pipe 给其他工具
|
|
19
19
|
- **默认安全** — 凭证存进系统 keychain、`${VAR}` 环境变量模板让 secret 不落地到 config 文件、多 profile 分离 staging / prod
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
| 📊 [图表](#chart--度量域) | 列出视图下的图表、查看图表详情 |
|
|
34
34
|
| 👥 [团队与用户](#team--user--人员域) | 列出团队、团队成员、搜索用户、查看当前登录身份 |
|
|
35
35
|
| 🗂️ [空间](#project--空间域) | 按关键词搜索空间 |
|
|
36
|
+
| 📎 [附件](#attachment--附件域) | 两段式上传/下载协议 —— `prepare-*` 基础命令 + `+upload` / `+download` 端到端快捷命令 |
|
|
36
37
|
| 🔐 [认证与配置](#认证) | OAuth 登录、Device Code 流程、多 profile 配置、环境变量注入 |
|
|
38
|
+
| 🔗 [URL 解析](#url--url-解析) | 离线解析飞书项目 / Meegle URL,输出 `url_kind` + 结构化字段 |
|
|
37
39
|
| 🤖 [Agent Skill](#ai-agent-skill) | 内置 skill 供 Trae / Claude Code / Cursor / Windsurf / Gemini / Copilot 使用 |
|
|
38
40
|
|
|
39
41
|
## 安装
|
|
@@ -219,6 +221,7 @@ Agent 会参考 skill,自动选择合适的 `meegle` 命令执行。配合 `--
|
|
|
219
221
|
| `view get` | 查看视图详情 |
|
|
220
222
|
| `view update-fixed` | 更新固定视图 |
|
|
221
223
|
| `view search` | 按名称搜索视图 |
|
|
224
|
+
| `view list-multi-project-workitems` | 查看全景视图(multiProjectView)下的工作项列表 |
|
|
222
225
|
|
|
223
226
|
### chart — 度量域
|
|
224
227
|
|
|
@@ -242,6 +245,15 @@ Agent 会参考 skill,自动选择合适的 `meegle` 命令执行。配合 `--
|
|
|
242
245
|
|------|------|
|
|
243
246
|
| `project search` | 搜索空间信息 |
|
|
244
247
|
|
|
248
|
+
### attachment — 附件域
|
|
249
|
+
|
|
250
|
+
| 命令 | 说明 |
|
|
251
|
+
|------|------|
|
|
252
|
+
| `attachment prepare-upload` | 上传预处理 —— 返回带签名的对象存储 URL 与分片计划 |
|
|
253
|
+
| `attachment prepare-download` | 下载预处理 —— 返回带签名的对象存储 URL 与分片计划 |
|
|
254
|
+
| `attachment +upload` | 端到端上传:预处理 + 签名 HTTP POST,返回 `file_token` 与文件元信息 |
|
|
255
|
+
| `attachment +download` | 端到端下载:预处理 + 签名 HTTP GET + 原子写文件,用于消费 `workitem get` / `comment list` 返回的 `file_url` |
|
|
256
|
+
|
|
245
257
|
### auth — 认证域
|
|
246
258
|
|
|
247
259
|
| 命令 | 说明 |
|
|
@@ -260,6 +272,14 @@ Agent 会参考 skill,自动选择合适的 `meegle` 命令执行。配合 `--
|
|
|
260
272
|
| `config get` | 读取配置项 |
|
|
261
273
|
| `config profile create\|list\|use\|current\|delete` | 管理多环境 profile |
|
|
262
274
|
|
|
275
|
+
### url — URL 解析
|
|
276
|
+
|
|
277
|
+
离线、纯本地的 URL 解析工具,不发起任何网络调用。Skill 或 pipeline 解析飞书项目/Meegle URL 时优先走本命令,拿 `url_kind` 做分支,避免从原始路径猜字段。
|
|
278
|
+
|
|
279
|
+
| 命令 | 说明 |
|
|
280
|
+
|------|------|
|
|
281
|
+
| `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"`。 |
|
|
282
|
+
|
|
263
283
|
### 其他命令
|
|
264
284
|
|
|
265
285
|
| 命令 | 说明 |
|
|
@@ -297,8 +317,8 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
297
317
|
|
|
298
318
|
`workitem +batch-get` 会对每个 ID 分别调用 `workitem get` 并把结果聚合成一条响应。
|
|
299
319
|
共享 flag(如 `--project-key`)会应用到每一次 per-item 调用上。命令以 `+` 开头,
|
|
300
|
-
|
|
301
|
-
|
|
320
|
+
表示它是客户端侧的场景/语法糖命令,CLI 在 `get` 之上组合出批量语义,没有对应的
|
|
321
|
+
单一后端接口。
|
|
302
322
|
|
|
303
323
|
```bash
|
|
304
324
|
# 在一次调用里传入逗号分隔的多个 ID
|
|
@@ -360,6 +380,96 @@ meegle workitem update --work-item-id 12345 \
|
|
|
360
380
|
]}'
|
|
361
381
|
```
|
|
362
382
|
|
|
383
|
+
### 附件上传 / 下载
|
|
384
|
+
|
|
385
|
+
`attachment` 域把飞书项目的两段式附件协议拆成两层暴露:
|
|
386
|
+
|
|
387
|
+
- **基础命令**(`attachment prepare-upload` / `attachment prepare-download`)
|
|
388
|
+
返回带签名的 URL 预处理结果——适合自己写脚本做 HTTP 传输或调试分片计划。
|
|
389
|
+
- **快捷命令**(`attachment +upload` / `attachment +download`)把基础预处理与
|
|
390
|
+
签名后的对象存储 HTTP POST/GET 在客户端组合成端到端流程。`+` 前缀表示这是
|
|
391
|
+
场景命令——CLI 在客户端把预处理输出与字节传输串起来。
|
|
392
|
+
|
|
393
|
+
`--resource-type` 告诉后端这次上传/下载是给什么场景用:
|
|
394
|
+
|
|
395
|
+
| `--resource-type` | 用途 |
|
|
396
|
+
|-------------------|------|
|
|
397
|
+
| `15` | 工作项附件字段 |
|
|
398
|
+
| `16` | 工作项富文本字段里的图片 |
|
|
399
|
+
| `13` | 评论附件 |
|
|
400
|
+
| `14` | 评论正文里的图片 |
|
|
401
|
+
|
|
402
|
+
**上传作用域**:每次上传需要 `--work-item-id` 或 `--work-item-type` 之一。
|
|
403
|
+
**只要工作项已经存在,就优先用 `--work-item-id`**(update / comment 场景);
|
|
404
|
+
只有创建时带附件这种"工作项还不存在"的场景才用 `--work-item-type`。两者都传时,
|
|
405
|
+
`--work-item-id` 胜出,`--work-item-type` 被静默丢弃。
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
# 为工作项附件字段上传文件 (resource-type 15)
|
|
409
|
+
meegle attachment +upload ./a.pdf \
|
|
410
|
+
--resource-type 15 \
|
|
411
|
+
--project-key PROJ --work-item-id 12345 --field-key files_field
|
|
412
|
+
|
|
413
|
+
# 创建时带附件场景 —— 工作项还不存在,用 --work-item-type
|
|
414
|
+
meegle attachment +upload ./a.pdf \
|
|
415
|
+
--resource-type 15 \
|
|
416
|
+
--project-key PROJ --work-item-type story --field-key files_field
|
|
417
|
+
|
|
418
|
+
# 为富文本字段上传图片 (resource-type 16)
|
|
419
|
+
meegle attachment +upload ./diagram.png \
|
|
420
|
+
--resource-type 16 \
|
|
421
|
+
--project-key PROJ --work-item-id 12345 --field-key spec_field
|
|
422
|
+
|
|
423
|
+
# 为评论上传附件 (resource-type 13)
|
|
424
|
+
meegle attachment +upload ./report.pdf \
|
|
425
|
+
--resource-type 13 \
|
|
426
|
+
--project-key PROJ --work-item-id 12345
|
|
427
|
+
|
|
428
|
+
# 为评论上传图片 (resource-type 14)
|
|
429
|
+
meegle attachment +upload ./screen.png \
|
|
430
|
+
--resource-type 14 \
|
|
431
|
+
--project-key PROJ --work-item-id 12345
|
|
432
|
+
|
|
433
|
+
# 下载:把其他命令响应里的 opaque file_url 直接传进来。
|
|
434
|
+
URL=$(meegle workitem get --project-key PROJ --work-item-id 12345 \
|
|
435
|
+
--fields files_field --format json \
|
|
436
|
+
| jq -r '.fields.files_field[0].url')
|
|
437
|
+
meegle attachment +download "$URL" \
|
|
438
|
+
--project-key PROJ --work-item-id 12345 \
|
|
439
|
+
--output ./local.pdf --overwrite
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
`+upload` 输出 JSON 对象,包含 file_token 与文件元信息:
|
|
443
|
+
|
|
444
|
+
```json
|
|
445
|
+
{
|
|
446
|
+
"file_token": "...",
|
|
447
|
+
"file_url": "https://...",
|
|
448
|
+
"name": "a.pdf",
|
|
449
|
+
"size": 12345,
|
|
450
|
+
"mime_type": "application/pdf"
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
要把结果拼到下游命令里,用 `jq` 或脚本语言提取所需字段:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
# 评论附件 —— comment add 直接接收 file_token
|
|
458
|
+
TOKEN=$(meegle attachment +upload ./report.pdf --resource-type 13 \
|
|
459
|
+
--project-key PROJ --work-item-id 12345 | jq -r '.file_token')
|
|
460
|
+
meegle comment add --work-item-id 12345 --content "看附件" --file-token "$TOKEN"
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**字段级回灌格式**(拼接 `--fields` 时参考):
|
|
464
|
+
|
|
465
|
+
- **工作项附件字段** (`--resource-type 15`) —— `field_value` 是 JSON *字符串*,
|
|
466
|
+
解析后是 `[{"name","type","size","fileToken"}]`。注意:`fileToken` 是驼峰(其他
|
|
467
|
+
后端字段都是蛇形),`size` 是字符串不是数字。
|
|
468
|
+
- **富文本字段 / 评论图片** (`--resource-type 16` / `14`) —— 图片用
|
|
469
|
+
` <!-- file_token -->` 的 markdown 嵌入。
|
|
470
|
+
- **评论附件** (`--resource-type 13`) —— `comment add --file-token` 直接接收
|
|
471
|
+
`file_token`。
|
|
472
|
+
|
|
363
473
|
### MQL 搜索
|
|
364
474
|
|
|
365
475
|
```bash
|
|
@@ -393,17 +503,6 @@ meegle user search --user-keys "张三,李四" --project-key PROJ
|
|
|
393
503
|
meegle workitem get --work-item-id 12345 --project-key PROJ
|
|
394
504
|
```
|
|
395
505
|
|
|
396
|
-
### 写 `fields[]`(写入命令)
|
|
397
|
-
|
|
398
|
-
`workitem create`、`workitem update`、`workflow update-node`、`subtask update` 需要传 `fields[]`,通过 `--params` 走:
|
|
399
|
-
|
|
400
|
-
```bash
|
|
401
|
-
--params '{"fields":[
|
|
402
|
-
{"field_key":"name","field_value":"标题"},
|
|
403
|
-
{"field_key":"priority","field_value":"P1"}
|
|
404
|
-
]}'
|
|
405
|
-
```
|
|
406
|
-
|
|
407
506
|
### --set key=value(通用)
|
|
408
507
|
|
|
409
508
|
`--set` 是普通 flag 的**替代写法**,只影响**顶层参数**:`--set key=value` 等价于 `--key value`。适合在脚本里用统一的 key=value 语法,或通过 dot-path 写嵌套顶层对象。值自动类型推断(int / float / bool / string)。
|
|
@@ -419,15 +518,70 @@ meegle mywork todo --set action=this_week --set page_num=1
|
|
|
419
518
|
|
|
420
519
|
`--set` 只写**顶层参数**,**不会**写到工作项的 `fields[]`。写 `fields[]` 请用 `--params '{"fields":[...]}'`(见下)。
|
|
421
520
|
|
|
422
|
-
### --params JSON
|
|
521
|
+
### --params JSON
|
|
522
|
+
|
|
523
|
+
`--params` 接收一个 JSON 对象,**每个顶层 key 都会作为 CLI flag 合并进来**。
|
|
524
|
+
顶层 key 必须是当前命令的合法 flag —— 它不是一份自由结构的载荷。
|
|
423
525
|
|
|
424
|
-
|
|
526
|
+
```bash
|
|
527
|
+
# 下面两条等价:
|
|
528
|
+
meegle workitem get --work-item-id 12345 --project-key PROJ
|
|
529
|
+
meegle workitem get --params '{"work_item_id":12345,"project_key":"PROJ"}'
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
什么时候用 `--params`:
|
|
533
|
+
|
|
534
|
+
- 值是嵌套对象或数组(`fields[]`、`schedule{}`),直接写 flag 太别扭
|
|
535
|
+
- 想一次性批量传多个参数,或者从文件加载载荷(见下方 `@file.json`)
|
|
425
536
|
|
|
426
537
|
```bash
|
|
427
538
|
meegle workitem create --project-key PROJ --work-item-type story \
|
|
428
539
|
--params '{"fields":[{"field_key":"name","field_value":"标题"}]}'
|
|
429
540
|
```
|
|
430
541
|
|
|
542
|
+
#### 常见误用:不是所有名字都是顶层 flag
|
|
543
|
+
|
|
544
|
+
有些**看起来像**顶层字段的值,其实是工作项的字段值,必须包在 `fields[]`
|
|
545
|
+
里,而不是放在顶层。比如 `workitem update` 时,`priority` 属于工作项字段,
|
|
546
|
+
不是命令的 flag:
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
# ❌ "priority" 不是 workitem update 的合法 flag —— CLI 会在 stderr 输出 warning,后端忽略
|
|
550
|
+
meegle workitem update --work-item-id 12345 --params '{"priority":"P1"}'
|
|
551
|
+
|
|
552
|
+
# ✓ 字段值要包在 fields[] 里
|
|
553
|
+
meegle workitem update --work-item-id 12345 \
|
|
554
|
+
--params '{"fields":[{"field_key":"priority","field_value":"P1"}]}'
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
不在工具声明 flag 列表里的顶层 key,在 `--dry-run` 输出里会以
|
|
558
|
+
`validation.unknown_params` 列出,运行时则会向 stderr 打一行
|
|
559
|
+
warning。它们仍然会被原样转发给后端(防止本地工具 schema 缓存陈旧
|
|
560
|
+
误判,需要时用 `--refresh` 刷新)。
|
|
561
|
+
|
|
562
|
+
通过 `meegle workitem meta-fields --project-key PK --work-item-type TK`
|
|
563
|
+
查询某种工作项类型下合法的 `field_key`。
|
|
564
|
+
|
|
565
|
+
#### 从文件读取(`@file.json`)
|
|
566
|
+
|
|
567
|
+
Windows 上内联 JSON 体验很糟:CMD 必须把 `"` 写成 `\"`,PowerShell 把转义反斜杠传给原生命令时还会再吞一层。给 `--params` 加 `@` 前缀即可改为从文件读取,macOS、Linux、Windows 各种 shell 都能一致工作:
|
|
568
|
+
|
|
569
|
+
```bash
|
|
570
|
+
# body.json:
|
|
571
|
+
# {"fields":[{"field_key":"name","field_value":"优化登录流程"}]}
|
|
572
|
+
|
|
573
|
+
meegle workitem create --project-key PROJ --work-item-type story \
|
|
574
|
+
--params @body.json
|
|
575
|
+
|
|
576
|
+
# 绝对路径同样支持
|
|
577
|
+
meegle workitem update --work-item-id 12345 --params @/tmp/patch.json
|
|
578
|
+
|
|
579
|
+
# PowerShell 用法相同,无需任何转义
|
|
580
|
+
meegle workitem create --project-key PROJ --work-item-type story --params '@body.json'
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
读取走系统默认编码,相对路径与绝对路径都接受。文件不存在会返回 `PARAM_INVALID`;文件内容不是合法 JSON 会返回 `INVALID_PARAMS_JSON`。
|
|
584
|
+
|
|
431
585
|
### 优先级
|
|
432
586
|
|
|
433
587
|
当 `--set`、`--params` 和普通 flag 同时使用时:
|
|
@@ -459,10 +613,11 @@ meegle workflow get-node --work-item-id 12345 --need-sub-task
|
|
|
459
613
|
| `--format` | `-o` | 输出格式:`json`(默认)、`table`、`ndjson`、`raw` |
|
|
460
614
|
| `--select` | | 字段投影(支持 dot path) |
|
|
461
615
|
| `--set` | | 设置嵌套参数(可重复) |
|
|
462
|
-
| `--params` | `-P` | 完整 JSON
|
|
616
|
+
| `--params` | `-P` | 完整 JSON 参数体;以 `@` 开头改为从文件读取(如 `--params @body.json`) |
|
|
463
617
|
| `--dry-run` | | 只渲染请求,不实际执行 |
|
|
464
618
|
| `--verbose` | `-v` | 详细输出 |
|
|
465
619
|
| `--profile` | | 指定配置 profile |
|
|
620
|
+
| `--refresh` | | 从服务端刷新本地命令缓存(旁路 24 小时缓存) |
|
|
466
621
|
|
|
467
622
|
## 进阶用法
|
|
468
623
|
|
|
@@ -594,10 +749,10 @@ meegle config get host
|
|
|
594
749
|
export MEEGLE_HOST=project.feishu.cn
|
|
595
750
|
export MEEGLE_USER_ACCESS_TOKEN=<your-user-token>
|
|
596
751
|
export MEEGLE_USER_AGENT=ci-runner # 可选;追加到 User-Agent,优先级高于 config.user_agent
|
|
597
|
-
meegle workitem get
|
|
752
|
+
meegle workitem get --work-item-id 123
|
|
598
753
|
```
|
|
599
754
|
|
|
600
|
-
|
|
755
|
+
任一变量可以单独设置。当 `MEEGLE_USER_ACCESS_TOKEN` 设置时,CLI 不访问 keychain,401 错误不会自动 refresh,由调用方自行轮转。仅设置 `MEEGLE_HOST`(不带 token)时仍走 keychain 中存储的凭证。
|
|
601
756
|
|
|
602
757
|
### 自定义 Auth Header
|
|
603
758
|
|
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/bin/meegle.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-project/meegle",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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
|
},
|