feat(im): cli support feed group#1102
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 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. ChangesIM feed-groups and shortcuts
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@8f9e659ed110880b13000f1b93959946b7265279🧩 Skill updatenpx skills add zhumiaoxin/cli#feat/feed-group -y -g |
0ec7254 to
fc70ed5
Compare
There was a problem hiding this comment.
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
📒 Files selected for processing (10)
shortcuts/im/helpers_test.goshortcuts/im/im_feed_group_item_test.goshortcuts/im/im_feed_group_items.goshortcuts/im/im_feed_group_list_item.goshortcuts/im/im_feed_group_query_item.goshortcuts/im/im_flag_cancel.goshortcuts/im/im_flag_create.goshortcuts/im/shortcuts.goskills/lark-im/SKILL.mdskills/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
5150232 to
4c53228
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
shortcuts/im/im_feed_group_list.go (1)
144-187: ⚡ Quick winConsider a small inter-page delay during auto-pagination.
The generic paginator this intentionally replaces applies a default 200ms delay between pages (
internal/client/client.gopaginateLoop). This manual loop fires up topage-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-delaysemantics 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
📒 Files selected for processing (10)
shortcuts/im/helpers_test.goshortcuts/im/im_feed_group_list.goshortcuts/im/im_feed_group_list_test.goshortcuts/im/shortcuts.goskill-template/domains/im.mdskills/lark-im/SKILL.mdskills/lark-im/references/lark-im-feed-group-list-item.mdskills/lark-im/references/lark-im-feed-group-list.mdskills/lark-im/references/lark-im-feed-group-query-item.mdskills/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
c3fb6dd to
6d30fda
Compare
6d30fda to
8f9e659
Compare
Add IM feed group support documentation for lark-cli, making the raw im feed.groups.* APIs discoverable and easier for agents to use correctly.
Summary
Add IM feed group support documentation for
lark-cli, making the rawim feed.groups.*APIs discoverable and easier for agents to use correctly.Changes
feed.groupsmethods in thelark-imskill index with user-only identity requirements and required OAuth scopes.Test Plan
lark-cli im feed.groups <command>flow works as expectedRelated Issues
Summary by CodeRabbit