Loading...
Loading...
飞书云盘增强命令组。分块上传大文件(>20MB 自动 3 段式)、流式下载、 文档异步导出(markdown 快捷路径 / sheet+bitable csv / sub-id / 有界轮询 + resume)、 文档异步导入、文件/文件夹移动(folder 自动轮询)、富文本评论(text/mention_user/link + wiki URL 解析 + 局部评论)、通用异步任务查询。 当用户请求"上传大文件"、"下载云盘文件"、"导出为 pdf/markdown/xlsx"、"导入 docx 到云文档"、"移动文件夹"、"添加文档评论"、"@某人评论文档"、"从 wiki 链接评论"、 "查询异步任务状态"、"drive 任务 resume"、"分块上传"、"feishu drive"、"lark drive"时使用。 本 skill 与老的 file/media/comment 命令组并存,提供更强能力(User Token 支持、 异步 resume、富文本评论),基础场景仍可用 file/media。
npx skill4agent add riba2534/feishu-cli feishu-cli-drivedrivefilemediacomment addfeishu-cli:如尚未安装,请前往 riba2534/feishu-cli 获取安装方式。
drivefeishu-cli auth loginfeishu-cli auth check --scope "drive:file:upload"# 上传(>20MB 自动走 3 段式分块 upload_prepare/upload_part/upload_finish)
feishu-cli drive upload --file /tmp/report.pdf
feishu-cli drive upload --file /tmp/big.zip --folder-token fldxxx --name "年度报告.zip"
# 下载(流式 + 路径校验 + --overwrite + --timeout)
feishu-cli drive download --file-token boxcnxxxx --output ./report.pdf
feishu-cli drive download --file-token boxcnxxxx --output ./downloads/ --overwrite
feishu-cli drive download --file-token boxcnxxxx --output ./big.zip --timeout 10mdrive uploadio.SectionReaderdrive download--outputfile_token--output ./downloads/report.pdf# docx → markdown:走 /docs/v1/content 快捷路径,立即返回(不跑异步 export_tasks)
feishu-cli drive export --token docxxxx --doc-type docx --file-extension markdown --output-dir ./exports
# docx → pdf:走异步 export_tasks,有界轮询 10×5s,超时返回 next_command
feishu-cli drive export --token docxxxx --doc-type docx --file-extension pdf --output-dir ./exports
# sheet → csv 指定 sheet_id
feishu-cli drive export --token sheetxxxx --doc-type sheet --file-extension csv --sub-id sheet_1
# bitable → csv 指定 table_id
feishu-cli drive export --token basexxxx --doc-type bitable --file-extension csv --sub-id tblxxxx--doc-typedocdocxsheetbitable--file-extensiondocxpdfxlsxcsvmarkdown# drive export 超时会输出:
# next_command: feishu-cli drive task-result --scenario export --ticket abc --file-token xxx
# 1. 轮询任务状态
feishu-cli drive task-result --scenario export --ticket abc --file-token xxx
# 2. 任务完成后下载产物
feishu-cli drive export-download --file-token boxxxx --output-dir ./exportsdrive export-downloadfeishu-cli drive export-download --file-token boxxxx --output-dir ./exports
feishu-cli drive export-download --file-token boxxxx --file-name "报告.pdf" --overwrite# 本地文件 → 云文档(docx / sheet / bitable)
feishu-cli drive import --file report.docx --type docx
feishu-cli drive import --file data.xlsx --type sheet --folder-token fldxxx
feishu-cli drive import --file bigsheet.csv --type bitable --folder-token fldxxx
# 大文件(>20MB)自动走分块媒体上传
feishu-cli drive import --file big.docx --type docx/medias/upload_allparent_type=ccm_import_openextradoc import-filenext_command# 文件移动(同步,立即返回)
feishu-cli drive move --file-token boxxxx --type docx --folder-token fldxxx
# 文件夹移动(异步,自动轮询 task_check 30×2s)
feishu-cli drive move --file-token fldxxx --type folder --folder-token fldyyytask_iddrive task-result --scenario task_check# 全局评论
feishu-cli drive add-comment --doc doccnxxxx --content '[{"type":"text","text":"需要修改标题"}]'
# 通过 docx URL
feishu-cli drive add-comment --doc "https://xxx.feishu.cn/docx/doccnxxxx" \
--content '[{"type":"text","text":"评论内容"}]'
# 通过 wiki URL(自动解析到真实 docx)
feishu-cli drive add-comment --doc "https://xxx.feishu.cn/wiki/nodxxxx" \
--content '[{"type":"text","text":"收到"}]'
# 局部评论(锚定到 docx block)
feishu-cli drive add-comment --doc doccnxxxx --block-id blk_xxx \
--content '[{"type":"text","text":"这段重写"}]'
# 富文本:文本 + 提及用户 + 链接混合
feishu-cli drive add-comment --doc doccnxxxx --content '[
{"type":"text","text":"请 "},
{"type":"mention_user","mention_user":"ou_xxx"},
{"type":"text","text":" 查看 "},
{"type":"link","link":"https://feishu.cn"}
]'textmention_usermention_usertextlinklinktextdocxdocxhttps://xxx.feishu.cn/docx/xxxdocwiki# 查询导入任务
feishu-cli drive task-result --scenario import --ticket abcxxx
# 查询导出任务(需要额外传 file-token 作为原始文档 token)
feishu-cli drive task-result --scenario export --ticket abcxxx --file-token docxxxx
# 查询 folder move 等通用任务
feishu-cli drive task-result --scenario task_check --task-id taskxxximportexporttask_checkdrive exportdrive importdrive movefeishu-cli drive upload --file big_video.mp4 --folder-token fldxxx --name "会议录像.mp4"
# 自动走分块,stderr 输出分片进度
# 上传: 会议录像.mp4 (104857600 bytes)
# 分片上传: 文件大小 100.0 MB, 分片大小 4.0 MB, 共 25 个分片
# 分片 1/25 上传完成 (4.0 MB)
# ...
# file_token 返回后可直接在飞书里访问# 通过 /docs/v1/content 快捷路径,秒出不用等
for doc_id in doc1 doc2 doc3; do
feishu-cli drive export --token $doc_id --doc-type docx --file-extension markdown --output-dir ./docs
done# 1. 触发导出
TICKET=$(feishu-cli drive export --token docxxxxx --doc-type docx --file-extension pdf -o json | jq -r '.ticket // empty')
# 2. 如果超时,输出会带 next_command
# 手动或脚本化接力:
feishu-cli drive task-result --scenario export --ticket $TICKET --file-token docxxxxx
# 3. 任务就绪后下载产物
feishu-cli drive export-download --file-token boxxxx --output-dir ./exports# 不需要先解析 wiki 到 docx,drive add-comment 自动反查
feishu-cli drive add-comment \
--doc "https://xxx.feishu.cn/wiki/nodxxxxx" \
--content '[
{"type":"text","text":"收到,已处理 "},
{"type":"mention_user","mention_user":"ou_abc123"}
]'# drive import 走临时媒体(不污染云盘)
feishu-cli drive import --file report.docx --type docx --folder-token fldxxx
# 大文件(>20MB)同样走分块
feishu-cli drive import --file big_sheet.xlsx --type sheet --folder-token fldxxx| 老命令 | 新 drive 命令 | 差异 |
|---|---|---|
| | drive 支持 User Token + 分块 + 每片重试 |
| | drive 支持 User Token + |
| | drive 文件夹移动自动轮询 task_check |
| | drive 增加 markdown 快捷路径 + sub-id + resume |
| | drive 走 |
| | drive 支持富文本 + wiki 解析 + 局部评论 |
drive| 命令 | 所需 scope |
|---|---|
| |
| |
| |
| |
| |
| |
| |
drivefeishu-cli auth loginnext_commanddocxdoc--block-iddrive download--outputfile_tokenminutes downloadContent-Disposition > filename* > Content-Type 推导扩展名 > {token}.media