Skip to content

feat(im): cli support feed group#1102

Merged
YangJunzhou-01 merged 1 commit into
larksuite:mainfrom
zhumiaoxin:feat/feed-group
Jun 6, 2026
Merged

feat(im): cli support feed group#1102
YangJunzhou-01 merged 1 commit into
larksuite:mainfrom
zhumiaoxin:feat/feed-group

Conversation

@zhumiaoxin

@zhumiaoxin zhumiaoxin commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add IM feed group support documentation for lark-cli, making the raw im feed.groups.* APIs discoverable and easier for agents to use correctly.

Changes

  • Register feed.groups methods in the lark-im skill index with user-only identity requirements and required OAuth scopes.
  • Add a feed group reference covering create, update, delete, list, batch query, item add/remove, item query, and item list flows.
  • Document request/response shapes, pagination behavior, soft-deleted results, enum values, permissions, and example commands for feed group operations.

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli im feed.groups <command> flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Added three IM shortcuts: +feed-group-list, +feed-group-list-item, +feed-group-query-item for managing and querying feed groups/items with chat-name enrichment and optional auto-pagination.
  • Documentation
    • Added comprehensive feed-groups API and CLI reference docs, examples, enums, scopes, and usage notes.
    • Clarified +flag-create and +flag-cancel descriptions to explain feed-layer semantics and auto-detection behavior.
  • Tests
    • Added extensive tests covering pagination, enrichment, validation, table output, and dry-run behavior.

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds two IM feed-group shortcuts (+feed-group-list-item, +feed-group-query-item) and +feed-group-list, plus helpers for enrichment and table rendering, comprehensive tests, CLI registration, minor ImFlagCreate/ImFlagCancel description edits, and full feed.groups documentation.

Changes

IM feed-groups and shortcuts

Layer / File(s) Summary
Test scaffolding and shortcuts tests
shortcuts/im/im_feed_group_item_test.go, shortcuts/im/im_feed_group_list_test.go, shortcuts/im/helpers_test.go
Adds HTTP-recording test scaffolding and a broad test suite covering enrichment, pagination, validation, DryRun, and output rendering; updates test expectations to include new shortcuts.
Feed-group item helpers
shortcuts/im/im_feed_group_items.go
Adds enrichFeedGroupItemsChatName and renderFeedGroupItemsTable with scope constants and graceful-degradation behavior for unresolved feed IDs.
List-item shortcut and pagination
shortcuts/im/im_feed_group_list_item.go
Implements ImFeedGroupListItem with flags, validation, single-page and --page-all accumulation, enrichment via chats.batch_query, table rendering, and DryRun support.
Query-item shortcut and body builder
shortcuts/im/im_feed_group_query_item.go
Implements ImFeedGroupQueryItem with path encoding, CSV --feed-id parsing into items (feed_type:"chat"), POST execution, enrichment, and DryRun output.
Feed-group list shortcut
shortcuts/im/im_feed_group_list.go
Implements ImFeedGroupList for listing groups with paging/time-window flags, auto-pagination merging of groups and deleted_groups, safeguards, and table rendering.
Shortcuts registration
shortcuts/im/shortcuts.go
Adds the new feed-group shortcuts to the Shortcuts() slice so they appear in the CLI list.
Flag shortcut metadata updates
shortcuts/im/im_flag_cancel.go, shortcuts/im/im_flag_create.go
Reformats exported metadata and updates Description strings to clarify feed-layer behavior and best-effort double-cancel semantics; no runtime changes.
SKILL index and feed.groups reference
skills/lark-im/SKILL.md, skills/lark-im/references/*, skill-template/domains/im.md
Adds feed.groups API subsection and comprehensive reference pages plus per-shortcut docs covering endpoints, enums, shared rules schema, examples, and permission scope mappings (im:feed_group_v1).

Sequence Diagram(s)

sequenceDiagram
  participant CLI as lark-cli shortcut
  participant FeedGroups as feed.groups.list_item / batch_query_item / list
  participant ChatBatch as chats.batch_query
  CLI->>FeedGroups: GET/POST (list/list_item/batch_query_item)
  FeedGroups-->>CLI: items + deleted_items or groups + deleted_groups (+page_token)
  CLI->>ChatBatch: POST /chats/batch_query (feed_ids)
  ChatBatch-->>CLI: chat_name lookup map
  CLI->>CLI: inject chat_name, render table / print DryRun
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • larksuite/cli#770: Prior PR introducing similar ImFlagCreate/ImFlagCancel metadata description refinements.

Suggested reviewers

  • YangJunzhou-01

"🐰 I hopped through docs and code tonight,
New feed groups bloom and flags read right.
Shortcuts stitch pages, tests run true,
Chat names resolve, tables bloom too.
A tiny rabbit cheers this tidy sight."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.73% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(im): cli support feed group' clearly summarizes the main change—adding CLI support for IM feed groups—and is concise and specific.
Description check ✅ Passed The description follows the template structure with Summary, Changes, Test Plan, and Related Issues sections, providing adequate detail about the PR scope and verification approach.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added domain/im PR touches the im domain size/L Large or sensitive change across domains or core paths labels May 26, 2026
@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.68657% with 125 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.35%. Comparing base (37b17f3) to head (8f9e659).

Files with missing lines Patch % Lines
shortcuts/im/im_feed_group_list.go 44.53% 55 Missing and 11 partials ⚠️
shortcuts/im/im_feed_group_list_item.go 70.47% 17 Missing and 14 partials ⚠️
shortcuts/im/im_feed_group_items.go 71.64% 10 Missing and 9 partials ⚠️
shortcuts/im/im_feed_group_query_item.go 78.04% 5 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1102      +/-   ##
==========================================
- Coverage   70.39%   70.35%   -0.04%     
==========================================
  Files         677      681       +4     
  Lines       65599    65934     +335     
==========================================
+ Hits        46176    46386     +210     
- Misses      15757    15844      +87     
- Partials     3666     3704      +38     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@8f9e659ed110880b13000f1b93959946b7265279

🧩 Skill update

npx skills add zhumiaoxin/cli#feat/feed-group -y -g

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@shortcuts/im/im_feed_group_item_test.go`:
- Around line 64-94: The test runtime is constructed without using
cmdutil.TestFactory, so update the helper to build the runtime via
cmdutil.TestFactory(t, config) (or the equivalent TestFactory constructor)
instead of whatever newUserShortcutRuntime currently returns; locate
newFGRuntime and the helper functions
newUserShortcutRuntime/shortcutRoundTripFunc and change the runtime creation to
call cmdutil.TestFactory with the appropriate test config, then set runtime.Cmd
(newFGCmd) and runtime.Format = "json" as before so Execute still uses the
mocked HTTP transport.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a775c48d-7762-4afb-979e-dda41c11a314

📥 Commits

Reviewing files that changed from the base of the PR and between 0ec7254 and fc70ed5.

📒 Files selected for processing (10)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_feed_group_item_test.go
  • shortcuts/im/im_feed_group_items.go
  • shortcuts/im/im_feed_group_list_item.go
  • shortcuts/im/im_feed_group_query_item.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/shortcuts.go
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-feed-groups.md
✅ Files skipped from review due to trivial changes (3)
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/im_flag_cancel.go
  • skills/lark-im/references/lark-im-feed-groups.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • skills/lark-im/SKILL.md

Comment thread shortcuts/im/im_feed_group_item_test.go
@zhumiaoxin
zhumiaoxin force-pushed the feat/feed-group branch 2 times, most recently from 5150232 to 4c53228 Compare June 1, 2026 09:41
@github-actions github-actions Bot added size/XL Architecture-level or global-impact change and removed size/L Large or sensitive change across domains or core paths labels Jun 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
shortcuts/im/im_feed_group_list.go (1)

144-187: ⚡ Quick win

Consider a small inter-page delay during auto-pagination.

The generic paginator this intentionally replaces applies a default 200ms delay between pages (internal/client/client.go paginateLoop). This manual loop fires up to page-limit (max 1000) requests back-to-back with no pacing, which can trip server-side rate limits on large accounts. Consider reusing the shared delay/--page-delay semantics here for parity.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@shortcuts/im/im_feed_group_list.go` around lines 144 - 187, Add a small
inter-page delay inside the pagination loop to avoid firing requests
back-to-back: after confirming we will continue (i.e., after checking
!lastHasMore, lastPageToken==prevPageToken and before setting prevPageToken and
proceeding to the next iteration) sleep for the configured page-delay value (use
rt.Int("page-delay") or default 200) by calling
time.Sleep(time.Duration(rt.Int("page-delay")) * time.Millisecond); ensure the
import for time is present and only sleep when there actually will be another
page to fetch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@shortcuts/im/im_feed_group_list.go`:
- Around line 144-187: Add a small inter-page delay inside the pagination loop
to avoid firing requests back-to-back: after confirming we will continue (i.e.,
after checking !lastHasMore, lastPageToken==prevPageToken and before setting
prevPageToken and proceeding to the next iteration) sleep for the configured
page-delay value (use rt.Int("page-delay") or default 200) by calling
time.Sleep(time.Duration(rt.Int("page-delay")) * time.Millisecond); ensure the
import for time is present and only sleep when there actually will be another
page to fetch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 13093bce-5d5a-4a13-9605-a0d27d0440e4

📥 Commits

Reviewing files that changed from the base of the PR and between 4c53228 and 447c47e.

📒 Files selected for processing (10)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_feed_group_list.go
  • shortcuts/im/im_feed_group_list_test.go
  • shortcuts/im/shortcuts.go
  • skill-template/domains/im.md
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-feed-group-list-item.md
  • skills/lark-im/references/lark-im-feed-group-list.md
  • skills/lark-im/references/lark-im-feed-group-query-item.md
  • skills/lark-im/references/lark-im-feed-groups.md
✅ Files skipped from review due to trivial changes (5)
  • skill-template/domains/im.md
  • skills/lark-im/references/lark-im-feed-group-list.md
  • skills/lark-im/references/lark-im-feed-group-list-item.md
  • skills/lark-im/references/lark-im-feed-group-query-item.md
  • skills/lark-im/references/lark-im-feed-groups.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • shortcuts/im/shortcuts.go
  • skills/lark-im/SKILL.md

@zhumiaoxin
zhumiaoxin force-pushed the feat/feed-group branch 5 times, most recently from c3fb6dd to 6d30fda Compare June 5, 2026 11:16
@YangJunzhou-01
YangJunzhou-01 merged commit bd07859 into larksuite:main Jun 6, 2026
18 checks passed
SunPeiYang996 pushed a commit that referenced this pull request Jun 8, 2026
Add IM feed group support documentation for lark-cli, making the raw im feed.groups.* APIs discoverable and easier for agents to use correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/im PR touches the im domain size/XL Architecture-level or global-impact change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants