feat: add im +chat-members-list for user and bot members#1610
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds the ChangesIM chat members list
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
PR Quality SummaryCI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun. Failed checksdeterministic-gate
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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_chat_members_list_test.go`:
- Around line 34-65: The new error-path checks in normalizeMemberTypes should
assert the typed error contract instead of only nil/non-nil. Update
TestNormalizeMemberTypes and the related cases to verify the returned error with
errs.ProblemOf for category/subtype, and use errors.As into a
*errs.ValidationError to assert ve.Param since ProblemOf does not expose Param.
Keep the existing normalizeMemberTypes coverage, but pin the metadata so
regressions in the error type, subtype, or parameter cannot pass.
In `@shortcuts/im/im_chat_members_list.go`:
- Around line 32-33: The shortcut’s generic format support in
im_chat_members_list is allowing non-pretty outputs that can omit bots and break
the “users and bots in one command” contract. Update the shortcut definition and
its format handling to either make csv/table/ndjson bucket-aware in the relevant
command path, or explicitly reject those formats with a typed validation error
and a hint to use json/pretty instead, using the existing shortcut and
validation flow in im_chat_members_list and related format checks.
- Around line 49-53: The member-list pagination flow currently allows
`--page-all` and `--page-token` together, which causes the code path in the
member listing command to skip `fetchAllMemberPages` and return only a single
page without warning. Update the handler that builds the request and chooses
between `fetchAllMemberPages` and the single `CallAPITyped` path to either
reject the invalid flag combination with a validation error or explicitly honor
`--page-token` by disabling `--page-all`; make the decision in the same command
logic that checks `runtime.Bool("page-all")` and `runtime.Int("page-limit")` so
the behavior is consistent and discoverable.
In `@skills/lark-im/references/lark-im-chat-members-list.md`:
- Around line 131-132: The wording in the Lark IM chat members documentation
overstates the bot bucket guarantee by saying it is “always complete”; update
the sentence in the affected markdown section to use softer language like
“typically” or “expected” so it aligns with the existing truncation warning
behavior by member type and does not claim impossibility.
🪄 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: 6400ae13-2f65-48e4-819a-713347834fe7
📒 Files selected for processing (7)
shortcuts/im/helpers_test.goshortcuts/im/im_chat_list_test.goshortcuts/im/im_chat_members_list.goshortcuts/im/im_chat_members_list_test.goshortcuts/im/shortcuts.goskills/lark-im/SKILL.mdskills/lark-im/references/lark-im-chat-members-list.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@14242d7c61cbd2cccd7b4395518adc5df9f80add🧩 Skill updatenpx skills add jinzemo/cli#feat/im-chat-members-list -y -g |
14242d7 to
9af312b
Compare
Summary
Listing a group chat's members previously required two separate Meta API calls (
im chat.members getfor users andim chat.members botsfor bots). The newGET /open-apis/im/v1/chats/{chat_id}/members/listendpoint returns both in one response. This PR adds theim +chat-members-listshortcut that wraps it, returning users and bots together with one command.Changes
im +chat-members-listshortcut inshortcuts/im/im_chat_members_list.go: dual-bucketusers[]/bots[]output,--member-typesfilter,--member-id-type, single-page and--page-allpagination, server-truncation surfacing, and--chat-idpath validation + escapingshortcuts/im/shortcuts.goshortcuts/im/im_chat_members_list_test.goskills/lark-im/references/lark-im-chat-members-list.mdand a row inskills/lark-im/SKILL.mdTest Plan
make unit-testpassedlark-cli im +chat-members-list --chat-id <oc_id> --dry-run(path escaping confirmed) and live dual-bucket listing with--member-types/--member-id-type/--page-allRelated Issues
N/A
Summary by CodeRabbit
+chat-members-listshortcut to list group chat members, returning stableusersandbotsbuckets with optional totals, pagination (--page-all/--page-limit/tokens), and member-type filtering; emits truncation warnings when present.+chat-members-list, including usage, output contract, and examples.