← 返回 Skills 市场
jachian-lee

feishu-doc-reviewer

作者 Jachian-lee · GitHub ↗ · v1.0.3 · MIT-0
cross-platform ⚠ suspicious
258
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install feishu-doc-reviewer
功能描述
为智能体提供飞书文档读写能力:导出全文、读取评论与段落、写回修改并回复评论。
使用说明 (SKILL.md)

飞书文档 AI 自动审阅与修改

本技能为 Claude Code / OpenClaw 等智能体提供飞书文档的读写工具,便于在对话中基于全文上下文与批注要求完成修改并写回。

核心能力

  • 获取评论: 自动提取文档中未解决的评论,支持按关键词筛选。
  • 读取原文: 获取评论对应段落内容,或导出全文 Markdown 供理解上下文。
  • 写回修改: 直接通过 API 更新文档段落内容。
  • 删除段落:
    • delete_block: 清空整个块内容
    • delete_text_from_block: 只删除选中的文本(保留块中其他内容)⭐
  • 结果反馈: 在评论区回复修改结果,并标记为 [AI-DONE]。
  • 智能识别: 自动从评论 quote 中识别对应的块 ID。

使用方法

MCP 协议 (Claude / OpenClaw)

在对话中,您可以直接下达指令,例如:

"请审阅文档 doxcnABC123,只处理包含'格式错误'的评论,并将修改后的语气调整为正式商务风格。"

推荐用法:让 Claude Code 自己推理(无需外部 LLM 配置)

在 Claude Code / OpenClaw 的对话过程中,通常希望由宿主模型完成"怎么改"的推理,本技能只负责"读/写飞书"。

可用的原子工具:

  • get_comments(document_token): 获取评论列表
  • get_block(document_id, block_id): 获取指定块的文本内容
  • update_block(document_id, block_id, new_text): 更新块内容
  • delete_block(document_id, block_id): 清空整个块内容
  • delete_text_from_block(document_id, block_id, text_to_delete): 只删除块中选中的文本
  • reply_comment(file_token, comment_id, content): 回复评论
  • resolve_comment(file_token, comment_id): 标记评论为已解决

CLI 工具

技能提供命令行工具,可直接处理评论:

cd /path/to/.openclaw/workspace/skills/feishu-doc-reviewer

# ⭐ 推荐:只删除批注选中的内容(保留块中其他内容)
python3 process_comment.py \x3Cdocument_token> \x3Ccomment_id> --action delete_selected

# 删除整个段落(清空块)
python3 process_comment.py \x3Cdocument_token> \x3Ccomment_id> --action delete

# 修改段落内容
python3 process_comment.py \x3Cdocument_token> \x3Ccomment_id> --action modify --new-content "新内容"

# 仅回复评论(自定义处理)
python3 process_comment.py \x3Cdocument_token> \x3Ccomment_id> --action custom

# 指定块 ID(不传则自动识别)
python3 process_comment.py \x3Cdocument_token> \x3Ccomment_id> --block-id doxcnXXX

源代码结构

核心代码位于 src/ 目录下:

  • src/feishu_api.py: 飞书接口层,封装了认证、获取评论、读取/更新/删除文档块等 API 调用。
  • src/config.py: 配置管理,读取环境变量。
  • process_comment.py: 评论处理工具,实现评论处理的完整流程(获取评论→处理块→回复→标记解决)。

配置要求

请确保项目根目录下的 .env 文件包含以下配置:

FEISHU_APP_ID=cli_xxx
FEISHU_APP_SECRET=xxx

依赖安装

使用 pip 安装所需依赖:

pip install -r requirements.txt

API 说明

delete_block vs delete_text_from_block

方法 功能 使用场景
delete_block 清空整个块内容 整个段落都需要删除
delete_text_from_block 只删除块中选中的文本 只删除批注选中的部分,保留块中其他内容 ⭐

delete_text_from_block 实现说明:

  1. 首先获取块的当前内容
  2. 从评论的 quote 字段获取要删除的文本
  3. 从块内容中移除该文本
  4. PATCH 更新块
# 只删除选中的文本
result = api.delete_text_from_block(document_id, block_id, text_to_delete)
if result.get("ok"):
    print(f"删除后内容:{result.get('new_content')}")

resolve_comment 注意事项

必须使用 PATCH 方法,使用 PUT 会返回 404。

# 正确 ✅
response = requests.patch(url, headers=headers, json={"is_solved": True})

# 错误 ❌
response = requests.put(url, headers=headers, json={"is_solved": True})  # 返回 404

常见问题

Q: 为什么删除块返回 403 或 404?

A: 可能的原因:

  1. 应用缺少 docx:document:write 权限 → 在飞书开放平台添加权限
  2. 使用了错误的 API 路径 → 使用 PATCH 而非 DELETE
  3. Token 过期 → 重新获取 tenant_access_token

Q: 如何识别评论对应的块 ID?

A: process_comment.py 工具已实现自动识别逻辑:

  1. 从评论的 quote 字段获取选中的文本
  2. 遍历文档块,匹配内容
  3. 返回匹配的块 ID

如果自动识别失败,可以手动指定 --block-id

Q: delete_selected 和 delete 有什么区别?

A:

  • delete_selected(推荐):只删除批注选中的文本,保留块中其他内容
  • delete:清空整个块内容

例如,如果一个块包含 A+B+C 三段内容,批注只选中了 B:

  • delete_selected → 删除 B,保留 A+C
  • delete → 删除 A+B+C(整个块清空)
安全使用建议
This skill appears to do what it claims — read comments and modify Feishu docs — and includes the necessary code. However: (1) the package/registry metadata omits required environment variables; you must provide FEISHU_APP_ID and FEISHU_APP_SECRET (and optionally FEISHU_BASE_URL) in a .env or environment for it to work. (2) The skill will be able to modify and delete document content and post replies once given valid credentials — grant only a dedicated app with the minimum permissions needed, and add the app only to documents you trust. (3) Review the code yourself (feishu_api.py, process_comment.py, mcp_server.py) before running; running the MCP server gives the agent programmatic write access. (4) Prefer using an app with limited scope/tenant and test on non-production documents first. The metadata omission is an indicator of sloppy packaging (or incomplete registry data) rather than overt malice, but you should proceed cautiously.
功能分析
Type: OpenClaw Skill Name: feishu-doc-reviewer Version: 1.0.3 The skill bundle provides legitimate Feishu (Lark) document management capabilities but contains a critical command injection vulnerability in `run-tool.sh`. The script uses `python3 -c` to execute Python code containing unsanitized shell variables (`$NEW_TEXT`, `$CONTENT`), which allows for arbitrary Python code execution if an attacker provides a crafted document comment or input. While no clear evidence of intentional malice (like data exfiltration to third parties) was found, the high-risk execution pattern in `run-tool.sh` and the broad document write permissions required make it a significant security risk.
能力评估
Purpose & Capability
The name/description (Feishu doc read/write, comment handling, delete/modify blocks) aligns with the included code (feishu_api, comment processors, MCP server). However, the registry metadata lists no required env vars or primary credential while the code clearly requires FEISHU_APP_ID and FEISHU_APP_SECRET to function. This is an incoherence between claimed requirements and actual needs.
Instruction Scope
SKILL.md and scripts consistently instruct the agent to fetch comments, read block content, update/delete text, reply and resolve comments via the Feishu API. The runtime instructions and code only reference Feishu APIs and local .env config; they do not attempt to read unrelated system paths or exfiltrate to third-party endpoints. The instructions do require running a local MCP server or CLI which will give the agent programmatic ability to perform write operations on documents.
Install Mechanism
There is no network download/install of arbitrary binaries. Dependencies are standard Python packages listed in requirements.txt (requests, python-dotenv, mcp). The skill is instruction+code only and instructs pip installing those dependencies — no high-risk install URLs or extracted archives detected.
Credentials
The skill needs Feishu credentials (FEISHU_APP_ID and FEISHU_APP_SECRET) and optionally FEISHU_BASE_URL in .env to obtain tenant_access_token and act on documents. The registry metadata incorrectly lists no required env vars or primary credential — this omission is misleading. The requested secrets are necessary for the described functionality, but the metadata mismatch and presence of a .env file in the repo are concerning from an operational/visibility standpoint.
Persistence & Privilege
always:false (good). The skill exposes autonomous-invocable tools (MCP) that can perform destructive write operations (update/delete block, delete selected text) when given credentials. Autonomous invocation is normal for skills, but because these tools modify user documents, the operator should ensure least-privilege credentials and explicit confirmation before the agent performs write actions.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install feishu-doc-reviewer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /feishu-doc-reviewer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.3
feishu-doc-reviewer 1.0.0 初始版本发布! - 提供针对飞书文档的自动审阅与批注处理工具,支持文档读写。 - 支持获取评论、读取评论对应段落、导出全文、块级内容修改与删除。 - 新增 `delete_text_from_block` 方法,可只删除评论选中内容,保留块其他内容。 - 集成评论回复与 [AI-DONE] 状态同步,自动匹配评论与对应文档块。 - 支持 CLI 命令行工具与 Claude Code / OpenClaw 协议集成。
v1.0.1
feishu-doc-reviewer v1.0.1 - No file changes detected in this release. - No updates or modifications to code or documentation.
v1.0.0
feishu-doc-reviewer 1.0.0 初始发布 - 为智能体提供飞书文档的自动审阅与批注处理能力,包括全文导出、评论读取、智能识别和写回修改。 - 支持单独删除评论选中的文本或清空整段内容。 - 自动检索未解决评论、按关键词筛选、自动识别块 ID 并回复评论区。 - 提供命令行工具和详细 API 支持,适配 Claude Code / OpenClaw 场景。 - 支持基本文档配置与常见问题解答。
元数据
Slug feishu-doc-reviewer
版本 1.0.3
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

feishu-doc-reviewer 是什么?

为智能体提供飞书文档读写能力:导出全文、读取评论与段落、写回修改并回复评论。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 258 次。

如何安装 feishu-doc-reviewer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install feishu-doc-reviewer」即可一键安装,无需额外配置。

feishu-doc-reviewer 是免费的吗?

是的,feishu-doc-reviewer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

feishu-doc-reviewer 支持哪些平台?

feishu-doc-reviewer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 feishu-doc-reviewer?

由 Jachian-lee(@jachian-lee)开发并维护,当前版本 v1.0.3。

💬 留言讨论