@amaster.ai/pi-lark 0.1.8 → 0.1.10

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.
Files changed (155) hide show
  1. package/README.md +1 -3
  2. package/package.json +2 -2
  3. package/skills/lark-apps/SKILL.md +3 -1
  4. package/skills/lark-apps/references/lark-apps-cache.md +38 -5
  5. package/skills/lark-apps/references/lark-apps-db.md +130 -2
  6. package/skills/lark-apps/references/lark-apps-user-id-convert.md +63 -0
  7. package/skills/lark-base/SKILL.md +172 -167
  8. package/skills/lark-base/references/{lark-base-role-guide.md → lark-base-advanced-permission-and-role.md} +5 -5
  9. package/skills/lark-base/references/lark-base-app-block-data-config.md +122 -0
  10. package/skills/lark-base/references/lark-base-app.md +243 -0
  11. package/skills/lark-base/references/lark-base-cell-value.md +26 -19
  12. package/skills/lark-base/references/{dashboard-block-data-config.md → lark-base-dashboard-block-config.md} +65 -6
  13. package/skills/lark-base/references/lark-base-dashboard-block-get-data.md +1 -1
  14. package/skills/lark-base/references/lark-base-dashboard.md +38 -20
  15. package/skills/lark-base/references/lark-base-data-analysis-pandas.md +93 -0
  16. package/skills/lark-base/references/lark-base-data-analysis-python-stdlib.md +120 -0
  17. package/skills/lark-base/references/lark-base-data-query.md +8 -11
  18. package/skills/lark-base/references/lark-base-field-create.md +7 -50
  19. package/skills/lark-base/references/{formula-field-guide.md → lark-base-field-formula.md} +1 -1
  20. package/skills/lark-base/references/{lookup-field-guide.md → lark-base-field-lookup.md} +1 -1
  21. package/skills/lark-base/references/{lark-base-field-json.md → lark-base-field-schema.md} +25 -101
  22. package/skills/lark-base/references/lark-base-field-update.md +13 -51
  23. package/skills/lark-base/references/lark-base-filter-condition.md +19 -31
  24. package/skills/lark-base/references/lark-base-form-questions-create.md +36 -5
  25. package/skills/lark-base/references/lark-base-record-batch-create.md +5 -1
  26. package/skills/lark-base/references/lark-base-record-batch-update.md +5 -2
  27. package/skills/lark-base/references/lark-base-record-history-list.md +19 -2
  28. package/skills/lark-base/references/lark-base-record-query-and-analysis-cloud-sop.md +145 -0
  29. package/skills/lark-base/references/lark-base-record-query-and-analysis-sop.md +233 -0
  30. package/skills/lark-base/references/{role-config.md → lark-base-role-config.md} +2 -2
  31. package/skills/lark-base/references/lark-base-template-center.md +195 -0
  32. package/skills/lark-base/references/lark-base-view-set-filter.md +1 -1
  33. package/skills/lark-base/references/lark-base-workflow-schema.md +2 -2
  34. package/skills/lark-base/references/{lark-base-workflow-guide.md → lark-base-workflow.md} +1 -1
  35. package/skills/lark-calendar/SKILL.md +11 -6
  36. package/skills/lark-calendar/references/lark-calendar-create.md +4 -3
  37. package/skills/lark-calendar/references/lark-calendar-transfer.md +89 -0
  38. package/skills/lark-doc/SKILL.md +3 -3
  39. package/skills/lark-doc/references/lark-doc-fetch.md +9 -4
  40. package/skills/lark-doc/references/lark-doc-update.md +12 -8
  41. package/skills/lark-drive/SKILL.md +5 -3
  42. package/skills/lark-drive/references/lark-drive-add-comment.md +2 -2
  43. package/skills/lark-drive/references/lark-drive-download.md +27 -1
  44. package/skills/lark-drive/references/lark-drive-export.md +1 -0
  45. package/skills/lark-drive/references/lark-drive-member-remove.md +59 -0
  46. package/skills/lark-drive/references/lark-drive-preview.md +21 -2
  47. package/skills/lark-drive/references/lark-drive-push.md +5 -1
  48. package/skills/lark-drive/references/lark-drive-search.md +2 -0
  49. package/skills/lark-im/SKILL.md +14 -3
  50. package/skills/lark-im/references/lark-im-message-read-status.md +96 -0
  51. package/skills/lark-mail/references/lark-mail-draft-create.md +12 -12
  52. package/skills/lark-mail/references/lark-mail-forward.md +17 -17
  53. package/skills/lark-mail/references/lark-mail-reply-all.md +8 -8
  54. package/skills/lark-mail/references/lark-mail-reply.md +6 -6
  55. package/skills/lark-mail/references/lark-mail-send.md +20 -20
  56. package/skills/lark-mail/references/lark-mail-template-create.md +7 -6
  57. package/skills/lark-mail/references/lark-mail-template-update.md +7 -6
  58. package/skills/lark-meeting/SKILL.md +146 -0
  59. package/skills/lark-meeting/references/lark-minutes-apply-permission.md +92 -0
  60. package/skills/lark-meeting/references/lark-minutes-detail.md +52 -0
  61. package/skills/{lark-minutes → lark-meeting}/references/lark-minutes-download.md +7 -7
  62. package/skills/{lark-minutes → lark-meeting}/references/lark-minutes-search.md +4 -34
  63. package/skills/{lark-minutes → lark-meeting}/references/lark-minutes-speaker-replace.md +3 -4
  64. package/skills/{lark-minutes → lark-meeting}/references/lark-minutes-summary.md +2 -5
  65. package/skills/{lark-minutes → lark-meeting}/references/lark-minutes-todo.md +5 -15
  66. package/skills/{lark-minutes → lark-meeting}/references/lark-minutes-update.md +2 -3
  67. package/skills/lark-meeting/references/lark-minutes-upload.md +65 -0
  68. package/skills/lark-meeting/references/lark-note-detail.md +15 -0
  69. package/skills/{lark-note → lark-meeting}/references/lark-note-transcript.md +5 -9
  70. package/skills/{lark-vc-agent → lark-meeting}/references/lark-vc-agent-meeting-join.md +4 -55
  71. package/skills/{lark-vc-agent → lark-meeting}/references/lark-vc-agent-meeting-leave.md +2 -41
  72. package/skills/lark-meeting/references/lark-vc-detail.md +31 -0
  73. package/skills/{lark-vc-agent/references/lark-vc-agent-meeting-events.md → lark-meeting/references/lark-vc-meeting-events.md} +120 -109
  74. package/skills/{lark-vc-agent/references/lark-vc-agent-meeting-list-active.md → lark-meeting/references/lark-vc-meeting-list-active.md} +4 -29
  75. package/skills/{lark-vc-agent/references/lark-vc-agent-meeting-message-send.md → lark-meeting/references/lark-vc-meeting-message-send.md} +3 -5
  76. package/skills/{lark-vc → lark-meeting}/references/lark-vc-recording.md +5 -64
  77. package/skills/{lark-vc → lark-meeting}/references/lark-vc-search.md +9 -28
  78. package/skills/lark-meeting/scenes/create-and-edit-minutes.md +125 -0
  79. package/skills/lark-meeting/scenes/live-meeting-attend.md +107 -0
  80. package/skills/lark-meeting/scenes/live-meeting-interact.md +72 -0
  81. package/skills/lark-meeting/scenes/query-meeting-and-artifacts.md +90 -0
  82. package/skills/lark-meeting/scenes/query-minutes-and-artifacts.md +70 -0
  83. package/skills/lark-meeting/scenes/query-note-and-artifacts.md +127 -0
  84. package/skills/lark-minutes/SKILL.md +5 -197
  85. package/skills/lark-note/SKILL.md +5 -84
  86. package/skills/lark-shared/SKILL.md +25 -188
  87. package/skills/lark-shared/references/lark-shared-config-init.md +12 -0
  88. package/skills/lark-shared/references/lark-shared-high-risk-approval.md +38 -0
  89. package/skills/lark-shared/references/lark-shared-identity-and-permissions.md +105 -0
  90. package/skills/lark-shared/references/lark-shared-output-contract.md +17 -0
  91. package/skills/lark-shared/references/lark-shared-update-notice.md +23 -0
  92. package/skills/lark-slides/SKILL.md +56 -54
  93. package/skills/lark-slides/references/cli/lark-slides-add-slide.md +92 -0
  94. package/skills/lark-slides/references/cli/lark-slides-create.md +176 -0
  95. package/skills/lark-slides/references/cli/lark-slides-delete-slide.md +65 -0
  96. package/skills/lark-slides/references/cli/lark-slides-history.md +132 -0
  97. package/skills/lark-slides/references/cli/lark-slides-media-upload.md +103 -0
  98. package/skills/lark-slides/references/cli/lark-slides-replace-slide.md +259 -0
  99. package/skills/lark-slides/references/cli/lark-slides-screenshot.md +115 -0
  100. package/skills/lark-slides/references/{lark-slides-update-slide.md → cli/lark-slides-update-slide.md} +21 -4
  101. package/skills/lark-slides/references/cli/lark-slides-xml-presentation-slide-get.md +110 -0
  102. package/skills/lark-slides/references/cli/lark-slides-xml-presentation-slide-replace.md +188 -0
  103. package/skills/lark-slides/references/cli/lark-slides-xml-presentations-get.md +157 -0
  104. package/skills/lark-slides/references/iconpark-index.json +5 -41901
  105. package/skills/lark-slides/references/iconpark.md +3 -44
  106. package/skills/lark-slides/references/lark-slides-add-slide.md +3 -90
  107. package/skills/lark-slides/references/lark-slides-create.md +3 -174
  108. package/skills/lark-slides/references/lark-slides-delete-slide.md +3 -63
  109. package/skills/lark-slides/references/lark-slides-edit-workflows.md +3 -141
  110. package/skills/lark-slides/references/lark-slides-history.md +3 -130
  111. package/skills/lark-slides/references/lark-slides-media-upload.md +3 -102
  112. package/skills/lark-slides/references/lark-slides-pptx-template-workflows.md +3 -83
  113. package/skills/lark-slides/references/lark-slides-replace-slide.md +3 -256
  114. package/skills/lark-slides/references/lark-slides-screenshot.md +3 -113
  115. package/skills/lark-slides/references/lark-slides-xml-presentation-slide-get.md +3 -108
  116. package/skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md +3 -186
  117. package/skills/lark-slides/references/lark-slides-xml-presentations-get.md +3 -155
  118. package/skills/lark-slides/references/planning-layer.md +1 -1
  119. package/skills/lark-slides/references/slides_chart_demo.xml +5 -1415
  120. package/skills/lark-slides/references/slides_xml_schema_definition.xml +3 -3512
  121. package/skills/lark-slides/references/troubleshooting.md +3 -60
  122. package/skills/lark-slides/references/validation-checklist.md +3 -154
  123. package/skills/lark-slides/references/workflow/error-handling.md +62 -0
  124. package/skills/lark-slides/references/workflow/slides-editing.md +143 -0
  125. package/skills/lark-slides/references/workflow/template-editing.md +85 -0
  126. package/skills/lark-slides/references/workflow/validation-xml.md +156 -0
  127. package/skills/lark-slides/references/xml/iconpark-index.json +37458 -0
  128. package/skills/lark-slides/references/xml/iconpark.md +46 -0
  129. package/skills/lark-slides/references/xml/slides_chart_demo.xml +1415 -0
  130. package/skills/lark-slides/references/xml/slides_xml_schema_definition.xml +3601 -0
  131. package/skills/lark-slides/references/xml/xml-schema-quick-ref.md +497 -0
  132. package/skills/lark-slides/references/xml-schema-quick-ref.md +3 -495
  133. package/skills/lark-slides/scripts/iconpark_tool.py +1 -1
  134. package/skills/lark-slides/scripts/xml_lint.py +2989 -0
  135. package/skills/lark-slides/scripts/xml_lint_test.py +4720 -0
  136. package/skills/lark-slides/scripts/xml_text_overlap_lint.py +3 -2975
  137. package/skills/lark-slides/scripts/xml_text_overlap_lint_test.py +5 -4712
  138. package/skills/lark-task/SKILL.md +13 -1
  139. package/skills/lark-task/references/lark-task-create.md +3 -1
  140. package/skills/lark-vc/SKILL.md +5 -195
  141. package/skills/lark-vc-agent/SKILL.md +5 -191
  142. package/skills/lark-wiki/SKILL.md +3 -1
  143. package/skills/lark-wiki/references/lark-wiki-node-copy.md +5 -19
  144. package/skills/lark-wiki/references/lark-wiki-node-create.md +19 -2
  145. package/skills/lark-wiki/references/lark-wiki-node-get.md +15 -0
  146. package/skills/lark-wiki/references/lark-wiki-node-list.md +1 -1
  147. package/skills/lark-workflow-meeting-summary/SKILL.md +20 -13
  148. package/skills/lark-base/references/lark-base-data-analysis-sop.md +0 -210
  149. package/skills/lark-base/references/lark-base-data-query-guide.md +0 -69
  150. package/skills/lark-base/references/lark-base-record-upsert.md +0 -63
  151. package/skills/lark-minutes/references/lark-minutes-detail.md +0 -62
  152. package/skills/lark-minutes/references/lark-minutes-upload.md +0 -104
  153. package/skills/lark-note/references/lark-note-detail.md +0 -26
  154. package/skills/lark-vc/references/lark-vc-detail.md +0 -44
  155. package/skills/lark-vc/references/vc-domain-boundaries.md +0 -196
@@ -109,7 +109,9 @@ Shortcut 是对常用操作的高级封装(`lark-cli im +<verb> [flags]`)。
109
109
  | [`+chat-messages-list`](references/lark-im-chat-messages-list.md) | List messages in a chat or P2P conversation; user/bot; accepts --chat-id or --user-id, resolves P2P chat_id, supports time range, --order asc/desc sorting, auto-pagination |
110
110
  | [`+chat-search`](references/lark-im-chat-search.md) | Search visible group chats by --query keyword and/or --member-ids; user/bot; e.g. look up chat_id by group name; supports type filters, sorting, auto-pagination, and --exclude-muted (user identity only) |
111
111
  | [`+chat-update`](references/lark-im-chat-update.md) | Update group chat name or description; user/bot; updates a chat's name or description |
112
+ | [`+message-read-users`](references/lark-im-message-read-status.md) | List users who read one message; user/bot; identity-specific scopes; supports bounded auto-pagination |
112
113
  | [`+messages-mget`](references/lark-im-messages-mget.md) | Batch get messages by IDs; user/bot; fetches up to 50 om_ message IDs, formats sender names, expands thread replies |
114
+ | [`+messages-read-status`](references/lark-im-message-read-status.md) | Batch query whether the current user read 1–50 messages; user-only; returns readable items and invalid message IDs |
113
115
  | [`+messages-reply`](references/lark-im-messages-reply.md) | Reply to a message (supports thread replies); user/bot; supports text/markdown/post/media replies, reply-in-thread, idempotency key |
114
116
  | [`+messages-resources-download`](references/lark-im-messages-resources-download.md) | Download an image or file attached to a message; user/bot |
115
117
  | [`+messages-search`](references/lark-im-messages-search.md) | Search messages across chats (supports keyword, sender, time range filters) with user or bot identity; filters by chat/sender/attachment/time, supports auto-pagination via `--page-all` / `--page-limit`, enriches results via batched mget and chats batch_query |
@@ -169,10 +171,11 @@ lark-cli im <resource> <method> [flags] # 调用 API
169
171
 
170
172
  ### messages
171
173
 
174
+ - `read_status` — 批量查询当前用户对消息的已读状态。Identity: `user` only (`user_access_token`); accepts up to 50 message IDs and returns readable items plus invalid message IDs.[Must-read](references/lark-im-message-read-status.md)
172
175
  - `delete` — 撤回消息。Identity: supports `user` and `bot`; for `bot` calls, the bot must be in the chat to revoke group messages; to revoke another user's group message, the bot must be the owner, an admin, or the creator; for user P2P recalls, the target user must be within the bot's availability.
173
176
  - `forward` — 转发消息。Identity: supports `user` and `bot`.
174
177
  - `merge_forward` — 合并转发消息。Identity: `bot` only (`tenant_access_token`).
175
- - `read_users` — 查询消息已读信息。Identity: `bot` only (`tenant_access_token`); the bot must be in the chat, and can only query read status for messages it sent within the last 7 days.
178
+ - `read_users` — 查询消息已读信息。Identity: supports `user` and `bot`; the caller must still be in the chat. A user can query messages they sent within the last 7 days, while a bot can query only messages sent by that bot within the last 7 days.[Must-read](references/lark-im-message-read-status.md)
176
179
  - `urgent_app` — 发送应用内加急。Identity: `bot` only (`tenant_access_token`); the bot must be the message sender and must be in the conversation that contains the message.
177
180
  - `urgent_phone` — 发送电话加急。Identity: `bot` only (`tenant_access_token`); the bot must be the message sender and must be in the conversation that contains the message.
178
181
  - `urgent_sms` — 发送短信加急。Identity: `bot` only (`tenant_access_token`); the bot must be the message sender and must be in the conversation that contains the message.
@@ -190,7 +193,11 @@ lark-cli im <resource> <method> [flags] # 调用 API
190
193
 
191
194
  ### images
192
195
 
193
- - `create` — 上传图片。Identity: `bot` only (`tenant_access_token`).
196
+ - `create` — 上传图片。Identity: supports `user` and `bot`; user identity requires `im:resource` scope on the UAT.
197
+
198
+ ### files
199
+
200
+ - `create` — 上传文件。Identity: supports `user` and `bot`; user identity requires `im:resource` scope on the UAT.
194
201
 
195
202
  ### pins
196
203
 
@@ -225,10 +232,13 @@ lark-cli im <resource> <method> [flags] # 调用 API
225
232
  | `chat.managers.delete_managers` | `im:chat.managers:write_only` |
226
233
  | `chat.moderation.get` | `im:chat.moderation:read` |
227
234
  | `chat.moderation.update` | `im:chat:moderation:write_only` |
235
+ | `+messages-read-status` | user: `im:message:readonly` (recommended), `im:message`, or `im:message:get_as_user` |
236
+ | `+message-read-users` | user: `im:message:readonly` (recommended), `im:message`, `im:message:basic`, or `im:message:get_as_user`; bot: `im:message:readonly` |
237
+ | `messages.read_status` | `im:message:readonly` (recommended), `im:message`, or `im:message:get_as_user` |
228
238
  | `messages.delete` | `im:message:recall` |
229
239
  | `messages.forward` | `im:message` |
230
240
  | `messages.merge_forward` | `im:message` |
231
- | `messages.read_users` | `im:message:readonly` |
241
+ | `messages.read_users` | user: `im:message:readonly` (recommended), `im:message`, `im:message:basic`, or `im:message:get_as_user`; bot: `im:message:readonly` |
232
242
  | `messages.urgent_app` | `im:message.urgent` |
233
243
  | `messages.urgent_phone` | `im:message.urgent:phone` |
234
244
  | `messages.urgent_sms` | `im:message.urgent:sms` |
@@ -238,6 +248,7 @@ lark-cli im <resource> <method> [flags] # 调用 API
238
248
  | `reactions.list` | `im:message.reactions:read` |
239
249
  | `threads.forward` | `im:message` |
240
250
  | `images.create` | `im:resource` |
251
+ | `files.create` | `im:resource` |
241
252
  | `pins.create` | `im:message.pins:write_only` |
242
253
  | `pins.delete` | `im:message.pins:write_only` |
243
254
  | `pins.list` | `im:message.pins:read` |
@@ -0,0 +1,96 @@
1
+ # IM message read status
2
+
3
+ > **Prerequisite:** Read [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) first for authentication and global parameters.
4
+
5
+ Use two focused shortcuts for message read-status queries:
6
+
7
+ - `im +messages-read-status` queries whether the current user has read 1–50 messages.
8
+ - `im +message-read-users` lists users who have read one message and supports automatic pagination.
9
+
10
+ Both underlying OpenAPIs support user identity through a user access token (UAT). `+message-read-users` additionally supports bot identity through a tenant access token (TAT).
11
+
12
+ ## Identity and scopes
13
+
14
+ | Shortcut | Identity | Scope |
15
+ |---|---|---|
16
+ | `+messages-read-status` | user only | `im:message:readonly` (recommended), `im:message`, or `im:message:get_as_user` |
17
+ | `+message-read-users` | user | `im:message:readonly` (recommended), `im:message`, `im:message:basic`, or `im:message:get_as_user` |
18
+ | `+message-read-users` | bot | `im:message:readonly` |
19
+
20
+ For `+message-read-users`, the caller must still be in the chat. A user can query only messages they sent within the last seven days, while a bot can query only messages sent by that bot within the last seven days.
21
+ The user scopes in the table are alternatives; the CLI preflight uses `im:message:readonly` because it is the least-privileged regular OAuth scope supported by this endpoint.
22
+
23
+ ## Batch query the current user's read status
24
+
25
+ ```bash
26
+ # Preview one request
27
+ lark-cli im +messages-read-status \
28
+ --message-ids om_xxx,om_yyy \
29
+ --as user \
30
+ --dry-run
31
+
32
+ # Execute with a user access token
33
+ lark-cli im +messages-read-status \
34
+ --message-ids om_xxx,om_yyy \
35
+ --as user \
36
+ --json
37
+ ```
38
+
39
+ The command accepts 1–50 comma-separated `om_` message IDs. The three scopes above are alternatives; any one is sufficient, and the CLI recommends the least-privileged OAuth scope `im:message:readonly`. The response keeps the OpenAPI response unchanged:
40
+
41
+ - `items[].message_id` and `items[].is_read` contain statuses the server could determine.
42
+ - `invalid_message_ids` contains messages that do not exist, are not visible to the current user, or do not support this query. The API deliberately does not expose a more specific reason.
43
+
44
+ ## List users who read one message
45
+
46
+ ```bash
47
+ # Fetch one page as the current user
48
+ lark-cli im +message-read-users \
49
+ --message-id om_xxx \
50
+ --as user \
51
+ --json
52
+
53
+ # Fetch every page as a bot, bounded to ten pages by default
54
+ lark-cli im +message-read-users \
55
+ --message-id om_xxx \
56
+ --user-id-type open_id \
57
+ --page-all \
58
+ --as bot \
59
+ --json
60
+ ```
61
+
62
+ Pagination flags:
63
+
64
+ - `--page-size`: 1–100, default 100.
65
+ - `--page-token`: start from a known cursor.
66
+ - `--page-all`: continue until the endpoint is exhausted.
67
+ - `--page-limit`: maximum pages with `--page-all`; default 10, range 1–1000.
68
+ - `--page-delay`: delay in milliseconds between pages; default 200, and 0 disables the delay.
69
+
70
+ The command preserves each server item, including `user_id_type`, `user_id`, `timestamp`, and `tenant_key`. Pagination metadata reports whether the endpoint was exhausted and retains the next token when a bounded run can be resumed.
71
+
72
+ ## Raw API commands
73
+
74
+ When Registry MR !128 is published, the corresponding raw commands remain available:
75
+
76
+ ```bash
77
+ lark-cli im messages read_status --data '{"message_ids":["om_xxx"]}' --as user
78
+ lark-cli im messages read_users --params '{"message_id":"om_xxx","user_id_type":"open_id"}' --as user
79
+ ```
80
+
81
+ Prefer the shortcuts for flag validation, identity-specific scope hints, and read-users auto-pagination.
82
+
83
+ ## Troubleshooting
84
+
85
+ | Symptom | Meaning | Action |
86
+ |---|---|---|
87
+ | `--as bot is not supported` for read status | The batch endpoint requires user identity | Switch to `--as user` |
88
+ | Missing `im:message:readonly` or `im:message` | A regular OAuth scope has not been granted | Follow the CLI authorization hint to grant one supported scope |
89
+ | Missing a user read scope | No supported regular OAuth scope has been granted | Grant `im:message:readonly` and retry |
90
+ | Bot permission denied | The application lacks a bot scope | Open the `console_url` from the typed error and enable the requested scope |
91
+ | Empty read-user list | No user has read the message, or sender/time constraints are not met | Verify chat membership, the message sender, and the seven-day window |
92
+
93
+ ## References
94
+
95
+ - [lark-im](../SKILL.md)
96
+ - [lark-shared](../../lark-shared/SKILL.md)
@@ -24,37 +24,37 @@
24
24
 
25
25
  ```bash
26
26
  # 创建 HTML 草稿(推荐)
27
- lark-cli mail +draft-create --to alice@example.com --subject '周报' \
27
+ lark-cli mail +draft-create --to 'alice@example.com' --subject '周报' \
28
28
  --body '<p>本周进展:</p><ul><li>完成 A 模块</li></ul>'
29
29
 
30
30
  # 不带收件人的 HTML 草稿(用户之后可自行添加)
31
31
  lark-cli mail +draft-create --subject '周报' --body '<p>草稿内容</p>'
32
32
 
33
33
  # 带附件和内嵌图片的 HTML 草稿(推荐:直接用相对路径,自动解析)
34
- lark-cli mail +draft-create --to alice@example.com --subject '预览图' --body '<p>见附件和图:<img src="./logo.png" /></p>' --attach ./report.pdf
34
+ lark-cli mail +draft-create --to 'alice@example.com' --subject '预览图' --body '<p>见附件和图:<img src="./logo.png" /></p>' --attach './report.pdf'
35
35
 
36
36
  # 纯文本草稿(仅在内容极简时使用)
37
- lark-cli mail +draft-create --to alice@example.com --subject '简短通知' --body '收到,谢谢'
37
+ lark-cli mail +draft-create --to 'alice@example.com' --subject '简短通知' --body '收到,谢谢'
38
38
 
39
39
  # Dry Run(仅打印请求,不执行)
40
- lark-cli mail +draft-create --to alice@example.com --subject '测试' --body 'test' --dry-run
40
+ lark-cli mail +draft-create --to 'alice@example.com' --subject '测试' --body 'test' --dry-run
41
41
  ```
42
42
 
43
43
  ## 参数
44
44
 
45
45
  | 参数 | 必填 | 说明 |
46
46
  |------|------|------|
47
- | `--to <emails>` | 否 | 完整收件人列表,多个用逗号分隔。支持 `Alice <alice@example.com>` 格式。省略时草稿不带收件人(之后可通过 `+draft-edit` 添加) |
47
+ | `--to '<email>'` | 否 | 完整收件人列表。多个收件人请重复传 `--to`,每次只放一个地址,参数值用单引号包住。支持 `Alice <alice@example.com>` 格式。省略时草稿不带收件人(之后可通过 `+draft-edit` 添加) |
48
48
  | `--subject <text>` | 是 | 草稿主题 |
49
49
  | `--body <text>` | 二选一 | 邮件正文。推荐使用 HTML 获得富文本排版;也支持纯文本(自动检测)。使用 `--plain-text` 可强制纯文本模式。支持 `<img src="./local.png" />` 相对路径自动解析为内嵌图片(仅支持相对路径,不支持绝对路径)。与 `--body-file` 互斥 |
50
50
  | `--body-file <path>` | 二选一 | 从文件读取邮件正文 HTML(相对路径,仅限 cwd 子树)。与 `--body` 互斥。文件大小上限 32 MB |
51
51
  | `--from <email>` | 否 | 发件人邮箱地址(EML From 头)。使用别名(send_as)发信时,设为别名地址并配合 `--mailbox` 指定所属邮箱。省略时使用邮箱主地址 |
52
52
  | `--mailbox <email>` | 否 | 邮箱地址,指定草稿所属的邮箱(默认回退到 `--from`,再回退到 `me`)。当发件人(`--from`)与邮箱不同时使用,如通过别名或 send_as 地址发信。可通过 `accessible_mailboxes` 查询可用邮箱 |
53
- | `--cc <emails>` | 否 | 完整抄送列表,多个用逗号分隔 |
54
- | `--bcc <emails>` | 否 | 完整密送列表,多个用逗号分隔。与 `--event-*` 不兼容(见 `+send` 日程邀请约束) |
53
+ | `--cc '<email>'` | 否 | 完整抄送列表。多个抄送请重复传 `--cc`,每次只放一个地址,参数值用单引号包住 |
54
+ | `--bcc '<email>'` | 否 | 完整密送列表。多个密送请重复传 `--bcc`,每次只放一个地址,参数值用单引号包住。与 `--event-*` 不兼容(见 `+send` 日程邀请约束) |
55
55
  | `--plain-text` | 否 | 强制纯文本模式,忽略 HTML 自动检测。不可与 `--inline` 同时使用。纯文本模式下也会自动追加纯文本签名(HTML 签名经 `PlainTextFromHTML` 转换,内联图片丢弃) |
56
- | `--attach <paths>` | 否 | 附件文件路径,多个用逗号分隔。相对路径。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
57
- | `--inline <json>` | 否 | 高级用法:手动指定内嵌图片 CID 映射。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。仅在需要精确控制 CID 命名时使用此参数。格式:`'[{"cid":"mycid","file_path":"./logo.png"}]'`,在 body 中用 `<img src="cid:mycid">` 引用。不可与 `--plain-text` 同时使用 |
56
+ | `--attach '<path>'` | 否 | 附件文件路径。多个附件请重复传 `--attach`,每次只放一个相对路径,参数值用单引号包住;按传入顺序追加。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
57
+ | `--inline '<json>'` | 否 | 高级用法:手动指定内嵌图片 CID 映射。多个 inline 图片请重复传 `--inline`,每次只放一个 JSON object,并用单引号包住:`'{"cid":"mycid","file_path":"./logo.png"}'`。`file_path` 必须是相对路径;CID 应唯一,例如随机十六进制字符串;在 body 中用 `<img src="cid:mycid">` 引用。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。不可与 `--plain-text` 同时使用 |
58
58
  | `--signature-id <id>` | 否 | 签名 ID。附加邮箱签名到正文末尾。运行 `mail +signature` 查看可用签名。与 `--no-signature` 互斥 |
59
59
  | `--no-signature` | 否 | 跳过默认签名自动追加。与 `--signature-id` 互斥,同时使用时返回参数校验错误(退出码 2) |
60
60
  | `--priority <level>` | 否 | 邮件优先级:`high`、`normal`、`low`。省略或 `normal` 时不设置优先级 |
@@ -94,7 +94,7 @@ lark-cli mail +draft-create --to alice@example.com --subject '测试' --body 'te
94
94
 
95
95
  ```bash
96
96
  # 1. 创建草稿
97
- lark-cli mail +draft-create --to alice@example.com --subject 'Q1 报告' --body '请查收附件中的报告。' --attach ./q1-report.pdf --format json
97
+ lark-cli mail +draft-create --to 'alice@example.com' --subject 'Q1 报告' --body '请查收附件中的报告。' --attach './q1-report.pdf' --format json
98
98
 
99
99
  # 2. 发送草稿
100
100
  lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_id":"<draft_id>"}'
@@ -107,13 +107,13 @@ lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_
107
107
  ```bash
108
108
  # 推荐:直接使用相对路径,自动解析为内嵌图片
109
109
  lark-cli mail +draft-create \
110
- --to alice@example.com \
110
+ --to 'alice@example.com' \
111
111
  --subject '通讯稿' \
112
112
  --body '<h1>你好</h1><img src="./banner.png" />'
113
113
 
114
114
  # 高级用法:手动指定 CID(CID 为唯一标识符,可用随机十六进制字符串)
115
115
  lark-cli mail +draft-create \
116
- --to alice@example.com \
116
+ --to 'alice@example.com' \
117
117
  --subject '通讯稿' \
118
118
  --body '<h1>你好</h1><img src="cid:c7d8e9f0a1b2c3d4e5f6">' \
119
119
  --inline '[{"cid":"c7d8e9f0a1b2c3d4e5f6","file_path":"./banner.png"}]'
@@ -19,7 +19,7 @@
19
19
 
20
20
  **方式 A(推荐)** — 创建转发草稿(不带 `--confirm-send`):
21
21
  ```bash
22
- lark-cli mail +forward --message-id <邮件ID> --to <收件人>
22
+ lark-cli mail +forward --message-id <邮件ID> --to '<收件人>'
23
23
  ```
24
24
  → 返回 `draft_id`
25
25
 
@@ -38,22 +38,22 @@ lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_
38
38
 
39
39
  ```bash
40
40
  # 转发邮件(默认保存为草稿)— HTML 推荐
41
- lark-cli mail +forward --message-id <邮件ID> --to alice@example.com --body '<p>FYI,请看下面原邮件。</p>'
41
+ lark-cli mail +forward --message-id <邮件ID> --to 'alice@example.com' --body '<p>FYI,请看下面原邮件。</p>'
42
42
 
43
43
  # 转发并附加说明 + 抄送(草稿)
44
- lark-cli mail +forward --message-id <邮件ID> --to alice@example.com --cc bob@example.com --body '<b>请参考</b>'
44
+ lark-cli mail +forward --message-id <邮件ID> --to 'alice@example.com' --cc 'bob@example.com' --body '<b>请参考</b>'
45
45
 
46
46
  # 转发时插入内嵌图片(推荐:直接用相对路径,自动解析)
47
- lark-cli mail +forward --message-id <邮件ID> --to alice@example.com --body '<p>详见图示:<img src="./logo.png" /></p>'
47
+ lark-cli mail +forward --message-id <邮件ID> --to 'alice@example.com' --body '<p>详见图示:<img src="./logo.png" /></p>'
48
48
 
49
49
  # 纯文本转发(仅在内容极简时使用)
50
- lark-cli mail +forward --message-id <邮件ID> --to alice@example.com
50
+ lark-cli mail +forward --message-id <邮件ID> --to 'alice@example.com'
51
51
 
52
52
  # 确认发送(用户明确确认后才可使用)
53
- lark-cli mail +forward --message-id <邮件ID> --to alice@example.com --confirm-send
53
+ lark-cli mail +forward --message-id <邮件ID> --to 'alice@example.com' --confirm-send
54
54
 
55
55
  # Dry Run(仅打印请求,不发送)
56
- lark-cli mail +forward --message-id <邮件ID> --to alice@example.com --dry-run
56
+ lark-cli mail +forward --message-id <邮件ID> --to 'alice@example.com' --dry-run
57
57
  ```
58
58
 
59
59
  ## 参数
@@ -61,16 +61,16 @@ lark-cli mail +forward --message-id <邮件ID> --to alice@example.com --dry-run
61
61
  | 参数 | 必填 | 说明 |
62
62
  |------|------|------|
63
63
  | `--message-id <id>` | 是 | 被转发的邮件 ID |
64
- | `--to <emails>` | 是 | 收件人邮箱,多个用逗号分隔 |
64
+ | `--to '<email>'` | 是 | 收件人邮箱。多个收件人请重复传 `--to`,每次只放一个地址,参数值用单引号包住 |
65
65
  | `--body <text>` | 否 | 转发时附加的说明文字。推荐使用 HTML 获得富文本排版;也支持纯文本。根据转发正文和原邮件正文自动检测 HTML。使用 `--plain-text` 可强制纯文本模式。支持 `<img src="./local.png" />` 相对路径自动解析为内嵌图片(仅支持相对路径,不支持绝对路径)。与 `--body-file` 互斥 |
66
66
  | `--body-file <path>` | 否 | 从文件读取转发说明 HTML(相对路径,仅限 cwd 子树)。与 `--body` 互斥。文件大小上限 32 MB |
67
67
  | `--from <email>` | 否 | 发件人邮箱地址(EML From 头)。使用别名(send_as)发信时,设为别名地址并配合 `--mailbox` 指定所属邮箱。默认读取邮箱主地址 |
68
68
  | `--mailbox <email>` | 否 | 邮箱地址,指定草稿所属的邮箱(默认回退到 `--from`,再回退到 `me`)。当发件人(`--from`)与邮箱不同时使用。可通过 `accessible_mailboxes` 查询可用邮箱 |
69
- | `--cc <emails>` | 否 | 抄送邮箱,多个用逗号分隔 |
70
- | `--bcc <emails>` | 否 | 密送邮箱,多个用逗号分隔。与 `--event-*` 不兼容(见 `+send` 日程邀请约束) |
69
+ | `--cc '<email>'` | 否 | 抄送邮箱。多个抄送请重复传 `--cc`,每次只放一个地址,参数值用单引号包住 |
70
+ | `--bcc '<email>'` | 否 | 密送邮箱。多个密送请重复传 `--bcc`,每次只放一个地址,参数值用单引号包住。与 `--event-*` 不兼容(见 `+send` 日程邀请约束) |
71
71
  | `--plain-text` | 否 | 强制纯文本模式,忽略所有 HTML 自动检测。不可与 `--inline` 同时使用。纯文本模式下也会自动追加纯文本签名(HTML 签名经 `PlainTextFromHTML` 转换,内联图片丢弃) |
72
- | `--attach <paths>` | 否 | 附件文件路径,多个用逗号分隔,追加在原邮件附件之后。相对路径。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
73
- | `--inline <json>` | 否 | 高级用法:手动指定内嵌图片 CID 映射。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。仅在需要精确控制 CID 命名时使用此参数。格式:`'[{"cid":"mycid","file_path":"./logo.png"}]'`,在 body 中用 `<img src="cid:mycid">` 引用。不可与 `--plain-text` 同时使用 |
72
+ | `--attach '<path>'` | 否 | 附件文件路径。多个附件请重复传 `--attach`,每次只放一个相对路径,参数值用单引号包住;按传入顺序追加在原邮件附件之后。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
73
+ | `--inline '<json>'` | 否 | 高级用法:手动指定内嵌图片 CID 映射。多个 inline 图片请重复传 `--inline`,每次只放一个 JSON object,并用单引号包住:`'{"cid":"mycid","file_path":"./logo.png"}'`。`file_path` 必须是相对路径;CID 应唯一,例如随机十六进制字符串;在 body 中用 `<img src="cid:mycid">` 引用。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。不可与 `--plain-text` 同时使用 |
74
74
  | `--signature-id <id>` | 否 | 签名 ID。附加邮箱签名到转发正文与引用块之间。运行 `mail +signature` 查看可用签名。与 `--no-signature` 互斥 |
75
75
  | `--no-signature` | 否 | 跳过默认签名自动追加。与 `--signature-id` 互斥,同时使用时返回参数校验错误(退出码 2) |
76
76
  | `--priority <level>` | 否 | 邮件优先级:`high`、`normal`、`low`。省略或 `normal` 时不设置优先级 |
@@ -124,14 +124,14 @@ lark-cli mail +forward --message-id <邮件ID> --to alice@example.com --dry-run
124
124
 
125
125
  ### 场景 1:用户说"把这封邮件转发给 Bob"(只创建草稿)
126
126
  ```bash
127
- lark-cli mail +forward --message-id <邮件ID> --to bob@example.com --body '<p>FYI</p>'
127
+ lark-cli mail +forward --message-id <邮件ID> --to 'bob@example.com' --body '<p>FYI</p>'
128
128
  ```
129
129
  → 返回 `draft_id`,告诉用户转发草稿已创建。
130
130
 
131
131
  ### 场景 2:用户说"转发给 Bob 并发送"(需要发送)
132
132
  ```bash
133
133
  # 方式 A: 创建转发草稿
134
- lark-cli mail +forward --message-id <邮件ID> --to bob@example.com --body '<p>FYI,请查收。</p>'
134
+ lark-cli mail +forward --message-id <邮件ID> --to 'bob@example.com' --body '<p>FYI,请查收。</p>'
135
135
  # → 返回 draft_id
136
136
 
137
137
  # 向用户确认 "收件人 bob@example.com。如果你想先看效果,也可以先去飞书邮件里查看草稿。确认发送吗?"
@@ -140,13 +140,13 @@ lark-cli mail +forward --message-id <邮件ID> --to bob@example.com --body '<p>F
140
140
  lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_id":"<draft_id>"}'
141
141
 
142
142
  # 方式 B: 用户已明确确认时,直接发送
143
- lark-cli mail +forward --message-id <邮件ID> --to bob@example.com --body '<p>FYI,请查收。</p>' --confirm-send
143
+ lark-cli mail +forward --message-id <邮件ID> --to 'bob@example.com' --body '<p>FYI,请查收。</p>' --confirm-send
144
144
  ```
145
145
 
146
146
  ### 场景 3:用户说"下午 3 点转发给 Bob"(定时发送)
147
147
  ```bash
148
148
  # Step 1: 创建转发草稿
149
- lark-cli mail +forward --message-id <邮件ID> --to bob@example.com --body '<p>FYI,请查收。</p>'
149
+ lark-cli mail +forward --message-id <邮件ID> --to 'bob@example.com' --body '<p>FYI,请查收。</p>'
150
150
  # → 返回 draft_id
151
151
 
152
152
  # Step 2: 向用户确认 "转发草稿已创建:收件人 bob@example.com,定时 <目标时间> 发送。确认吗?"
@@ -174,7 +174,7 @@ lark-cli mail +thread --thread-id <THREAD_ID> --html=false --format json
174
174
  # messages 按时间升序排列,最后一条 = messages[-1].message_id
175
175
 
176
176
  # 3. 转发该消息
177
- lark-cli mail +forward --message-id <最后一条的message_id> --to recipient@example.com --body '请过目'
177
+ lark-cli mail +forward --message-id <最后一条的message_id> --to 'recipient@example.com' --body '请过目'
178
178
  ```
179
179
 
180
180
  ## 实现说明
@@ -41,10 +41,10 @@ lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_
41
41
  lark-cli mail +reply-all --message-id <邮件ID> --body '<p><b>已完成</b>,详见下方说明。</p>'
42
42
 
43
43
  # 回复全部并追加收件人/抄送(草稿)
44
- lark-cli mail +reply-all --message-id <邮件ID> --body '<p>同步更新</p>' --to lead@example.com --cc pm@example.com
44
+ lark-cli mail +reply-all --message-id <邮件ID> --body '<p>同步更新</p>' --to 'lead@example.com' --cc 'pm@example.com'
45
45
 
46
46
  # 从回复名单中排除某些地址(草稿)
47
- lark-cli mail +reply-all --message-id <邮件ID> --body '<p>见上</p>' --remove bot@example.com,noreply@example.com
47
+ lark-cli mail +reply-all --message-id <邮件ID> --body '<p>见上</p>' --remove 'bot@example.com' --remove 'noreply@example.com'
48
48
 
49
49
  # 回复全部时插入内嵌图片(推荐:直接用相对路径,自动解析)
50
50
  lark-cli mail +reply-all --message-id <邮件ID> --body '<p>详见图示:<img src="./logo.png" /></p>'
@@ -68,13 +68,13 @@ lark-cli mail +reply-all --message-id <邮件ID> --body '测试' --dry-run
68
68
  | `--body-file <path>` | 二选一 | 从文件读取回复正文 HTML(相对路径,仅限 cwd 子树)。与 `--body` 互斥。文件大小上限 32 MB |
69
69
  | `--from <email>` | 否 | 发件人邮箱地址(EML From 头)。使用别名(send_as)发信时,设为别名地址并配合 `--mailbox` 指定所属邮箱。默认读取邮箱主地址 |
70
70
  | `--mailbox <email>` | 否 | 邮箱地址,指定草稿所属的邮箱(默认回退到 `--from`,再回退到 `me`)。当发件人(`--from`)与邮箱不同时使用。可通过 `accessible_mailboxes` 查询可用邮箱 |
71
- | `--to <emails>` | 否 | 额外收件人,多个用逗号分隔(追加到自动聚合结果) |
72
- | `--cc <emails>` | 否 | 额外抄送,多个用逗号分隔 |
73
- | `--bcc <emails>` | 否 | 密送邮箱,多个用逗号分隔。与 `--event-*` 不兼容(见 `+send` 日程邀请约束) |
74
- | `--remove <emails>` | 否 | 从自动聚合结果中排除的邮箱,多个用逗号分隔 |
71
+ | `--to '<email>'` | 否 | 额外收件人。多个额外收件人请重复传 `--to`,每次只放一个地址,参数值用单引号包住;追加到自动聚合结果 |
72
+ | `--cc '<email>'` | 否 | 额外抄送。多个抄送请重复传 `--cc`,每次只放一个地址,参数值用单引号包住 |
73
+ | `--bcc '<email>'` | 否 | 密送邮箱。多个密送请重复传 `--bcc`,每次只放一个地址,参数值用单引号包住。与 `--event-*` 不兼容(见 `+send` 日程邀请约束) |
74
+ | `--remove '<email>'` | 否 | 从自动聚合结果中排除的邮箱。多个排除地址请重复传 `--remove`,每次只放一个地址,参数值用单引号包住;按传入顺序处理 |
75
75
  | `--plain-text` | 否 | 强制纯文本模式,忽略所有 HTML 自动检测。不可与 `--inline` 同时使用。纯文本模式下也会自动追加纯文本签名(HTML 签名经 `PlainTextFromHTML` 转换,内联图片丢弃) |
76
- | `--attach <paths>` | 否 | 附件文件路径,多个用逗号分隔。相对路径。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
77
- | `--inline <json>` | 否 | 高级用法:手动指定内嵌图片 CID 映射。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。仅在需要精确控制 CID 命名时使用此参数。格式:`'[{"cid":"mycid","file_path":"./logo.png"}]'`,在 body 中用 `<img src="cid:mycid">` 引用。不可与 `--plain-text` 同时使用 |
76
+ | `--attach '<path>'` | 否 | 附件文件路径。多个附件请重复传 `--attach`,每次只放一个相对路径,参数值用单引号包住;按传入顺序追加。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
77
+ | `--inline '<json>'` | 否 | 高级用法:手动指定内嵌图片 CID 映射。多个 inline 图片请重复传 `--inline`,每次只放一个 JSON object,并用单引号包住:`'{"cid":"mycid","file_path":"./logo.png"}'`。`file_path` 必须是相对路径;CID 应唯一,例如随机十六进制字符串;在 body 中用 `<img src="cid:mycid">` 引用。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。不可与 `--plain-text` 同时使用 |
78
78
  | `--signature-id <id>` | 否 | 签名 ID。附加邮箱签名到回复正文与引用块之间。运行 `mail +signature` 查看可用签名。与 `--no-signature` 互斥 |
79
79
  | `--no-signature` | 否 | 跳过默认签名自动追加。与 `--signature-id` 互斥,同时使用时返回参数校验错误(退出码 2) |
80
80
  | `--priority <level>` | 否 | 邮件优先级:`high`、`normal`、`low`。省略或 `normal` 时不设置优先级 |
@@ -45,7 +45,7 @@ lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_
45
45
  lark-cli mail +reply --message-id <邮件ID> --body '<p><b>已收到</b>,稍后跟进。</p>'
46
46
 
47
47
  # 回复并追加收件人/抄送(保存为草稿)
48
- lark-cli mail +reply --message-id <邮件ID> --body '<p>已处理</p>' --to lead@example.com --cc colleague@example.com
48
+ lark-cli mail +reply --message-id <邮件ID> --body '<p>已处理</p>' --to 'lead@example.com' --cc 'colleague@example.com'
49
49
 
50
50
  # 回复时插入内嵌图片(推荐:直接用相对路径,自动解析)
51
51
  lark-cli mail +reply --message-id <邮件ID> --body '<p>详见图示:<img src="./logo.png" /></p>'
@@ -72,12 +72,12 @@ lark-cli mail +reply --message-id <邮件ID> --body '<p>测试</p>' --dry-run
72
72
  | `--body-file <path>` | 二选一 | 从文件读取回复正文 HTML(相对路径,仅限 cwd 子树)。与 `--body` 互斥。文件大小上限 32 MB |
73
73
  | `--from <email>` | 否 | 发件人邮箱地址(EML From 头)。使用别名(send_as)发信时,设为别名地址并配合 `--mailbox` 指定所属邮箱。默认读取邮箱主地址 |
74
74
  | `--mailbox <email>` | 否 | 邮箱地址,指定草稿所属的邮箱(默认回退到 `--from`,再回退到 `me`)。当发件人(`--from`)与邮箱不同时使用。可通过 `accessible_mailboxes` 查询可用邮箱 |
75
- | `--to <emails>` | 否 | 额外收件人,多个用逗号分隔(追加到原发件人) |
76
- | `--cc <emails>` | 否 | 抄送邮箱,多个用逗号分隔 |
77
- | `--bcc <emails>` | 否 | 密送邮箱,多个用逗号分隔。与 `--event-*` 不兼容(见 `+send` 日程邀请约束) |
75
+ | `--to '<email>'` | 否 | 额外收件人。多个额外收件人请重复传 `--to`,每次只放一个地址,参数值用单引号包住;追加到原发件人 |
76
+ | `--cc '<email>'` | 否 | 抄送邮箱。多个抄送请重复传 `--cc`,每次只放一个地址,参数值用单引号包住 |
77
+ | `--bcc '<email>'` | 否 | 密送邮箱。多个密送请重复传 `--bcc`,每次只放一个地址,参数值用单引号包住。与 `--event-*` 不兼容(见 `+send` 日程邀请约束) |
78
78
  | `--plain-text` | 否 | 强制纯文本模式,忽略所有 HTML 自动检测。不可与 `--inline` 同时使用。纯文本模式下也会自动追加纯文本签名(HTML 签名经 `PlainTextFromHTML` 转换,内联图片丢弃) |
79
- | `--attach <paths>` | 否 | 附件文件路径,多个用逗号分隔。相对路径。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
80
- | `--inline <json>` | 否 | 高级用法:手动指定内嵌图片 CID 映射。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。仅在需要精确控制 CID 命名时使用此参数。格式:`'[{"cid":"mycid","file_path":"./logo.png"}]'`,在 body 中用 `<img src="cid:mycid">` 引用。不可与 `--plain-text` 同时使用 |
79
+ | `--attach '<path>'` | 否 | 附件文件路径。多个附件请重复传 `--attach`,每次只放一个相对路径,参数值用单引号包住;按传入顺序追加。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
80
+ | `--inline '<json>'` | 否 | 高级用法:手动指定内嵌图片 CID 映射。多个 inline 图片请重复传 `--inline`,每次只放一个 JSON object,并用单引号包住:`'{"cid":"mycid","file_path":"./logo.png"}'`。`file_path` 必须是相对路径;CID 应唯一,例如随机十六进制字符串;在 body 中用 `<img src="cid:mycid">` 引用。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。不可与 `--plain-text` 同时使用 |
81
81
  | `--signature-id <id>` | 否 | 签名 ID。附加邮箱签名到回复正文与引用块之间。运行 `mail +signature` 查看可用签名。与 `--no-signature` 互斥 |
82
82
  | `--no-signature` | 否 | 跳过默认签名自动追加。与 `--signature-id` 互斥,同时使用时返回参数校验错误(退出码 2) |
83
83
  | `--priority <level>` | 否 | 邮件优先级:`high`、`normal`、`low`。省略或 `normal` 时不设置优先级 |
@@ -18,7 +18,7 @@
18
18
 
19
19
  **方式 A(推荐)** — 先创建草稿,再确认发送:
20
20
  ```bash
21
- lark-cli mail +send --to <收件人> --subject '<主题>' --body '<正文>'
21
+ lark-cli mail +send --to '<收件人>' --subject '<主题>' --body '<正文>'
22
22
  ```
23
23
  → 返回 `draft_id`
24
24
 
@@ -31,7 +31,7 @@ lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_
31
31
 
32
32
  **方式 B(允许)** — 用户已经明确确认收件人和内容时,可直接使用 `--confirm-send` 立即发送:
33
33
  ```bash
34
- lark-cli mail +send --to <收件人> --subject '<主题>' --body '<正文>' --confirm-send
34
+ lark-cli mail +send --to '<收件人>' --subject '<主题>' --body '<正文>' --confirm-send
35
35
  ```
36
36
 
37
37
  **禁止在用户未明确同意的情况下执行发送,无论是发送草稿还是直接使用 `--confirm-send`。**
@@ -40,44 +40,44 @@ lark-cli mail +send --to <收件人> --subject '<主题>' --body '<正文>' --co
40
40
 
41
41
  ```bash
42
42
  # 保存为草稿(默认行为,不发送)— HTML 格式推荐
43
- lark-cli mail +send --to alice@example.com --subject '周报' \
43
+ lark-cli mail +send --to 'alice@example.com' --subject '周报' \
44
44
  --body '<p>本周进展:</p><ul><li>完成 A 模块</li><li>修复 3 个 bug</li></ul>'
45
45
 
46
46
  # 保存为草稿并抄送
47
- lark-cli mail +send --to alice@example.com --cc bob@example.com --subject '状态更新' --body '<b>已完成</b>'
47
+ lark-cli mail +send --to 'alice@example.com' --cc 'bob@example.com' --subject '状态更新' --body '<b>已完成</b>'
48
48
 
49
49
  # 确认发送(仅在用户明确确认后使用)
50
- lark-cli mail +send --to alice@example.com --subject '周报' \
50
+ lark-cli mail +send --to 'alice@example.com' --subject '周报' \
51
51
  --body '<p>本周进展如下...</p>' --confirm-send
52
52
 
53
53
  # 保存带附件的草稿
54
- lark-cli mail +send --to alice@example.com --subject '请查收' --body '<p>见附件</p>' --attach ./report.pdf,./logs.zip
54
+ lark-cli mail +send --to 'alice@example.com' --subject '请查收' --body '<p>见附件</p>' --attach './report.pdf' --attach './logs.zip'
55
55
 
56
56
  # 保存带内嵌图片的草稿(推荐:直接用相对路径,自动解析)
57
- lark-cli mail +send --to alice@example.com --subject '预览图' --body '<img src="./logo.png" />'
57
+ lark-cli mail +send --to 'alice@example.com' --subject '预览图' --body '<img src="./logo.png" />'
58
58
 
59
59
  # 纯文本邮件(仅在内容极简时使用)
60
- lark-cli mail +send --to alice@example.com --subject '确认' --body '收到,谢谢'
60
+ lark-cli mail +send --to 'alice@example.com' --subject '确认' --body '收到,谢谢'
61
61
 
62
62
  # Dry Run(仅打印请求,不执行)
63
- lark-cli mail +send --to alice@example.com --subject '测试' --body '<p>test</p>' --dry-run
63
+ lark-cli mail +send --to 'alice@example.com' --subject '测试' --body '<p>test</p>' --dry-run
64
64
  ```
65
65
 
66
66
  ## 参数
67
67
 
68
68
  | 参数 | 必填 | 说明 |
69
69
  |------|------|------|
70
- | `--to <emails>` | 是 | 收件人邮箱,多个用逗号分隔 |
70
+ | `--to '<email>'` | 是 | 收件人邮箱。多个收件人请重复传 `--to`,每次只放一个地址,参数值用单引号包住 |
71
71
  | `--subject <text>` | 是 | 邮件主题 |
72
72
  | `--body <text>` | 二选一 | 邮件正文。推荐使用 HTML 获得富文本排版;也支持纯文本(自动检测)。使用 `--plain-text` 可强制纯文本模式。支持 `<img src="./local.png" />` 相对路径自动解析为内嵌图片(仅支持相对路径,不支持绝对路径)。与 `--body-file` 互斥 |
73
73
  | `--body-file <path>` | 二选一 | 从文件读取邮件正文 HTML(相对路径,仅限 cwd 子树)。与 `--body` 互斥。文件大小上限 32 MB |
74
74
  | `--from <email>` | 否 | 发件人邮箱地址(EML From 头)。使用别名(send_as)发信时,设为别名地址并配合 `--mailbox` 指定所属邮箱。默认读取邮箱主地址 |
75
75
  | `--mailbox <email>` | 否 | 邮箱地址,指定草稿所属的邮箱(默认回退到 `--from`,再回退到 `me`)。当发件人(`--from`)与邮箱不同时使用。可通过 `accessible_mailboxes` 查询可用邮箱 |
76
- | `--cc <emails>` | 否 | 抄送邮箱,多个用逗号分隔 |
77
- | `--bcc <emails>` | 否 | 密送邮箱,多个用逗号分隔 |
76
+ | `--cc '<email>'` | 否 | 抄送邮箱。多个抄送请重复传 `--cc`,每次只放一个地址,参数值用单引号包住 |
77
+ | `--bcc '<email>'` | 否 | 密送邮箱。多个密送请重复传 `--bcc`,每次只放一个地址,参数值用单引号包住 |
78
78
  | `--plain-text` | 否 | 强制纯文本模式,忽略 HTML 自动检测。不可与 `--inline` 同时使用。纯文本模式下也会自动追加纯文本签名(HTML 签名经 `PlainTextFromHTML` 转换,内联图片丢弃) |
79
- | `--attach <paths>` | 否 | 附件文件路径,多个用逗号分隔。相对路径。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
80
- | `--inline <json>` | 否 | 高级用法:手动指定内嵌图片 CID 映射。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。仅在需要精确控制 CID 命名时使用此参数。格式:`'[{"cid":"mycid","file_path":"./logo.png"}]'`,在 body 中用 `<img src="cid:mycid">` 引用。不可与 `--plain-text` 同时使用 |
79
+ | `--attach '<path>'` | 否 | 附件文件路径。多个附件请重复传 `--attach`,每次只放一个相对路径,参数值用单引号包住;按传入顺序追加。当附件导致 EML 总大小超过 25 MB 时,超出部分自动上传为超大附件(HTML 邮件插入下载卡片,纯文本邮件追加下载链接),单个文件上限 3 GB |
80
+ | `--inline '<json>'` | 否 | 高级用法:手动指定内嵌图片 CID 映射。多个 inline 图片请重复传 `--inline`,每次只放一个 JSON object,并用单引号包住:`'{"cid":"mycid","file_path":"./logo.png"}'`。`file_path` 必须是相对路径;CID 应唯一,例如随机十六进制字符串;在 body 中用 `<img src="cid:mycid">` 引用。推荐直接在 `--body` 中使用 `<img src="./path" />`(自动解析)。不可与 `--plain-text` 同时使用 |
81
81
  | `--signature-id <id>` | 否 | 签名 ID。附加邮箱签名到正文末尾。运行 `mail +signature` 查看可用签名。与 `--no-signature` 互斥 |
82
82
  | `--no-signature` | 否 | 跳过默认签名自动追加。与 `--signature-id` 互斥,同时使用时返回参数校验错误(退出码 2) |
83
83
  | `--priority <level>` | 否 | 邮件优先级:`high`、`normal`、`low`。省略或 `normal` 时不设置优先级 |
@@ -141,14 +141,14 @@ lark-cli mail +send --to alice@example.com --subject '测试' --body '<p>test</p
141
141
 
142
142
  ### 场景 1:用户说"帮我写一封邮件给 Alice"(只创建草稿)
143
143
  ```bash
144
- lark-cli mail +send --to alice@example.com --subject '周报' --body '<p>本周进展如下...</p>'
144
+ lark-cli mail +send --to 'alice@example.com' --subject '周报' --body '<p>本周进展如下...</p>'
145
145
  ```
146
146
  → 返回草稿结果时,如输出中带有草稿打开链接,则一起展示给用户;如果当前输出没有链接,则静默处理。如果用户想先看效果,可去飞书邮件 UI 中打开草稿查看详情。
147
147
 
148
148
  ### 场景 2:用户说"发邮件给 Alice 说收到了"(需要发送)
149
149
  ```bash
150
150
  # 方式 A: 创建草稿
151
- lark-cli mail +send --to alice@example.com --subject '收到' --body '<p>已收到,谢谢!</p>'
151
+ lark-cli mail +send --to 'alice@example.com' --subject '收到' --body '<p>已收到,谢谢!</p>'
152
152
  # → 返回 draft_id
153
153
 
154
154
  # 向用户确认 "当前收件人 alice@example.com,主题「收到」。如果你想先看效果,也可以先去飞书邮件里打开草稿查看详情。确认发送吗?"
@@ -157,13 +157,13 @@ lark-cli mail +send --to alice@example.com --subject '收到' --body '<p>已收
157
157
  lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_id":"<draft_id>"}'
158
158
 
159
159
  # 方式 B: 用户已明确确认时,直接发送
160
- lark-cli mail +send --to alice@example.com --subject '收到' --body '<p>已收到,谢谢!</p>' --confirm-send
160
+ lark-cli mail +send --to 'alice@example.com' --subject '收到' --body '<p>已收到,谢谢!</p>' --confirm-send
161
161
  ```
162
162
 
163
163
  ### 场景 3:用户说"下午 3 点给 Alice 发一封周报"(定时发送)
164
164
  ```bash
165
165
  # Step 1: 创建草稿(定时发送也走草稿流程)
166
- lark-cli mail +send --to alice@example.com --subject '周报' --body '<p>本周进展如下...</p>'
166
+ lark-cli mail +send --to 'alice@example.com' --subject '周报' --body '<p>本周进展如下...</p>'
167
167
  # → 返回 draft_id
168
168
 
169
169
  # Step 2: 向用户确认 "邮件草稿已创建:收件人 alice@example.com,主题「周报」,定时 <目标时间> 发送。确认吗?"
@@ -210,8 +210,8 @@ lark-cli mail user_mailbox.drafts cancel_scheduled_send --params '{"user_mailbox
210
210
  ## 实现说明
211
211
 
212
212
  - 使用 EML 构建器生成完整 MIME 邮件并 base64url 编码后发送。
213
- - `--attach` 作为普通附件添加。相对路径。
214
- - `--inline` 接受 JSON 数组,每项需提供 `cid`(唯一标识符,可用随机十六进制字符串)和 `file_path`(相对路径),作为 inline part 嵌入邮件。
213
+ - `--attach` 作为普通附件添加。多个附件请重复传 `--attach`,每次只放一个相对路径。
214
+ - `--inline` 手动指定 inline 图片时,多个图片请重复传 `--inline`,每次只放一个 JSON object。每项需提供 `cid`(唯一标识符,可用随机十六进制字符串)和 `file_path`(相对路径),作为 inline part 嵌入邮件。
215
215
  - **超大附件**:当附件导致 EML 总大小(headers + body + inline images + attachments,base64 编码后)超过 25 MB 时,超出的文件自动通过 `medias/upload_*` API 上传到云端。HTML 邮件插入与飞书客户端一致的下载卡片;纯文本邮件追加包含文件名、大小和下载链接的文本块。单个文件上限 3 GB,总附件数量上限 250 个。
216
216
 
217
217
  ## 相关命令
@@ -49,11 +49,12 @@ lark-cli mail +template-create --as user \
49
49
  | `--subject <text>` | 否 | 默认主题 |
50
50
  | `--template-content <html>` | 否* | 模板正文。HTML 首选;支持 `<img src="./local.png" />` 相对路径自动上传到 Drive 并改写为 `cid:` |
51
51
  | `--template-content-file <path>` | 否* | 从文件加载正文内容;与 `--template-content` 互斥 |
52
- | `--plain-text` | 否 | 标记为纯文本模式(`is_plain_text_mode=true`)。仍可带内嵌图片,但 `+send --template-id` 套用时会走 plain-text 正文拼接 |
53
- | `--to <emails>` | 否 | 默认收件人列表,逗号分隔,支持 `Name <email>` 格式 |
54
- | `--cc <emails>` | 否 | 默认抄送 |
55
- | `--bcc <emails>` | 否 | 默认密送 |
56
- | `--attach <paths>` | 否 | 非 inline 附件路径,逗号分隔。每个文件按 `--attach` 书写顺序上传到 Drive |
52
+ | `--plain-text` | 否 | 标记为纯文本模式(`is_plain_text_mode=true`)。不可与 `--inline` 同时使用;`+send --template-id` 套用时会走 plain-text 正文拼接 |
53
+ | `--to '<email>'` | 否 | 默认收件人列表。多个默认收件人请重复传 `--to`,每次只放一个地址,参数值用单引号包住。支持 `Name <email>` 格式 |
54
+ | `--cc '<email>'` | 否 | 默认抄送。多个抄送请重复传 `--cc`,每次只放一个地址,参数值用单引号包住 |
55
+ | `--bcc '<email>'` | 否 | 默认密送。多个密送请重复传 `--bcc`,每次只放一个地址,参数值用单引号包住 |
56
+ | `--attach '<path>'` | 否 | 非 inline 附件路径。多个附件请重复传 `--attach`,每次只放一个相对路径,参数值用单引号包住;每个文件按传入顺序上传到 Drive |
57
+ | `--inline '<json>'` | 否 | 手动指定 inline 图片 CID 映射。多个 inline 图片请重复传 `--inline`,每次只放一个 JSON object,并用单引号包住:`'{"cid":"mycid","file_path":"./logo.png"}'`。`file_path` 必须是相对路径;CID 应唯一,例如随机十六进制字符串;在模板正文中用 `<img src="cid:mycid">` 引用 |
57
58
  | `--mailbox <email>` | 否 | 所属邮箱,默认 `me`(当前用户主邮箱) |
58
59
  | `--dry-run` | 否 | 仅打印计划中的 API 调用链,不真实执行 |
59
60
 
@@ -82,7 +83,7 @@ lark-cli mail +template-create --as user \
82
83
  ## 顺序约束
83
84
 
84
85
  - inline 图片按正文中 `<img>` 出现顺序处理
85
- - 非 inline 按 `--attach` 书写顺序处理;重复路径不会去重
86
+ - 非 inline 按 `--attach` 展开顺序处理;重复路径不会去重
86
87
 
87
88
  ## 返回值
88
89
 
@@ -14,7 +14,7 @@
14
14
  |------|------|---------|
15
15
  | `--print-patch-template` | 打印 `--patch-file` 的 JSON 骨架 | 否(纯本地) |
16
16
  | `--inspect` | 返回当前模板完整 projection | 否(只 GET) |
17
- | `--set-*` / `--attach` | 扁平 flag 合并后 PUT | 是 |
17
+ | `--set-*` / `--attach` / `--inline` | 扁平 flag 合并后 PUT | 是 |
18
18
  | `--patch-file` | 结构化 patch + 扁平 flag 合并后 PUT | 是 |
19
19
 
20
20
  ## 命令
@@ -67,10 +67,11 @@ lark-cli mail +template-update --as user --template-id 712345 \
67
67
  | `--set-template-content <html>` | 替换正文。支持 `<img src="./local.png" />` 相对路径自动上传并改写 |
68
68
  | `--set-template-content-file <path>` | 从文件加载替换正文;与 `--set-template-content` 互斥 |
69
69
  | `--set-plain-text` | 标为纯文本模式(置 true)。**不提供不会置 false**;要把 HTML 模板翻回 false,请用 `--patch-file` 的 `{"is_plain_text_mode": false}` |
70
- | `--set-to <emails>` | 替换默认收件人列表 |
71
- | `--set-cc <emails>` | 替换默认抄送 |
72
- | `--set-bcc <emails>` | 替换默认密送 |
73
- | `--attach <paths>` | 追加非 inline 附件(按书写顺序),不替换已有附件 |
70
+ | `--set-to <emails>` | 用单次参数值替换默认收件人列表;多个地址仍在该值内用逗号分隔,传 `--set-to=""` 可清空 |
71
+ | `--set-cc <emails>` | 用单次参数值替换默认抄送;多个地址仍在该值内用逗号分隔,传 `--set-cc=""` 可清空 |
72
+ | `--set-bcc <emails>` | 用单次参数值替换默认密送;多个地址仍在该值内用逗号分隔,传 `--set-bcc=""` 可清空 |
73
+ | `--attach '<path>'` | 追加非 inline 附件,不替换已有附件。多个附件请重复传 `--attach`,每次只放一个相对路径,参数值用单引号包住;按传入顺序上传 |
74
+ | `--inline '<json>'` | 追加 inline 图片,不替换已有附件。多个 inline 图片请重复传 `--inline`,每次只放一个 JSON object,并用单引号包住:`'{"cid":"mycid","file_path":"./logo.png"}'`;`file_path` 必须是相对路径;CID 应唯一,例如随机十六进制字符串;在模板正文中用 `<img src="cid:mycid">` 引用;最终模板为纯文本模式时会被拒绝 |
74
75
 
75
76
  ### 结构化 patch
76
77
 
@@ -105,7 +106,7 @@ patch-file 字段(全部可选,未提供的字段保持当前模板原值)
105
106
 
106
107
  ## DryRun 行为
107
108
 
108
- - 默认:打印 `GET /user_mailboxes/:id/templates/:tid` + Drive 上传步骤(如有 `<img>` 或 `--attach`)+ `PUT` 步骤。
109
+ - 默认:打印 `GET /user_mailboxes/:id/templates/:tid` + Drive 上传步骤(如有 `<img>`、`--attach` 或 `--inline`)+ `PUT` 步骤。
109
110
  - `--inspect`:只打印 `GET`。
110
111
  - `--print-patch-template`:打印骨架,不走任何 API。
111
112