feat(im): cli support feed group#1102
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 (12)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughAdds two IM feed-group shortcuts (+feed-group-list-item, +feed-group-query-item) with enrichment, pagination, DryRun, helpers, tests, CLI registration; tweaks ImFlagCreate/ImFlagCancel descriptions; and adds comprehensive feed.groups documentation and SKILL entries. 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
participant ChatBatch as chats.batch_query
CLI->>FeedGroups: GET/POST (list_item or batch_query_item)
FeedGroups-->>CLI: items + deleted_items (+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 67.92% 69.15% +1.23%
==========================================
Files 601 633 +32
Lines 55766 59525 +3759
==========================================
+ Hits 37880 41167 +3287
- Misses 14751 15020 +269
- Partials 3135 3338 +203 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@4c53228cf3fea1469a679501ff976d08024498b8🧩 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
| func newFGRuntime(t *testing.T, sc common.Shortcut, flags map[string]string, recorded *[]recordedFGRequest, responder fgResponder) *common.RuntimeContext { | ||
| t.Helper() | ||
| pageByPath := map[string]int{} | ||
| rt := shortcutRoundTripFunc(func(req *http.Request) (*http.Response, error) { | ||
| rec := recordedFGRequest{ | ||
| method: req.Method, | ||
| path: req.URL.Path, | ||
| query: req.URL.Query(), | ||
| } | ||
| if req.Body != nil { | ||
| data, _ := io.ReadAll(req.Body) | ||
| if len(data) > 0 { | ||
| _ = json.Unmarshal(data, &rec.body) | ||
| } | ||
| } | ||
| if recorded != nil { | ||
| *recorded = append(*recorded, rec) | ||
| } | ||
| pageByPath[req.URL.Path]++ | ||
| status, body := 200, interface{}(map[string]interface{}{"code": 0, "data": map[string]interface{}{}}) | ||
| if responder != nil { | ||
| status, body = responder(req.URL.Path, pageByPath[req.URL.Path]) | ||
| } | ||
| return shortcutJSONResponse(status, body), nil | ||
| }) | ||
|
|
||
| runtime := newUserShortcutRuntime(t, rt) | ||
| runtime.Cmd = newFGCmd(t, sc, flags) | ||
| runtime.Format = "json" | ||
| return runtime | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify newUserShortcutRuntime and shortcutRoundTripFunc are defined and use correct pattern
echo "=== Searching for newUserShortcutRuntime definition ==="
rg -n "func newUserShortcutRuntime" --type=go shortcuts/im/
echo ""
echo "=== Searching for shortcutRoundTripFunc definition ==="
rg -n "func shortcutRoundTripFunc|type shortcutRoundTripFunc" --type=go shortcuts/im/
echo ""
echo "=== Checking if they use cmdutil.TestFactory ==="
rg -n -A10 "func new(User|Bot)ShortcutRuntime" --type=go shortcuts/im/ | rg -i "cmdutil.TestFactory|TestFactory"Repository: larksuite/cli
Length of output: 460
Use cmdutil.TestFactory in HTTP-mocking test runtimes
shortcuts/im/im_feed_group_item_test.go’s newFGRuntime calls newUserShortcutRuntime/shortcutRoundTripFunc from shortcuts/im/helpers_network_test.go, but those runtime helper constructors don’t use cmdutil.TestFactory(t, config) for unit tests that exercise Execute with mocked HTTP. Update the helpers to construct the runtime via cmdutil.TestFactory.
🤖 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_item_test.go` around lines 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.
fc70ed5 to
5150232
Compare
5150232 to
4c53228
Compare
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