Manage comments on Feishu cloud documents, including listing comments and adding new comments.
Usage
/feishu-comment list <file_token> --type docx # 列出云文档评论
/feishu-comment add <file_token> --type docx --text "评论" # 添加评论
/feishu-comment delete <file_token> <comment_id> --type docx # 删除评论
Note:--type The parameter is required and specifies the file type (docx/sheet/bitable).
CLI Command Details
1. List Document Comments
# 列出云文档的评论
feishu-cli comment list <file_token> --type docx
# 列出电子表格的评论
feishu-cli comment list <file_token> --type sheet
# 指定用户类型(获取评论者信息)
feishu-cli comment list <file_token> --type docx --user-id-type open_id
Parameter Description:
| Parameter | Description | Required | Default Value |
|---|---|---|---|
file_token |
File Token | Yes | - |
--type |
File type (docx/sheet/bitable) | Yes | - |
--user-id-type |
User ID type | No | open_id |
Output Example:
文档评论列表(file_token: doccnXxx):
评论 #1
ID: 7123456789012345678
内容: 这个方案很好,建议增加性能测试数据
作者: ou_xxx (张三)
时间: 2024-01-21 14:30:25
状态: 未解决
回复数: 2
评论 #2
ID: 7123456789012345679
内容: 文档结构清晰,LGTM
作者: ou_yyy (李四)
时间: 2024-01-21 10:15:00
状态: 已解决
回复数: 0
共 2 条评论
2. Add Comment
# 添加全文评论(不关联特定内容)
feishu-cli comment add <file_token> --type docx --text "这是一条评论"
# 添加包含 @ 的评论
feishu-cli comment add <file_token> --type docx --text "请 @张三 review 一下"
Parameter Description:
| Parameter | Description | Required |
|---|---|---|
file_token |
File Token | Yes |
--type |
File type | Yes |
--text |
Comment content | Yes |
Output Example:
评论添加成功!
评论 ID: 7123456789012345680
文件: doccnXxx
内容: 这是一条评论
Supported File Types
| --type Parameter | Description |
|---|---|
docx |
New cloud document |
doc |
Legacy cloud document |
sheet |
Spreadsheet |
bitable |
Bitable |
3. Delete Comment
# 删除指定评论
feishu-cli comment delete <file_token> <comment_id> --type docx
Parameter Description:
| Parameter | Description | Required |
|---|---|---|
file_token |
File Token | Yes |
comment_id |
Comment ID | Yes |
--type |
File type (docx/sheet/bitable) | Yes |
Output Example:
评论删除成功!
评论 ID: 7123456789012345678
文件: doccnXxx
Typical Workflows
Code Review Process
# 1. 读取文档内容
feishu-cli doc export doccnXxx -o /tmp/doc.md
# 2. 查看现有评论
feishu-cli comment list doccnXxx --type docx
# 3. 添加审查意见
feishu-cli comment add doccnXxx --type docx --text "第三章的流程图需要更新"
Batch View Comments
# 列出多个文档的评论
for token in doccnXxx doccnYyy doccnZzz; do
echo "=== 文档: $token ==="
feishu-cli comment list $token --type docx
done
Permission Requirements
drive:drive.comment:readonly- Read commentsdrive:drive.comment:write- Add comments
Notes
- Comment position: The current CLI only supports document-wide comments, not comments associated with specific text/paragraphs
- @ feature: Using
@用户名in comments requires the user to have document access permission - Comment status: The comment status (resolved/unresolved) must be modified through the Feishu client
- Delete comment: The delete operation is irreversible; please confirm the comment ID before deleting