Skip to content

feat(im): add hidden +search-chat alias for chat search#1685

Open
yballul-bytedance wants to merge 1 commit into
larksuite:mainfrom
yballul-bytedance:auto-research-sync/01KW9H34E533DQ0JK5PEEETR95/mr-758-97846aef
Open

feat(im): add hidden +search-chat alias for chat search#1685
yballul-bytedance wants to merge 1 commit into
larksuite:mainfrom
yballul-bytedance:auto-research-sync/01KW9H34E533DQ0JK5PEEETR95/mr-758-97846aef

Conversation

@yballul-bytedance

@yballul-bytedance yballul-bytedance commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a hidden compatibility alias for IM chat search so verb-first routing can still reach the canonical +chat-search shortcut.

Changes

  • Added +search-chat as a hidden shortcut alias that reuses the existing +chat-search behavior.
  • Added unit coverage to assert alias parity with the canonical shortcut.
  • Added a dry-run e2e test for the alias and updated IM skill guidance to point agents at the preferred route.

Test Plan

  • git diff --check
  • LARK_CLI_BIN=./lark-cli go test ./shortcuts/im -run 'Test(SearchChatAliasParity|Shortcuts)$'
  • LARK_CLI_BIN=./lark-cli go test ./tests/cli_e2e/im -run 'TestIM_SearchChatAliasDryRun$'

Related Issues

Auto research task: 01KW9H34E533DQ0JK5PEEETR95

Summary by CodeRabbit

  • New Features

    • Added a new hidden shortcut alias for searching IM chats (+search-chat) as an alternative to the existing chat search command.
    • Updated the IM shortcut list so the new alias is available in the expected ordering.
  • Tests

    • Expanded unit checks to ensure the alias is hidden and behaves identically to the canonical chat search command.
    • Added an end-to-end dry-run test verifying the generated request details.
  • Documentation

    • Updated the IM skill guidance with clearer “fast routes” and improved instructions for mention handling and search strategies.

@github-actions github-actions Bot added domain/im PR touches the im domain size/M Single-domain feat or fix with limited business impact labels Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds ImSearchChat as a hidden +search-chat alias, registers it in IM shortcuts, adds parity and e2e coverage, and updates lark-im skill guidance.

Search-chat alias and tests

Layer / File(s) Summary
Alias definition and registry
shortcuts/im/im_chat_search.go, shortcuts/im/shortcuts.go
ImSearchChat is created as a hidden alias of ImChatSearch with Command set to +search-chat, then added to Shortcuts().
Alias parity and shortcut list tests
shortcuts/im/im_chat_search_test.go, shortcuts/im/helpers_test.go
TestSearchChatAliasParity checks alias metadata and compares DryRun JSON with ImChatSearch; TestShortcuts now expects +search-chat.
CLI dry-run coverage
tests/cli_e2e/im/chat_search_alias_dryrun_test.go
A new e2e test runs im +search-chat --dry-run and validates the emitted request fields.
IM skill guidance rewrite
skills/lark-im/SKILL.md
The skill description, fast-route guidance, guardrails, and raw API fallback section are rewritten.

Changes

Search-chat alias implementation, tests, and skill guidance

Layer / File(s) Summary
Alias definition and registry
shortcuts/im/im_chat_search.go, shortcuts/im/shortcuts.go
ImSearchChat is created as a hidden alias of ImChatSearch with Command set to +search-chat, then added to Shortcuts().
Alias parity and shortcut list tests
shortcuts/im/im_chat_search_test.go, shortcuts/im/helpers_test.go
TestSearchChatAliasParity checks alias metadata and compares DryRun JSON with ImChatSearch; TestShortcuts now expects +search-chat.
CLI dry-run coverage
tests/cli_e2e/im/chat_search_alias_dryrun_test.go
A new e2e test runs im +search-chat --dry-run and validates the emitted request fields.
IM skill guidance rewrite
skills/lark-im/SKILL.md
The skill description, fast-route guidance, guardrails, and raw API fallback section are rewritten.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • larksuite/cli#820: Also changes the IM chat search shortcut and its related shortcut/test coverage.
  • larksuite/cli#1273: Also updates the IM Shortcuts() registry and TestShortcuts expectations.
  • larksuite/cli#1317: Also changes ImChatSearch, which ImSearchChat clones for its configuration.

Suggested labels

feature

Suggested reviewers

  • YangJunzhou-01

🐇 A hidden path, a search-chat tune,
Same old stream beneath the moon.
Shortcuts sing and tests agree,
Dry-runs whisper JSON free.
Fast routes hop, then guardrails gleam ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% 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 is concise and accurately summarizes the main change: adding a hidden +search-chat alias for IM chat search.
Description check ✅ Passed The description follows the template with Summary, Changes, Test Plan, and Related Issues, and it clearly covers the PR scope.
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.
✨ 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.

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add yballul-bytedance/cli#auto-research-sync/01KW9H34E533DQ0JK5PEEETR95/mr-758-97846aef -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 `@skills/lark-im/SKILL.md`:
- Line 22: The table row for the group creation command uses a literal pipe in
the `--as user|bot` option, which breaks the markdown table structure. Update
the `skills/lark-im/SKILL.md` entry to avoid the unescaped pipe in that cell,
either by escaping it as `user\|bot` or rewording it to `user or bot`, so the
3-column table renders correctly.
🪄 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: f56ed5d3-68b4-44f3-9e0f-57240cc93313

📥 Commits

Reviewing files that changed from the base of the PR and between 3fcb695 and cf4d2ee.

📒 Files selected for processing (6)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_chat_search_test.go
  • shortcuts/im/shortcuts.go
  • skills/lark-im/SKILL.md
  • tests/cli_e2e/im/chat_search_alias_dryrun_test.go

Comment thread skills/lark-im/SKILL.md
@yballul-bytedance
yballul-bytedance force-pushed the auto-research-sync/01KW9H34E533DQ0JK5PEEETR95/mr-758-97846aef branch from cf4d2ee to eb62238 Compare June 30, 2026 10:42

@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.

♻️ Duplicate comments (1)
skills/lark-im/SKILL.md (1)

22-22: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Escape the pipe character in the table cell.

The user|bot syntax contains a literal | that markdown parsers interpret as a column delimiter, breaking the 3-column table. This causes the fourth column to be silently dropped in rendered output.

Reword to avoid the pipe, or escape it as user\|bot or use user or bot.

🛠️ Proposed fix
- | Create a group | `lark-cli im +chat-create --as user|bot --name "<name>" ... --format json` | Raw `im chats create` unless shortcut flags cannot express the request |
+ | Create a group | `lark-cli im +chat-create --as user\|bot --name "<name>" ... --format json` | Raw `im chats create` unless shortcut flags cannot express the request |
🤖 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 `@skills/lark-im/SKILL.md` at line 22, The markdown table entry in SKILL.md
contains a literal pipe in the `--as user|bot` text, which breaks the 3-column
table. Update the `Create a group` row so the `user|bot` option is either
escaped as `user\|bot` or rewritten as `user or bot`, keeping the content within
the existing table cell; this is the only change needed in the affected table
row.
🤖 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.

Duplicate comments:
In `@skills/lark-im/SKILL.md`:
- Line 22: The markdown table entry in SKILL.md contains a literal pipe in the
`--as user|bot` text, which breaks the 3-column table. Update the `Create a
group` row so the `user|bot` option is either escaped as `user\|bot` or
rewritten as `user or bot`, keeping the content within the existing table cell;
this is the only change needed in the affected table row.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58bc8b35-8213-4fe3-bb15-056f804fd180

📥 Commits

Reviewing files that changed from the base of the PR and between cf4d2ee and eb62238.

📒 Files selected for processing (6)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_chat_search_test.go
  • shortcuts/im/shortcuts.go
  • skills/lark-im/SKILL.md
  • tests/cli_e2e/im/chat_search_alias_dryrun_test.go
✅ Files skipped from review due to trivial changes (1)
  • shortcuts/im/helpers_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • tests/cli_e2e/im/chat_search_alias_dryrun_test.go
  • shortcuts/im/shortcuts.go
  • shortcuts/im/im_chat_search_test.go
  • shortcuts/im/im_chat_search.go

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/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant