@lark-project/meegle 1.0.1 → 1.0.3

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 CHANGED
@@ -8,6 +8,23 @@ versioned section on each npm release.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [v1.0.3] - 2026-05-18
12
+
13
+ ### Fixed
14
+
15
+ - `User-Agent` now reports the semantic version injected via `-ldflags "-X main.version=..."` (e.g. `meegle-cli/1.0.3`) instead of Go's `debug.ReadBuildInfo()` pseudo-version. Previously backends observed UAs like `meegle-cli/v0.0.0-20260417123425-9973fd9cecc4+dirty` whenever a build was made off a non-tagged commit or with uncommitted files in the worktree, making per-version traffic attribution unreliable on the server-side dashboard. The fix landed on `main` after the v1.0.2 release commit was tagged and published, so the CHANGELOG entry was retroactively moved out of the v1.0.2 section to match what npm actually shipped
16
+
17
+ ## [v1.0.2] - 2026-05-14
18
+
19
+ ### Added
20
+
21
+ - 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)
22
+ - 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`)
23
+
24
+ ### Changed
25
+
26
+ - 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[]`
27
+
11
28
  ## [v1.0.1] - 2026-04-28
12
29
 
13
30
  ### Added
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** — 12 business domains (work items, workflow, subtasks, comments, work hours, relations, my-work, views, charts, team, user, project) and 40+ commands mapping to Meegle's core capabilities
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,6 +33,7 @@ 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 |
37
38
  | 🔗 [URL Parsing](#url--url-parsing) | Offline decode of Meegle / Feishu Project URLs into `url_kind` + structured fields |
38
39
  | 🤖 [Agent Skill](#ai-agent-skill) | Pre-built skill for Trae / Claude Code / Cursor / Windsurf / Gemini CLI / Copilot |
@@ -220,6 +221,7 @@ The agent consults the skill, picks the right `meegle` commands, and runs them f
220
221
  | `view get` | View details of a view |
221
222
  | `view update-fixed` | Update a fixed view |
222
223
  | `view search` | Search views by name |
224
+ | `view list-multi-project-workitems` | List work items under a multi-project (panoramic) view |
223
225
 
224
226
  ### chart — Charts
225
227
 
@@ -509,17 +511,6 @@ Each command takes parameters via `--flag-name`:
509
511
  meegle workitem get --work-item-id 12345 --project-key PROJ
510
512
  ```
511
513
 
512
- ### Writing `fields[]` (Write Commands)
513
-
514
- `workitem create`, `workitem update`, `workflow update-node`, and `subtask update` expect the `fields[]` payload. Pass it through `--params`:
515
-
516
- ```bash
517
- --params '{"fields":[
518
- {"field_key":"name","field_value":"Title"},
519
- {"field_key":"priority","field_value":"P1"}
520
- ]}'
521
- ```
522
-
523
514
  ### --set key=value (Generic)
524
515
 
525
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).
@@ -535,15 +526,51 @@ meegle mywork todo --set action=this_week --set page_num=1
535
526
 
536
527
  `--set` only writes **top-level** parameters. To write a work item's `fields[]`, use `--params '{"fields":[...]}'` (see below).
537
528
 
538
- ### --params JSON (Fallback)
529
+ ### --params JSON
539
530
 
540
- All commands support `--params` to pass a full JSON parameter body:
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)
541
544
 
542
545
  ```bash
543
546
  meegle workitem create --project-key PROJ --work-item-type story \
544
547
  --params '{"fields":[{"field_key":"name","field_value":"Title"}]}'
545
548
  ```
546
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
+
547
574
  #### Reading from a file (`@file.json`)
548
575
 
549
576
  Inline JSON is unergonomic on Windows because CMD requires `\"` escaping
@@ -748,7 +775,7 @@ export MEEGLE_USER_AGENT=ci-runner # optional; appended to User-Agent, highest
748
775
  meegle workitem get --work-item-id 123
749
776
  ```
750
777
 
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.
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.
752
779
 
753
780
  ### Custom Auth Header
754
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
- - **覆盖完整** — 12 个业务域(工作项、工作流、子任务、评论、工时、关联、我的工作、视图、图表、团队、用户、空间),40+ 命令映射到 Meegle 核心能力
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,6 +33,7 @@
33
33
  | 📊 [图表](#chart--度量域) | 列出视图下的图表、查看图表详情 |
34
34
  | 👥 [团队与用户](#team--user--人员域) | 列出团队、团队成员、搜索用户、查看当前登录身份 |
35
35
  | 🗂️ [空间](#project--空间域) | 按关键词搜索空间 |
36
+ | 📎 [附件](#attachment--附件域) | 两段式上传/下载协议 —— `prepare-*` 基础命令 + `+upload` / `+download` 端到端快捷命令 |
36
37
  | 🔐 [认证与配置](#认证) | OAuth 登录、Device Code 流程、多 profile 配置、环境变量注入 |
37
38
  | 🔗 [URL 解析](#url--url-解析) | 离线解析飞书项目 / Meegle URL,输出 `url_kind` + 结构化字段 |
38
39
  | 🤖 [Agent Skill](#ai-agent-skill) | 内置 skill 供 Trae / Claude Code / Cursor / Windsurf / Gemini / Copilot 使用 |
@@ -220,6 +221,7 @@ Agent 会参考 skill,自动选择合适的 `meegle` 命令执行。配合 `--
220
221
  | `view get` | 查看视图详情 |
221
222
  | `view update-fixed` | 更新固定视图 |
222
223
  | `view search` | 按名称搜索视图 |
224
+ | `view list-multi-project-workitems` | 查看全景视图(multiProjectView)下的工作项列表 |
223
225
 
224
226
  ### chart — 度量域
225
227
 
@@ -501,17 +503,6 @@ meegle user search --user-keys "张三,李四" --project-key PROJ
501
503
  meegle workitem get --work-item-id 12345 --project-key PROJ
502
504
  ```
503
505
 
504
- ### 写 `fields[]`(写入命令)
505
-
506
- `workitem create`、`workitem update`、`workflow update-node`、`subtask update` 需要传 `fields[]`,通过 `--params` 走:
507
-
508
- ```bash
509
- --params '{"fields":[
510
- {"field_key":"name","field_value":"标题"},
511
- {"field_key":"priority","field_value":"P1"}
512
- ]}'
513
- ```
514
-
515
506
  ### --set key=value(通用)
516
507
 
517
508
  `--set` 是普通 flag 的**替代写法**,只影响**顶层参数**:`--set key=value` 等价于 `--key value`。适合在脚本里用统一的 key=value 语法,或通过 dot-path 写嵌套顶层对象。值自动类型推断(int / float / bool / string)。
@@ -527,15 +518,50 @@ meegle mywork todo --set action=this_week --set page_num=1
527
518
 
528
519
  `--set` 只写**顶层参数**,**不会**写到工作项的 `fields[]`。写 `fields[]` 请用 `--params '{"fields":[...]}'`(见下)。
529
520
 
530
- ### --params JSON(兜底)
521
+ ### --params JSON
522
+
523
+ `--params` 接收一个 JSON 对象,**每个顶层 key 都会作为 CLI flag 合并进来**。
524
+ 顶层 key 必须是当前命令的合法 flag —— 它不是一份自由结构的载荷。
525
+
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`:
531
533
 
532
- 所有命令都支持 `--params` 传入完整 JSON 参数:
534
+ - 值是嵌套对象或数组(`fields[]`、`schedule{}`),直接写 flag 太别扭
535
+ - 想一次性批量传多个参数,或者从文件加载载荷(见下方 `@file.json`)
533
536
 
534
537
  ```bash
535
538
  meegle workitem create --project-key PROJ --work-item-type story \
536
539
  --params '{"fields":[{"field_key":"name","field_value":"标题"}]}'
537
540
  ```
538
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
+
539
565
  #### 从文件读取(`@file.json`)
540
566
 
541
567
  Windows 上内联 JSON 体验很糟:CMD 必须把 `"` 写成 `\"`,PowerShell 把转义反斜杠传给原生命令时还会再吞一层。给 `--params` 加 `@` 前缀即可改为从文件读取,macOS、Linux、Windows 各种 shell 都能一致工作:
@@ -726,7 +752,7 @@ export MEEGLE_USER_AGENT=ci-runner # 可选;追加到 User-Agent,优先级
726
752
  meegle workitem get --work-item-id 123
727
753
  ```
728
754
 
729
- 任一变量可以单独设置。走这个路径时 CLI 不访问 keychain,401 错误不会自动 refresh,由调用方自行轮转。
755
+ 任一变量可以单独设置。当 `MEEGLE_USER_ACCESS_TOKEN` 设置时,CLI 不访问 keychain,401 错误不会自动 refresh,由调用方自行轮转。仅设置 `MEEGLE_HOST`(不带 token)时仍走 keychain 中存储的凭证。
730
756
 
731
757
  ### 自定义 Auth Header
732
758
 
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-project/meegle",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Agent-First CLI for Meegle (Lark Project)",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/larksuite/meegle-cli#readme",