From ade69704428419d662b1a269f3e2ca97d1e0aab1 Mon Sep 17 00:00:00 2001 From: "fengzhihao.infeng" Date: Tue, 31 Mar 2026 16:42:13 +0800 Subject: [PATCH] fix(mail): clarify that file path flags only accept relative paths --- shortcuts/mail/mail_draft_create.go | 4 ++-- shortcuts/mail/mail_draft_edit.go | 15 ++++++------ shortcuts/mail/mail_forward.go | 4 ++-- shortcuts/mail/mail_reply.go | 4 ++-- shortcuts/mail/mail_reply_all.go | 4 ++-- shortcuts/mail/mail_send.go | 4 ++-- .../references/lark-mail-draft-create.md | 4 ++-- .../references/lark-mail-draft-edit.md | 23 ++++++++++--------- .../lark-mail/references/lark-mail-forward.md | 8 +++---- .../references/lark-mail-reply-all.md | 4 ++-- .../lark-mail/references/lark-mail-reply.md | 8 +++---- skills/lark-mail/references/lark-mail-send.md | 8 +++---- 12 files changed, 46 insertions(+), 44 deletions(-) diff --git a/shortcuts/mail/mail_draft_create.go b/shortcuts/mail/mail_draft_create.go index 8b932795a..d6f706903 100644 --- a/shortcuts/mail/mail_draft_create.go +++ b/shortcuts/mail/mail_draft_create.go @@ -43,8 +43,8 @@ var MailDraftCreate = common.Shortcut{ {Name: "cc", Desc: "Optional. Full Cc recipient list. Separate multiple addresses with commas. Display-name format is supported."}, {Name: "bcc", Desc: "Optional. Full Bcc recipient list. Separate multiple addresses with commas. Display-name format is supported."}, {Name: "plain-text", Type: "bool", Desc: "Force plain-text mode, ignoring HTML auto-detection. Cannot be used with --inline."}, - {Name: "attach", Desc: "Optional. Regular attachment file paths. Separate multiple paths with commas. Each path must point to a readable local file."}, - {Name: "inline", Desc: "Optional. Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, + {Name: "attach", Desc: "Optional. Regular attachment file paths (relative path only). Separate multiple paths with commas. Each path must point to a readable local file."}, + {Name: "inline", Desc: "Optional. Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. All file_path values must be relative paths. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, }, DryRun: func(ctx context.Context, runtime *common.RuntimeContext) *common.DryRunAPI { input, err := parseDraftCreateInput(runtime) diff --git a/shortcuts/mail/mail_draft_edit.go b/shortcuts/mail/mail_draft_edit.go index b28d69d18..99061b8bc 100644 --- a/shortcuts/mail/mail_draft_edit.go +++ b/shortcuts/mail/mail_draft_edit.go @@ -32,7 +32,7 @@ var MailDraftEdit = common.Shortcut{ {Name: "set-to", Desc: "Replace the entire To recipient list with the addresses provided here. Separate multiple addresses with commas. Display-name format is supported."}, {Name: "set-cc", Desc: "Replace the entire Cc recipient list with the addresses provided here. Separate multiple addresses with commas. Display-name format is supported."}, {Name: "set-bcc", Desc: "Replace the entire Bcc recipient list with the addresses provided here. Separate multiple addresses with commas. Display-name format is supported."}, - {Name: "patch-file", Desc: "Edit entry point for body edits, incremental recipient changes, header edits, attachment changes, or inline-image changes. All body edits MUST go through --patch-file. Two body ops: set_body (full replacement including quote) and set_reply_body (replaces only user-authored content, auto-preserves quote block). Run --inspect first to check has_quoted_content, then --print-patch-template for the JSON structure."}, + {Name: "patch-file", Desc: "Edit entry point for body edits, incremental recipient changes, header edits, attachment changes, or inline-image changes. All body edits MUST go through --patch-file. Two body ops: set_body (full replacement including quote) and set_reply_body (replaces only user-authored content, auto-preserves quote block). Run --inspect first to check has_quoted_content, then --print-patch-template for the JSON structure. Relative path only."}, {Name: "print-patch-template", Type: "bool", Desc: "Print the JSON template and supported operations for the --patch-file flag. Recommended first step before generating a patch file. No draft read or write is performed."}, {Name: "inspect", Type: "bool", Desc: "Inspect the draft without modifying it. Returns the draft projection including subject, recipients, body summary, has_quoted_content (whether the draft contains a reply/forward quote block), attachments_summary (with part_id and cid for each attachment), and inline_summary. Run this BEFORE editing body to check has_quoted_content: if true, use set_reply_body in --patch-file to preserve the quote; if false, use set_body."}, }, @@ -307,10 +307,10 @@ func buildDraftEditPatchTemplate() map[string]interface{} { {"op": "set_reply_body", "shape": map[string]interface{}{"value": "string (user-authored content only, WITHOUT the quote block; the quote block is re-appended automatically)"}}, {"op": "set_header", "shape": map[string]interface{}{"name": "string", "value": "string"}}, {"op": "remove_header", "shape": map[string]interface{}{"name": "string"}}, - {"op": "add_attachment", "shape": map[string]interface{}{"path": "string"}}, + {"op": "add_attachment", "shape": map[string]interface{}{"path": "string(relative path)"}}, {"op": "remove_attachment", "shape": map[string]interface{}{"target": map[string]interface{}{"part_id": "string(optional)", "cid": "string(optional)"}}}, - {"op": "add_inline", "shape": map[string]interface{}{"path": "string", "cid": "string", "filename": "string(optional)", "content_type": "string(optional)"}}, - {"op": "replace_inline", "shape": map[string]interface{}{"target": map[string]interface{}{"part_id": "string(optional)", "cid": "string(optional)"}, "path": "string", "cid": "string(optional)", "filename": "string(optional)", "content_type": "string(optional)"}}, + {"op": "add_inline", "shape": map[string]interface{}{"path": "string(relative path)", "cid": "string", "filename": "string(optional)", "content_type": "string(optional)"}}, + {"op": "replace_inline", "shape": map[string]interface{}{"target": map[string]interface{}{"part_id": "string(optional)", "cid": "string(optional)"}, "path": "string(relative path)", "cid": "string(optional)", "filename": "string(optional)", "content_type": "string(optional)"}}, {"op": "remove_inline", "shape": map[string]interface{}{"target": map[string]interface{}{"part_id": "string(optional)", "cid": "string(optional)"}}}, }, "supported_ops_by_group": []map[string]interface{}{ @@ -340,10 +340,10 @@ func buildDraftEditPatchTemplate() map[string]interface{} { { "group": "attachments_and_inline", "ops": []map[string]interface{}{ - {"op": "add_attachment", "shape": map[string]interface{}{"path": "string"}}, + {"op": "add_attachment", "shape": map[string]interface{}{"path": "string(relative path)"}}, {"op": "remove_attachment", "shape": map[string]interface{}{"target": map[string]interface{}{"part_id": "string(optional)", "cid": "string(optional)"}}}, - {"op": "add_inline", "shape": map[string]interface{}{"path": "string", "cid": "string", "filename": "string(optional)", "content_type": "string(optional)"}}, - {"op": "replace_inline", "shape": map[string]interface{}{"target": map[string]interface{}{"part_id": "string(optional)", "cid": "string(optional)"}, "path": "string", "cid": "string(optional)", "filename": "string(optional)", "content_type": "string(optional)"}}, + {"op": "add_inline", "shape": map[string]interface{}{"path": "string(relative path)", "cid": "string", "filename": "string(optional)", "content_type": "string(optional)"}}, + {"op": "replace_inline", "shape": map[string]interface{}{"target": map[string]interface{}{"part_id": "string(optional)", "cid": "string(optional)"}, "path": "string(relative path)", "cid": "string(optional)", "filename": "string(optional)", "content_type": "string(optional)"}}, {"op": "remove_inline", "shape": map[string]interface{}{"target": map[string]interface{}{"part_id": "string(optional)", "cid": "string(optional)"}}}, }, }, @@ -360,6 +360,7 @@ func buildDraftEditPatchTemplate() map[string]interface{} { }, "notes": []string{ "`ops` is executed in order", + "all file paths (--patch-file and `path` fields in ops) must be relative — no absolute paths or .. traversal", "all body edits MUST go through --patch-file; there is no --set-body flag", "`set_body` replaces the ENTIRE body including any reply/forward quote block; when the draft has both text/plain and text/html, it updates the HTML body and regenerates the plain-text summary, so the input should be HTML", "`set_reply_body` replaces only the user-authored portion of the body and automatically re-appends the trailing reply/forward quote block (generated by +reply or +forward); the value you pass should contain ONLY the new user-authored content WITHOUT the quote block — the quote block will be re-inserted automatically; if the user wants to modify content INSIDE the quote block, use `set_body` instead for full replacement; if the draft has no quote block, it behaves identically to `set_body`", diff --git a/shortcuts/mail/mail_forward.go b/shortcuts/mail/mail_forward.go index 5b767e677..905bc8afc 100644 --- a/shortcuts/mail/mail_forward.go +++ b/shortcuts/mail/mail_forward.go @@ -30,8 +30,8 @@ var MailForward = common.Shortcut{ {Name: "cc", Desc: "CC email address(es), comma-separated"}, {Name: "bcc", Desc: "BCC email address(es), comma-separated"}, {Name: "plain-text", Type: "bool", Desc: "Force plain-text mode, ignoring all HTML auto-detection. Cannot be used with --inline."}, - {Name: "attach", Desc: "Attachment file path(s), comma-separated (appended after original attachments)"}, - {Name: "inline", Desc: "Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, + {Name: "attach", Desc: "Attachment file path(s), comma-separated, appended after original attachments (relative path only)"}, + {Name: "inline", Desc: "Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. All file_path values must be relative paths. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, {Name: "confirm-send", Type: "bool", Desc: "Send the forward immediately instead of saving as draft. Only use after the user has explicitly confirmed recipients and content."}, }, DryRun: func(ctx context.Context, runtime *common.RuntimeContext) *common.DryRunAPI { diff --git a/shortcuts/mail/mail_reply.go b/shortcuts/mail/mail_reply.go index 638665e2d..b89bc5d69 100644 --- a/shortcuts/mail/mail_reply.go +++ b/shortcuts/mail/mail_reply.go @@ -28,8 +28,8 @@ var MailReply = common.Shortcut{ {Name: "cc", Desc: "Additional CC email address(es), comma-separated"}, {Name: "bcc", Desc: "BCC email address(es), comma-separated"}, {Name: "plain-text", Type: "bool", Desc: "Force plain-text mode, ignoring all HTML auto-detection. Cannot be used with --inline."}, - {Name: "attach", Desc: "Attachment file path(s), comma-separated"}, - {Name: "inline", Desc: "Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, + {Name: "attach", Desc: "Attachment file path(s), comma-separated (relative path only)"}, + {Name: "inline", Desc: "Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. All file_path values must be relative paths. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, {Name: "confirm-send", Type: "bool", Desc: "Send the reply immediately instead of saving as draft. Only use after the user has explicitly confirmed recipients and content."}, }, DryRun: func(ctx context.Context, runtime *common.RuntimeContext) *common.DryRunAPI { diff --git a/shortcuts/mail/mail_reply_all.go b/shortcuts/mail/mail_reply_all.go index 91d600bf0..6b82365ef 100644 --- a/shortcuts/mail/mail_reply_all.go +++ b/shortcuts/mail/mail_reply_all.go @@ -29,8 +29,8 @@ var MailReplyAll = common.Shortcut{ {Name: "bcc", Desc: "BCC email address(es), comma-separated"}, {Name: "remove", Desc: "Address(es) to exclude from the outgoing reply, comma-separated"}, {Name: "plain-text", Type: "bool", Desc: "Force plain-text mode, ignoring all HTML auto-detection. Cannot be used with --inline."}, - {Name: "attach", Desc: "Attachment file path(s), comma-separated"}, - {Name: "inline", Desc: "Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, + {Name: "attach", Desc: "Attachment file path(s), comma-separated (relative path only)"}, + {Name: "inline", Desc: "Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. All file_path values must be relative paths. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, {Name: "confirm-send", Type: "bool", Desc: "Send the reply immediately instead of saving as draft. Only use after the user has explicitly confirmed recipients and content."}, }, DryRun: func(ctx context.Context, runtime *common.RuntimeContext) *common.DryRunAPI { diff --git a/shortcuts/mail/mail_send.go b/shortcuts/mail/mail_send.go index 71c429df1..43b63826b 100644 --- a/shortcuts/mail/mail_send.go +++ b/shortcuts/mail/mail_send.go @@ -28,8 +28,8 @@ var MailSend = common.Shortcut{ {Name: "cc", Desc: "CC email address(es), comma-separated"}, {Name: "bcc", Desc: "BCC email address(es), comma-separated"}, {Name: "plain-text", Type: "bool", Desc: "Force plain-text mode, ignoring HTML auto-detection. Cannot be used with --inline."}, - {Name: "attach", Desc: "Attachment file path(s), comma-separated"}, - {Name: "inline", Desc: "Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, + {Name: "attach", Desc: "Attachment file path(s), comma-separated (relative path only)"}, + {Name: "inline", Desc: "Inline images as a JSON array. Each entry: {\"cid\":\"\",\"file_path\":\"\"}. All file_path values must be relative paths. Cannot be used with --plain-text. CID images are embedded via in the HTML body. CID is a unique identifier, e.g. a random hex string like \"a1b2c3d4e5f6a7b8c9d0\"."}, {Name: "confirm-send", Type: "bool", Desc: "Send the email immediately instead of saving as draft. Only use after the user has explicitly confirmed recipients and content."}, }, DryRun: func(ctx context.Context, runtime *common.RuntimeContext) *common.DryRunAPI { diff --git a/skills/lark-mail/references/lark-mail-draft-create.md b/skills/lark-mail/references/lark-mail-draft-create.md index 86ea2841e..7a33cd7cb 100644 --- a/skills/lark-mail/references/lark-mail-draft-create.md +++ b/skills/lark-mail/references/lark-mail-draft-create.md @@ -48,8 +48,8 @@ lark-cli mail +draft-create --to alice@example.com --subject '测试' --body 'te | `--cc ` | 否 | 完整抄送列表,多个用逗号分隔 | | `--bcc ` | 否 | 完整密送列表,多个用逗号分隔 | | `--plain-text` | 否 | 强制纯文本模式,忽略 HTML 自动检测。不可与 `--inline` 同时使用 | -| `--attach ` | 否 | 普通附件文件路径,多个用逗号分隔 | -| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid`(唯一标识符,可用随机十六进制字符串,如 `a1b2c3d4e5f6a7b8c9d0`)和 `file_path`。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用,在 body 中用 `` 引用 | +| `--attach ` | 否 | 普通附件文件路径,多个用逗号分隔。相对路径 | +| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid`(唯一标识符,可用随机十六进制字符串,如 `a1b2c3d4e5f6a7b8c9d0`)和 `file_path`(相对路径)。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用,在 body 中用 `` 引用 | | `--format ` | 否 | 输出格式:`json`(默认)/ `pretty` / `table` / `ndjson` / `csv` | | `--dry-run` | 否 | 仅打印请求,不执行 | diff --git a/skills/lark-mail/references/lark-mail-draft-edit.md b/skills/lark-mail/references/lark-mail-draft-edit.md index c31320904..6831700ca 100644 --- a/skills/lark-mail/references/lark-mail-draft-edit.md +++ b/skills/lark-mail/references/lark-mail-draft-edit.md @@ -69,7 +69,7 @@ lark-cli mail +draft-edit --draft-id --set-subject '测试' --dry-run | `--set-to ` | 否 | 用此处提供的地址替换整个 To 收件人列表 | | `--set-cc ` | 否 | 用此处提供的地址替换整个 Cc 抄送列表 | | `--set-bcc ` | 否 | 用此处提供的地址替换整个 Bcc 密送列表 | -| `--patch-file ` | 否 | 所有正文编辑、增量收件人编辑、邮件头编辑、附件变更和内嵌图片变更的入口。先运行 `--print-patch-template` 查看 JSON 结构 | +| `--patch-file ` | 否 | 所有正文编辑、增量收件人编辑、邮件头编辑、附件变更和内嵌图片变更的入口。相对路径。先运行 `--print-patch-template` 查看 JSON 结构 | | `--print-patch-template` | 否 | 打印 `--patch-file` 的 JSON 模板和支持的操作。建议在生成补丁文件前先运行此命令。不会读取或写入草稿 | | `--inspect` | 否 | 查看草稿但不修改。返回包含 `has_quoted_content`(是否有引用区)、`attachments_summary`(含每个附件的 `part_id`、`cid`、`filename`)和 `inline_summary` 的草稿投影 | | `--format ` | 否 | 输出格式:`json`(默认)/ `pretty` / `table` / `ndjson` / `csv` | @@ -222,6 +222,7 @@ lark-cli mail +draft-edit --draft-id --inspect - `ops` 按顺序执行 - `target` 接受 `part_id` 或 `cid`;优先级:`part_id` > `cid` +- **所有文件路径(`--patch-file` 及 ops 中的 `path`)必须为相对路径** - **正文编辑没有 flag,必须通过 `--patch-file`** - **`set_body` 是完整替换** — 它替换整个正文内容(包括引用区) - **`set_reply_body` 仅替换引用区前面的用户撰写部分** — 引用区自动重新拼接;value 只传用户撰写内容,不要包含引用区;如果用户要修改引用区内容,用 `set_body` 全量覆盖 @@ -250,10 +251,10 @@ lark-cli mail +draft-edit --draft-id --inspect lark-cli mail +draft-edit --draft-id --inspect # 2. 编辑草稿(元数据用 flag,正文用 patch-file) -cat > /tmp/patch.json << 'EOF' +cat > ./patch.json << 'EOF' { "ops": [{ "op": "set_body", "value": "

更新后的内容

" }] } EOF -lark-cli mail +draft-edit --draft-id --set-subject '最终版本' --patch-file /tmp/patch.json +lark-cli mail +draft-edit --draft-id --set-subject '最终版本' --patch-file ./patch.json # 3. 发送草稿 lark-cli mail user_mailbox.drafts send --params '{"user_mailbox_id":"me","draft_id":""}' @@ -271,10 +272,10 @@ lark-cli mail +draft-edit --draft-id --inspect # body_html_summary: "
原有回复内容
..." # 2. 使用 set_reply_body 编辑正文(value 只传用户撰写内容,不含引用区) -cat > /tmp/patch.json << 'EOF' +cat > ./patch.json << 'EOF' { "ops": [{ "op": "set_reply_body", "value": "

修改后的回复内容

" }] } EOF -lark-cli mail +draft-edit --draft-id --patch-file /tmp/patch.json +lark-cli mail +draft-edit --draft-id --patch-file ./patch.json ``` **注意:** 如果误用 `set_body`,引用区将被覆盖丢失。如果用户明确要去掉引用区或修改引用区内容,则应使用 `set_body`。 @@ -288,7 +289,7 @@ lark-cli mail +draft-edit --draft-id --inspect # [{"part_id":"1.3","filename":"report.pdf","content_type":"application/pdf"}] # 2. 编写补丁文件,使用步骤 1 中获取的 part_id -cat > /tmp/patch.json << 'EOF' +cat > ./patch.json << 'EOF' { "ops": [ { "op": "remove_attachment", "target": { "part_id": "1.3" } } @@ -298,7 +299,7 @@ cat > /tmp/patch.json << 'EOF' EOF # 3. 应用补丁 -lark-cli mail +draft-edit --draft-id --patch-file /tmp/patch.json +lark-cli mail +draft-edit --draft-id --patch-file ./patch.json ``` ### 在正文中插入内嵌图片 @@ -313,7 +314,7 @@ lark-cli mail +draft-edit --draft-id --inspect # projection.inline_summary: [{"part_id":"1.1.2","cid":"existing.png", ...}] # 2. 编写补丁(注意:回复草稿用 set_reply_body,普通草稿用 set_body) -cat > /tmp/patch.json << 'EOF' +cat > ./patch.json << 'EOF' { "ops": [ { "op": "set_body", "value": "
原有内容
" }, @@ -324,7 +325,7 @@ cat > /tmp/patch.json << 'EOF' EOF # 3. 应用补丁 -lark-cli mail +draft-edit --draft-id --patch-file /tmp/patch.json +lark-cli mail +draft-edit --draft-id --patch-file ./patch.json ``` ### 使用 patch-file 进行高级编辑 @@ -334,7 +335,7 @@ lark-cli mail +draft-edit --draft-id --patch-file /tmp/patch.json lark-cli mail +draft-edit --print-patch-template # 2. 编写补丁文件(例如添加一个抄送并移除一个附件) -cat > /tmp/patch.json << 'EOF' +cat > ./patch.json << 'EOF' { "ops": [ { "op": "add_recipient", "field": "cc", "address": "carol@example.com", "name": "Carol" }, @@ -345,7 +346,7 @@ cat > /tmp/patch.json << 'EOF' EOF # 3. 应用补丁 -lark-cli mail +draft-edit --draft-id --patch-file /tmp/patch.json +lark-cli mail +draft-edit --draft-id --patch-file ./patch.json ``` ## 相关命令 diff --git a/skills/lark-mail/references/lark-mail-forward.md b/skills/lark-mail/references/lark-mail-forward.md index 42cd97173..81fbc2c60 100644 --- a/skills/lark-mail/references/lark-mail-forward.md +++ b/skills/lark-mail/references/lark-mail-forward.md @@ -63,8 +63,8 @@ lark-cli mail +forward --message-id <邮件ID> --to alice@example.com --dry-run | `--cc ` | 否 | 抄送邮箱,多个用逗号分隔 | | `--bcc ` | 否 | 密送邮箱,多个用逗号分隔 | | `--plain-text` | 否 | 强制纯文本模式,忽略所有 HTML 自动检测。不可与 `--inline` 同时使用 | -| `--attach ` | 否 | 附件文件路径,多个用逗号分隔(追加在原邮件附件之后) | -| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid`(唯一标识符,可用随机十六进制字符串,如 `a1b2c3d4e5f6a7b8c9d0`)和 `file_path`。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用,在 body 中用 `` 引用 | +| `--attach ` | 否 | 附件文件路径,多个用逗号分隔,追加在原邮件附件之后。相对路径 | +| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid`(唯一标识符,可用随机十六进制字符串,如 `a1b2c3d4e5f6a7b8c9d0`)和 `file_path`(相对路径)。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用,在 body 中用 `` 引用 | | `--confirm-send` | 否 | 确认发送转发(默认只保存草稿)。仅在用户明确确认后使用 | | `--dry-run` | 否 | 仅打印请求,不执行 | @@ -157,10 +157,10 @@ lark-cli mail user_mailbox.messages batch_modify_message --params '{"user_mailbo ```bash # 编辑转发草稿正文(自动保留引用区) -cat > /tmp/patch.json << 'EOF' +cat > ./patch.json << 'EOF' { "ops": [{ "op": "set_reply_body", "value": "

修改后的转发附言

" }] } EOF -lark-cli mail +draft-edit --draft-id --patch-file /tmp/patch.json +lark-cli mail +draft-edit --draft-id --patch-file ./patch.json ``` 如果用户要修改引用区内容或去掉引用区,则使用 `set_body` 全量替换。 diff --git a/skills/lark-mail/references/lark-mail-reply-all.md b/skills/lark-mail/references/lark-mail-reply-all.md index 576fab3fa..c8a7f6020 100644 --- a/skills/lark-mail/references/lark-mail-reply-all.md +++ b/skills/lark-mail/references/lark-mail-reply-all.md @@ -67,8 +67,8 @@ lark-cli mail +reply-all --message-id <邮件ID> --body '测试' --dry-run | `--bcc ` | 否 | 密送邮箱,多个用逗号分隔 | | `--remove ` | 否 | 从自动聚合结果中排除的邮箱,多个用逗号分隔 | | `--plain-text` | 否 | 强制纯文本模式,忽略所有 HTML 自动检测。不可与 `--inline` 同时使用 | -| `--attach ` | 否 | 附件文件路径,多个用逗号分隔 | -| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid`(唯一标识符,可用随机十六进制字符串,如 `a1b2c3d4e5f6a7b8c9d0`)和 `file_path`。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用,在 body 中用 `` 引用 | +| `--attach ` | 否 | 附件文件路径,多个用逗号分隔。相对路径 | +| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid`(唯一标识符,可用随机十六进制字符串,如 `a1b2c3d4e5f6a7b8c9d0`)和 `file_path`(相对路径)。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用,在 body 中用 `` 引用 | | `--confirm-send` | 否 | 确认发送回复(默认只保存草稿)。仅在用户明确确认后使用 | | `--dry-run` | 否 | 仅打印请求,不执行 | diff --git a/skills/lark-mail/references/lark-mail-reply.md b/skills/lark-mail/references/lark-mail-reply.md index baa513067..3a23d365a 100644 --- a/skills/lark-mail/references/lark-mail-reply.md +++ b/skills/lark-mail/references/lark-mail-reply.md @@ -70,8 +70,8 @@ lark-cli mail +reply --message-id <邮件ID> --body '

测试

' --dry-run | `--cc ` | 否 | 抄送邮箱,多个用逗号分隔 | | `--bcc ` | 否 | 密送邮箱,多个用逗号分隔 | | `--plain-text` | 否 | 强制纯文本模式,忽略所有 HTML 自动检测。不可与 `--inline` 同时使用 | -| `--attach ` | 否 | 附件文件路径,多个用逗号分隔 | -| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid`(唯一标识符,可用随机十六进制字符串,如 `a1b2c3d4e5f6a7b8c9d0`)和 `file_path`。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用,在 body 中用 `` 引用 | +| `--attach ` | 否 | 附件文件路径,多个用逗号分隔。相对路径 | +| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid`(唯一标识符,可用随机十六进制字符串,如 `a1b2c3d4e5f6a7b8c9d0`)和 `file_path`(相对路径)。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用,在 body 中用 `` 引用 | | `--confirm-send` | 否 | 确认发送回复(默认只保存草稿)。仅在用户明确确认后使用 | | `--dry-run` | 否 | 仅打印请求,不执行 | @@ -162,10 +162,10 @@ lark-cli mail user_mailbox.messages batch_modify_message --params '{"user_mailbo ```bash # 编辑回复草稿正文(自动保留引用区) -cat > /tmp/patch.json << 'EOF' +cat > ./patch.json << 'EOF' { "ops": [{ "op": "set_reply_body", "value": "

修改后的回复内容

" }] } EOF -lark-cli mail +draft-edit --draft-id --patch-file /tmp/patch.json +lark-cli mail +draft-edit --draft-id --patch-file ./patch.json ``` 如果用户要修改引用区内容或去掉引用区,则使用 `set_body` 全量替换。 diff --git a/skills/lark-mail/references/lark-mail-send.md b/skills/lark-mail/references/lark-mail-send.md index 092e82924..dd196c129 100644 --- a/skills/lark-mail/references/lark-mail-send.md +++ b/skills/lark-mail/references/lark-mail-send.md @@ -67,8 +67,8 @@ lark-cli mail +send --to alice@example.com --subject '测试' --body '

test

` | 否 | 抄送邮箱,多个用逗号分隔 | | `--bcc ` | 否 | 密送邮箱,多个用逗号分隔 | | `--plain-text` | 否 | 强制纯文本模式,忽略 HTML 自动检测。不可与 `--inline` 同时使用 | -| `--attach ` | 否 | 附件文件路径,多个用逗号分隔 | -| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid` 和 `file_path`。CID 为唯一标识符,可使用随机十六进制字符串(如 `a1b2c3d4e5f6a7b8c9d0`)。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用 | +| `--attach ` | 否 | 附件文件路径,多个用逗号分隔。相对路径 | +| `--inline ` | 否 | 内嵌图片 JSON 数组,每项包含 `cid` 和 `file_path`(相对路径)。CID 为唯一标识符,可使用随机十六进制字符串(如 `a1b2c3d4e5f6a7b8c9d0`)。格式:`'[{"cid":"a1b2c3d4e5f6a7b8c9d0","file_path":"./logo.png"}]'`。不可与 `--plain-text` 同时使用 | | `--confirm-send` | 否 | 确认发送邮件(默认只保存草稿)。仅在用户明确确认收件人和内容后使用 | | `--dry-run` | 否 | 仅打印请求,不执行 | @@ -131,8 +131,8 @@ lark-cli mail user_mailbox.messages send_status --params '{"user_mailbox_id":"me ## 实现说明 - 使用 EML 构建器生成完整 MIME 邮件并 base64url 编码后发送。 -- `--attach` 作为普通附件添加。 -- `--inline` 接受 JSON 数组,每项需提供 `cid`(唯一标识符,可用随机十六进制字符串)和 `file_path`,作为 inline part 嵌入邮件。 +- `--attach` 作为普通附件添加。相对路径。 +- `--inline` 接受 JSON 数组,每项需提供 `cid`(唯一标识符,可用随机十六进制字符串)和 `file_path`(相对路径),作为 inline part 嵌入邮件。 ## 相关命令