feat: upgrade card send - #1688
Conversation
📝 WalkthroughWalkthroughAdds Card 2.0 reference docs, a creation workflow, and style/resource guidance for Lark IM interactive cards. Also strengthens ChangesLark IM Card 2.0 Documentation Suite
Estimated code review effort: 2 (Simple) | ~15 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (6)
skills/lark-im/references/card/components/multi_select_static.md (1)
40-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winClarify callback field names for standalone vs form cases.
The callback description is ambiguous. Specify
action.optionsfor standalone andform_value[name]for form containers, matching the contract inlark-im-card-action-reply.md.- 回调返回选中的多个值。 + 回调(非 form):`action.tag="multi_select_static"` + `action.options`(逗号分隔的 value);form 内则读 `form_value[name]`。🤖 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/references/card/components/multi_select_static.md` at line 40, The callback description in the multi-select static reference is ambiguous; update the wording to explicitly distinguish the standalone and form-container cases. In the relevant section of the multi_select_static documentation, state that the selected values are returned via action.options when used standalone, and via form_value[name] when used inside a form container, keeping the terminology aligned with lark-im-card-action-reply.md.skills/lark-im/references/card/components/date_picker.md (2)
23-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueClarify conditional requirement for placeholder.
The table marks
placeholderas optional, but the description states it's required wheninitial_dateis unset. Use the "否*" convention (likenamefield) to indicate conditional requirement, or clarify in the table.- | `placeholder` | 否 | Object | / | 占位文本,plain_text;未设 `initial_date` 时必填 | + | `placeholder` | 否* | Object | / | 占位文本,plain_text;**未设 `initial_date` 时必填** |🤖 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/references/card/components/date_picker.md` around lines 23 - 24, The `placeholder` field in the `date_picker` component table is described as conditionally required when `initial_date` is not set, but it is currently marked as optional. Update the documentation entry for `placeholder` to use the conditional-required convention used elsewhere (for example, the `name` field) or otherwise make the conditional requirement explicit in the table so the requirement is unambiguous.
34-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winIncomplete callback documentation for form container case.
Add the form container fallback to
form_value[name]for consistency with the universal form rule documented inlark-im-card-action-reply.md.- 回调:`action.tag="date_picker"` + `action.option`(日期字符串,如 `"2025-06-10 +0800"`)+ `action.timezone`;form 内则读 `form_value[name]`。 + 回调(非 form):`action.tag="date_picker"` + `action.option`(日期字符串,如 `"2025-06-10 +0800"`)+ `action.timezone`;form 内则读 `form_value[name]`。🤖 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/references/card/components/date_picker.md` at line 34, The date_picker callback documentation is missing the form-container fallback, so update the description in the date_picker section to mention that when used inside a form container, the value should be read from form_value[name] as well as the existing action.tag/action.option/action.timezone fields. Keep the wording aligned with the universal form rule in lark-im-card-action-reply.md and ensure the callback behavior is described consistently for both standalone and form container cases.skills/lark-im/references/card/components/select_person.md (1)
39-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winIncomplete callback documentation for form container case.
The callback description only covers the standalone case (
action.option). Per the universal form container rule inlark-im-card-action-reply.md, when inside aform, the value appears inform_value[name]instead. Document both cases explicitly for consistency with other components.- 回调 `action.tag="select_person"` + `action.option`(选中人的 open_id)。 + 回调(非 form):`action.tag="select_person"` + `action.option`(选中人的 open_id);form 内则读 `form_value[name]`。🤖 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/references/card/components/select_person.md` at line 39, The callback documentation for select_person is incomplete because it only describes the standalone action.option case and omits the form container behavior. Update the select_person.md description to explicitly document both callback shapes: outside a form, use action.tag="select_person" with action.option as the selected open_id; inside a form, the selected value is provided in form_value[name] per the form container rule. Keep the wording consistent with the other component references and the lark-im-card-action-reply.md convention.skills/lark-im/references/card/components/picker_time.md (1)
23-23: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider marking placeholder as conditionally required.
Following the
namefield convention, consider using "否*" to indicate thatplaceholderis required wheninitial_timeis unset.- | `placeholder` | 否 | Object | / | 占位文本,plain_text;未设 `initial_time` 时必填 | + | `placeholder` | 否* | Object | / | 占位文本,plain_text;**未设 `initial_time` 时必填** |🤖 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/references/card/components/picker_time.md` at line 23, Update the `picker_time` component reference so the `placeholder` row reflects conditional requiredness, matching the `name` field convention. In the table entry for `placeholder`, change the required marker to indicate it is required only when `initial_time` is unset, and keep the existing description aligned with that rule.skills/lark-im/references/card/components/multi_select_person.md (1)
40-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winClarify callback field names for standalone vs form cases.
The callback description is ambiguous about which field contains the selected values. Specify
action.optionsfor standalone (comma-separated open_ids) andform_value[name]for form containers, matching the contract inlark-im-card-action-reply.md.- 回调返回选中的多个 open_id。 + 回调(非 form):`action.tag="multi_select_person"` + `action.options`(逗号分隔的 open_id);form 内则读 `form_value[name]`。🤖 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/references/card/components/multi_select_person.md` at line 40, The callback description is ambiguous about where the selected values are returned, so update the `multi_select_person.md` wording to distinguish the two cases clearly. In the standalone case, state that the selected multiple open_ids are returned in `action.options` as a comma-separated value; in the form container case, state that the selected value is returned in `form_value[name]`. Keep the terminology aligned with `lark-im-card-action-reply.md` and make sure the field names are explicit in the `multi_select_person` callback description.
🤖 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/references/card/components/interactive_container.md`:
- Line 37: The padding/margin defaults in the table are using comma separators,
which is inconsistent with the CSS spacing notation shown in the example. Update
the documentation entry for the `padding`/`margin` row in
`interactive_container.md` so the default format matches the standard
space-separated form used by the example, keeping the guidance consistent for
readers.
In `@skills/lark-im/references/card/components/select_img.md`:
- Line 26: Clarify the select_img docs around multi_select and form usage: the
current wording in the multi_select option and the standalone select example is
contradictory. Update the descriptions tied to the multi_select option and the
non-form example so it clearly states that only multi_select: true requires
being nested in a form and uses asynchronous submission, while the default
single-select mode (multi_select: false) can be used standalone with immediate
callback behavior.
- Line 34: The field table in the select_img documentation marks `behaviors` as
required, but it should be optional to match the minimal example and the
documented default callback behavior. Update the `behaviors` row in the table so
it is marked optional, keeping the rest of the parameter description unchanged
and aligned with the `date_picker.md` convention.
- Line 42: The single-select callback field is documented incorrectly in the
select_img reference: in the non-form flow for the select_img action, use
action.option for single-select and action.options only for multi-select, while
form handling should continue to read form_value[name]. Update the select_img.md
wording to match the lark-im-card-action-reply.md contract and keep the
action.tag="select_img" reference intact.
In `@skills/lark-im/references/card/lark-im-card-style.md`:
- Around line 197-201: Clarify the highlight block layout rule so it is
unambiguous for `column` blocks using `flex_mode` in the `lark-im-card-style.md`
guidance: reconcile the current `weight: 1` requirement with the
`bisect`/`trisect` flex_mode rules, and explicitly state whether `weight` should
be set or omitted for this specific pattern. Update the relevant section that
describes column styling and layout choice so it matches the flex_mode decision
table and references the same terms (`column`, `flex_mode`, `bisect`, `trisect`)
consistently.
In `@skills/lark-im/references/lark-im-messages-send.md`:
- Around line 162-166: The STOP block in the interactive card section should
match the stronger wording used in reply.md and SKILL.md by removing the “from
the examples below” qualifier. Update the guidance near the interactive card
instructions so it gives an absolute prohibition on hand-writing or copying any
card payload, and keep the reference to card/lark-im-card-create.md and its
workflow unchanged.
---
Nitpick comments:
In `@skills/lark-im/references/card/components/date_picker.md`:
- Around line 23-24: The `placeholder` field in the `date_picker` component
table is described as conditionally required when `initial_date` is not set, but
it is currently marked as optional. Update the documentation entry for
`placeholder` to use the conditional-required convention used elsewhere (for
example, the `name` field) or otherwise make the conditional requirement
explicit in the table so the requirement is unambiguous.
- Line 34: The date_picker callback documentation is missing the form-container
fallback, so update the description in the date_picker section to mention that
when used inside a form container, the value should be read from
form_value[name] as well as the existing
action.tag/action.option/action.timezone fields. Keep the wording aligned with
the universal form rule in lark-im-card-action-reply.md and ensure the callback
behavior is described consistently for both standalone and form container cases.
In `@skills/lark-im/references/card/components/multi_select_person.md`:
- Line 40: The callback description is ambiguous about where the selected values
are returned, so update the `multi_select_person.md` wording to distinguish the
two cases clearly. In the standalone case, state that the selected multiple
open_ids are returned in `action.options` as a comma-separated value; in the
form container case, state that the selected value is returned in
`form_value[name]`. Keep the terminology aligned with
`lark-im-card-action-reply.md` and make sure the field names are explicit in the
`multi_select_person` callback description.
In `@skills/lark-im/references/card/components/multi_select_static.md`:
- Line 40: The callback description in the multi-select static reference is
ambiguous; update the wording to explicitly distinguish the standalone and
form-container cases. In the relevant section of the multi_select_static
documentation, state that the selected values are returned via action.options
when used standalone, and via form_value[name] when used inside a form
container, keeping the terminology aligned with lark-im-card-action-reply.md.
In `@skills/lark-im/references/card/components/picker_time.md`:
- Line 23: Update the `picker_time` component reference so the `placeholder` row
reflects conditional requiredness, matching the `name` field convention. In the
table entry for `placeholder`, change the required marker to indicate it is
required only when `initial_time` is unset, and keep the existing description
aligned with that rule.
In `@skills/lark-im/references/card/components/select_person.md`:
- Line 39: The callback documentation for select_person is incomplete because it
only describes the standalone action.option case and omits the form container
behavior. Update the select_person.md description to explicitly document both
callback shapes: outside a form, use action.tag="select_person" with
action.option as the selected open_id; inside a form, the selected value is
provided in form_value[name] per the form container rule. Keep the wording
consistent with the other component references and the
lark-im-card-action-reply.md convention.
🪄 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: a1787d63-b242-4590-bbf6-911637837066
📒 Files selected for processing (35)
skills/lark-im/SKILL.mdskills/lark-im/references/card/card-2.0-schema.mdskills/lark-im/references/card/components/button.mdskills/lark-im/references/card/components/chart.mdskills/lark-im/references/card/components/checker.mdskills/lark-im/references/card/components/collapsible_panel.mdskills/lark-im/references/card/components/column_set.mdskills/lark-im/references/card/components/date_picker.mdskills/lark-im/references/card/components/div.mdskills/lark-im/references/card/components/form.mdskills/lark-im/references/card/components/header.mdskills/lark-im/references/card/components/hr.mdskills/lark-im/references/card/components/img.mdskills/lark-im/references/card/components/img_combination.mdskills/lark-im/references/card/components/input.mdskills/lark-im/references/card/components/interactive_container.mdskills/lark-im/references/card/components/markdown.mdskills/lark-im/references/card/components/multi_select_person.mdskills/lark-im/references/card/components/multi_select_static.mdskills/lark-im/references/card/components/overflow.mdskills/lark-im/references/card/components/person.mdskills/lark-im/references/card/components/person_list.mdskills/lark-im/references/card/components/picker_datetime.mdskills/lark-im/references/card/components/picker_time.mdskills/lark-im/references/card/components/recycling_container.mdskills/lark-im/references/card/components/select_img.mdskills/lark-im/references/card/components/select_person.mdskills/lark-im/references/card/components/select_static.mdskills/lark-im/references/card/components/table.mdskills/lark-im/references/card/lark-im-card-create.mdskills/lark-im/references/card/lark-im-card-style.mdskills/lark-im/references/card/resource/colors.mdskills/lark-im/references/card/resource/icons.mdskills/lark-im/references/lark-im-messages-reply.mdskills/lark-im/references/lark-im-messages-send.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@9aa9ef1782bca9ef80a14c6cc5d9d8b7b14e21d1🧩 Skill updatenpx skills add 91-enjoy/cli#feat/upgrade_card_send -y -g |
cccf468 to
5d8f58f
Compare
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 `@skills/lark-im/references/card/components/checker.md`:
- Line 26: The markdown table row for button_area is rendering extra columns
because the literal pipe characters in its value are unescaped. Update the
checker.md table entry for button_area so the pipes inside the Object example
are escaped, keeping the row in a single column and preserving the full value in
the generated docs.
In `@skills/lark-im/references/card/components/select_static.md`:
- Around line 23-25: The `select_static` reference currently marks `options` as
optional, which allows invalid empty selects. Update the `select_static`
documentation table to make `options` required, and ensure the related
`options[].text` and `options[].value` entries still describe the required item
shape. If there is an intended lazy-loading behavior, document that explicitly
in this section instead of leaving `options` optional.
In `@skills/lark-im/references/card/lark-im-card-create.md`:
- Around line 109-110: The Card 1.0 fallback in the send-failure workflow is not
actionable because there is no Card 1.0 schema or component reference to rebuild
against. Update the guidance in the card create doc so the fallback either
points to a valid 1.0 reference/source of truth or remove the automatic
downgrade step from the retry flow; use the “发送失败时” retry section and the “Card
1.0” fallback wording as the place to fix.
In `@skills/lark-im/references/card/lark-im-card-style.md`:
- Around line 127-133: The spacing guidance in the card style doc is internally
inconsistent because the body padding recommendation uses 20px while the rest of
the rules emphasize a 2/4/8/12px scale. Update the guidance around the body
padding example in the card style reference to either label 20px as an explicit
exception or adjust it to fit the same spacing scale, and make sure the
surrounding spacing rules in the card-style section remain consistent with that
choice.
🪄 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: b8c7c5c6-aa3f-44fb-bcf4-defb6efd0964
📒 Files selected for processing (35)
skills/lark-im/SKILL.mdskills/lark-im/references/card/card-2.0-schema.mdskills/lark-im/references/card/components/button.mdskills/lark-im/references/card/components/chart.mdskills/lark-im/references/card/components/checker.mdskills/lark-im/references/card/components/collapsible_panel.mdskills/lark-im/references/card/components/column_set.mdskills/lark-im/references/card/components/date_picker.mdskills/lark-im/references/card/components/div.mdskills/lark-im/references/card/components/form.mdskills/lark-im/references/card/components/header.mdskills/lark-im/references/card/components/hr.mdskills/lark-im/references/card/components/img.mdskills/lark-im/references/card/components/img_combination.mdskills/lark-im/references/card/components/input.mdskills/lark-im/references/card/components/interactive_container.mdskills/lark-im/references/card/components/markdown.mdskills/lark-im/references/card/components/multi_select_person.mdskills/lark-im/references/card/components/multi_select_static.mdskills/lark-im/references/card/components/overflow.mdskills/lark-im/references/card/components/person.mdskills/lark-im/references/card/components/person_list.mdskills/lark-im/references/card/components/picker_datetime.mdskills/lark-im/references/card/components/picker_time.mdskills/lark-im/references/card/components/recycling_container.mdskills/lark-im/references/card/components/select_img.mdskills/lark-im/references/card/components/select_person.mdskills/lark-im/references/card/components/select_static.mdskills/lark-im/references/card/components/table.mdskills/lark-im/references/card/lark-im-card-create.mdskills/lark-im/references/card/lark-im-card-style.mdskills/lark-im/references/card/resource/colors.mdskills/lark-im/references/card/resource/icons.mdskills/lark-im/references/lark-im-messages-reply.mdskills/lark-im/references/lark-im-messages-send.md
✅ Files skipped from review due to trivial changes (25)
- skills/lark-im/references/card/components/picker_time.md
- skills/lark-im/references/card/components/column_set.md
- skills/lark-im/references/card/components/img.md
- skills/lark-im/references/card/components/markdown.md
- skills/lark-im/references/card/resource/icons.md
- skills/lark-im/references/card/components/picker_datetime.md
- skills/lark-im/references/card/components/table.md
- skills/lark-im/references/card/components/header.md
- skills/lark-im/references/card/components/div.md
- skills/lark-im/references/card/components/img_combination.md
- skills/lark-im/references/card/components/recycling_container.md
- skills/lark-im/references/card/components/select_person.md
- skills/lark-im/references/card/components/button.md
- skills/lark-im/references/card/components/person_list.md
- skills/lark-im/SKILL.md
- skills/lark-im/references/card/components/select_img.md
- skills/lark-im/references/lark-im-messages-reply.md
- skills/lark-im/references/card/components/overflow.md
- skills/lark-im/references/card/components/collapsible_panel.md
- skills/lark-im/references/card/resource/colors.md
- skills/lark-im/references/card/components/date_picker.md
- skills/lark-im/references/card/components/chart.md
- skills/lark-im/references/lark-im-messages-send.md
- skills/lark-im/references/card/components/multi_select_person.md
- skills/lark-im/references/card/card-2.0-schema.md
🚧 Files skipped from review as they are similar to previous changes (5)
- skills/lark-im/references/card/components/multi_select_static.md
- skills/lark-im/references/card/components/form.md
- skills/lark-im/references/card/components/interactive_container.md
- skills/lark-im/references/card/components/person.md
- skills/lark-im/references/card/components/input.md
5d8f58f to
9aa9ef1
Compare
Summary
Before this change,
lark-imskill had no structured guidance for creating and sending interactive card messages. Agents had to hand-write card JSON from scratch, leading to inconsistent quality, missing requiredfields, and incorrect component usage.
This PR introduces a comprehensive Card 2.0 card creation system to the
lark-imskill, including:+messages-send/+messages-replyshortcuts to integrate with the workflowChanges
New workflow:
references/card/lark-im-card-create.mdA complete 7-step card creation orchestration workflow that agents must follow before sending any interactive card. Covers:
lark-cli im +messages-send. Retries up to 3 times with error-specific fixes. Falls back to Card 1.0 reconstruction if all retries failcard.action.triggercallbacks for interactive components — buttons, forms, selectors, pickers, overflow menus, etc.New style guide:
references/card/lark-im-card-style.mdDefines 8 quality tiers (P0–P7) that serve as the sole arbiter of card quality:
<hr>Includes an "intent → component combination" reference table covering notification, data display, form input, and confirmation dialog patterns.
New root schema:
references/card/card-2.0-schema.mdDocuments the Card 2.0 root structure, config options (update_multi, width_mode, style, text_size presets), color token system (24 named colors with light/dark variants), and a categorized component index (containers,
display, interactive).
27 new component references:
references/card/components/*.mdOne file per Card 2.0 component, each containing:
column_setchildren must becolumn,buttonneeds explicitbehaviorsfor callbacks)Components covered:
column_set,collapsible_panel,form,interactive_container,recycling_containerheader,div,markdown,img,img_combination,person,person_list,chart,table,hrbutton,checker,input,overflow,select_img,select_person,select_static,multi_select_person,multi_select_static,date_picker,picker_datetime,picker_timeNew resource references:
references/card/resource/colors.mdandicons.mdcolors.md: 24 named color tokens with hex values for both light and dark themesicons.md: Built-in icon name catalog grouped by category (UI actions, status, directional, etc.)Updated files
SKILL.md: Added a mandatory pre-send gate — agents must readlark-im-card-create.mdbefore any+messages-sendor+messages-replywith--msg-type interactivelark-im-messages-send.md: Cross-references the card workflow and adds--msg-type interactivedocumentationlark-im-messages-reply.md: Same cross-reference for reply flowTest Plan
make unit-testpassedtext,image,post) are unaffectedRelated Issues
Summary by CodeRabbit