larksuite / larksuite/cli

feat(task): 补充 typed 评论读取接口,并提供 section 变更监听/轮询能力

Open
#2,284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domain/task enhancement
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

背景

在使用 lark-cli 基于飞书 Tasks 构建自动化或 Agent 工作流时,遇到两个相关的能力缺口:评论读取需要绕过 typed 层,section(自定义分组)切换也没有可消费的服务端事件。

环境:@larksuite/cli 1.0.85

1. 缺少 typed 的任务评论读取接口

当前 lark-cli task --help 只有 +comment(创建评论)快捷命令,没有 comments resource。执行:

lark-cli schema task.comments.list

返回:

{
  "ok": false,
  "error": {
    "type": "validation",
    "message": "Unknown resource: task.comments.list"
  }
}

但飞书 OpenAPI 已提供评论列表接口:

lark-cli api GET /open-apis/task/v2/comments \
  --params '{"resource_type":"task","resource_id":"<task_guid>","page_size":50,"direction":"asc"}' \
  --as user

文档:https://open.feishu.cn/document/task-v2/comment/list

这意味着 Agent 目前必须自行拼接 path/params、处理分页和响应结构,无法通过 schema 获得 typed input/output contract。

期望

至少补充:

  • task comments list
  • task comments get

最好完整覆盖 OpenAPI 的 create/get/list/patch/delete,并暴露对应 schema、分页参数、权限要求和标准 envelope。+comment 可以继续作为 create shortcut。

2. 没有 section 切换事件,只能自行轮询

当前可消费的 Task 事件只有:

task.task.update_user_access_v2

它的 event_types 包含:

  • task_create / task_deleted
  • task_summary_update / task_desc_update
  • task_assignees_update / task_followers_update
  • task_reminders_update / task_start_due_update
  • task_completed_update

没有 tasklist membership 或 section/custom-group move 类型。用户在 Task List 看板中把任务从一个 section 拖到另一个 section 时,无法通过事件可靠感知,只能轮询 sections.tasks(或逐任务读取 tasklist/section membership)并做 diff。

官方事件列表:https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list

期望

如果服务端已有但 CLI 尚未暴露的 section 变更事件,希望接入 event consume

如果服务端目前确实没有该事件,建议:

  1. lark-task / lark-event-task 文档里明确说明这一能力边界;
  2. 提供 typed 的本地轮询封装,例如:
lark-cli task +watch-section-moves \
  --tasklist-guid <guid> \
  --interval 2s \
  --as user

以 NDJSON 输出 task_guid/from_section_guid/to_section_guid/observed_at,并明确 source=local_poll,让上层 Agent 不必重复实现分页、快照、diff、去重和重启恢复。

使用场景

将 Feishu Tasks 作为本地 Agent/Codex 的人机协作看板:

  • 用户通过评论补充或调整任务指令;
  • 用户把任务拖入特定 section 触发执行;
  • Agent 执行后回写评论并移动到 Review/Blocked。

目前第一个场景需要使用 raw OpenAPI,第二个场景需要自行轮询,两者都绕开了 typed CLI 的 schema 契约。

重复 Issue 检查

提交前搜索了 comments、comment list、task comments、section event、section_guid、自定义分组等关键词,没有发现完全重复的 Issue。

相关但不同:#1746 讨论的是任务描述/评论内嵌图片缺少可下载 media token,不是 typed 评论列表或 section 变更监听。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing task +comment and schema surfaces, then inspect event consume and the lark-task/lark-event-task documentation mentioned in the issue. Define whether the work covers typed comment CRUD, section-change events, or a polling wrapper; done requires an explicit supported scope with matching schemas, pagination and permissions, tests, and documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.