lark-markdown
Markdown file operations for Feishu Drive: create, read, edit, patch, and compare native .md files.
- Five core commands: create new files, fetch remote content, overwrite existing files, apply local text/regex patches, and diff versions or remote vs. local drafts
- Patch operation downloads the full file, applies replacements locally, then re-uploads; supports single pattern-content pairs and rejects empty results
- File names must explicitly include
.mdsuffix; content input accepts strings, local files via@file, or stdin via- - Requires
lark-clibinary and authentication via shared Feishu credentials; file management tasks like rename, move, delete, and permissions belong inlark-driveskill
markdown (v1)
CRITICAL — 开始前 MUST 先用 Read 工具读取 ../lark-shared/SKILL.md,其中包含认证、权限处理
快速决策
-
身份:Markdown 文件通常属于用户云空间资源,优先使用
--as user。如为自动化场景,或应用已创建并持有目标文件权限,可按场景使用--as bot。首次以user身份访问前执行lark-cli auth login -
markdown +create/+overwrite失败时,先判断是不是身份和权限问题:bot更常见的是 app scope 或目标目录 ACL,user更常见的是用户授权或用户 ACL;不要不加判断地来回切身份重试。 -
用户要上传、创建一个原生
.md文件,使用lark-cli markdown +create -
用户要比较原生
.md文件的历史版本差异,或比较远端 Markdown 与本地草稿,使用lark-cli markdown +diff -
用户要读取 Drive 里某个
.md文件内容,使用lark-cli markdown +fetch -
用户要对 Markdown 文件做局部文本替换 / 正则替换,优先使用
lark-cli markdown +patch -
用户要覆盖更新 Drive 里某个
.md文件内容,使用lark-cli markdown +overwrite -
用户要先拿 Markdown 文件的历史版本号,再做比较/下载/回滚,先用
lark-drive的lark-cli drive +version-history -
用户要把本地 Markdown 导入成在线新版文档(docx),不要用本 skill,改用
lark-drive的lark-cli drive +import --type docx -
用户要对 Markdown 文件做rename / move / delete / 搜索 / 权限 / 评论等云空间(云盘/云存储)操作,不要留在本 skill,切到
lark-drive -
markdown +create/+overwrite命中missing scope、permission denied、not found、version limit时,默认停止重试并按报错 hint 处理;只有rate limit或临时网络错误才做有限重试。