feat: add slides +create shortcut with skill docs#389
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 Slides as a new feature: README updates, a Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (lark-cli)
participant SlidesAPI as Slides API (/open-apis/slides_ai)
participant GrantSvc as AutoGrant helper
participant DriveAPI as Drive API (/open-apis/drive)
CLI->>SlidesAPI: POST /xml_presentations (create payload)
SlidesAPI-->>CLI: 201 { xml_presentation_id, revision_id, title }
alt as bot && current user exists
CLI->>GrantSvc: AutoGrantCurrentUserDrivePermission(resourceType="slides", id)
GrantSvc->>DriveAPI: POST /permissions/{presentation}/members
DriveAPI-->>GrantSvc: 200 { status }
GrantSvc-->>CLI: permission_grant result
else as user or no current user
GrantSvc-->>CLI: permission_grant skipped/none
end
CLI-->>User: stdout JSON envelope (xml_presentation_id, title, optional permission_grant)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryAdds a One broken documentation link exists in Confidence Score: 5/5Safe to merge — all remaining findings are P2 style/doc issues with no runtime impact. The Go implementation is correct, follows existing patterns, and is well-tested at 94% coverage. The two findings are a broken doc link in SKILL.md and a minor slides_added counting nuance — neither affects runtime behavior. Previous P1 concerns (title mismatch in output) were resolved in this revision by using effectiveTitle() throughout. skills/lark-slides/SKILL.md — contains a broken reference link to lark-slides-xml-presentations-create.md Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([slides +create]) --> B{--dry-run?}
B -- yes --> C[Print API preview and exit]
B -- no --> D[POST /xml_presentations with title XML]
D --> E{API error?}
E -- yes --> F([return error])
E -- no --> G{xml_presentation_id returned?}
G -- no --> H([return api_error])
G -- yes --> I{--slides provided?}
I -- no --> L
I -- yes --> J[POST .../slide for each slide XML]
J --> K{slide API error?}
K -- yes --> M([return partial-failure error])
K -- no --> J
J --> L{--as bot?}
L -- no --> N([Output result JSON])
L -- yes --> O[POST /drive/v1/permissions/ grant full_access]
O --> P[Attach permission_grant to result]
P --> N
Reviews (15): Last reviewed commit: "feat(slides): add slides +create shortcu..." | Re-trigger Greptile |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@9eddf70a2d893f54bc7bf68bd9f3cb9917eaba45🧩 Skill updatenpx skills add larksuite/cli#feat/lark_slides -y -g |
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (1)
shortcuts/slides/slides_create_test.go (1)
100-106: 建议避免不安全的类型断言,提升失败可读性。
grant["message"].(string)在字段缺失/类型变化时会 panic。建议先做ok检查并给出t.Fatalf,这样回归时错误信息更明确。Refactor suggestion
- grant, _ := data["permission_grant"].(map[string]interface{}) + grant, ok := data["permission_grant"].(map[string]interface{}) + if !ok { + t.Fatalf("permission_grant missing or invalid: %#v", data["permission_grant"]) + } if grant["status"] != common.PermissionGrantGranted { t.Fatalf("permission_grant.status = %v, want %q", grant["status"], common.PermissionGrantGranted) } - if !strings.Contains(grant["message"].(string), "presentation") { - t.Fatalf("permission_grant.message = %q, want 'presentation' mention", grant["message"]) + msg, ok := grant["message"].(string) + if !ok { + t.Fatalf("permission_grant.message missing or invalid: %#v", grant["message"]) + } + if !strings.Contains(msg, "presentation") { + t.Fatalf("permission_grant.message = %q, want 'presentation' mention", msg) }Also applies to: 136-139
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@shortcuts/slides/slides_create_test.go` around lines 100 - 106, The test uses unsafe type assertions on the parsed map (grant, and grant["message"].(string)) which can panic if fields are missing or types change; update the test to check the type assertions with the comma-ok pattern before using values (e.g., assert grant is a map[string]interface{} and that msg, ok := grant["message"].(string) is true), and call t.Fatalf with explicit messages when the type/key is missing or unexpected; update the corresponding checks that compare grant["status"] to common.PermissionGrantGranted to also verify the status value exists and is the expected type before comparing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@shortcuts/slides/slides_create.go`:
- Around line 65-68: The result map currently uses the raw title variable so
when --title is empty callers get an empty string while the XML falls back to
"Untitled"; update the code that builds result (the map assigned to result with
keys "xml_presentation_id" and "title") to use the effective title actually
written to XML (compute an effectiveTitle = title or "Untitled" and store that
in result["title"] instead of the raw title), referencing the existing variables
presentationID and title and the result map construction.
In `@skills/lark-slides/references/examples.md`:
- Line 3: Replace the phrase "提供和 CLI schema 一致的调用示例" with the more natural
wording "提供与 CLI schema 一致的调用示例" in the sentence that reads "本文档提供和 CLI schema
一致的调用示例,XML 内容均遵循
[slides_xml_schema_definition.xml](slides_xml_schema_definition.xml)。" so the
sentence becomes "本文档提供与 CLI schema 一致的调用示例,XML 内容均遵循
[slides_xml_schema_definition.xml](slides_xml_schema_definition.xml)。".
In `@skills/lark-slides/references/lark-slides-create.md`:
- Around line 27-31: The IMPORTANT blockquote contains a blank line triggering
markdownlint MD028; edit the block started by "[!IMPORTANT]" so the blockquote
is contiguous by either removing the empty line between the two paragraphs or
prefixing that blank line with ">" (i.e., ensure the lines containing "`slides
+create` 只创建空白演示文稿..." and "如果演示文稿是**以应用身份(bot)创建**的,如 `lark-cli slides +create
--as bot`..." remain in the same blockquote without an unprefixed blank line).
- Line 28: The documentation has a typo: it instructs using
`xml_presentation.slide create` to add slides but the correct command is
`xml_presentation.slides create` (plural); update the text that follows `slides
+create` (and the other occurrence around the later paragraph) to reference
`xml_presentation.slides create` so it matches the actual command set and avoids
misleading users.
In `@skills/lark-slides/references/lark-slides-xml-presentations-create.md`:
- Around line 21-27: The request example incorrectly includes presentation_id
and revision_id as input fields; the actual create call (see the code that only
sends xml_presentation.content) only expects xml_presentation.content. Remove
presentation_id and revision_id from the create request example (or mark them
explicitly as response-only), and update the example payload so it only shows
the xml_presentation.content field (matching the create logic that sends
xml_presentation.content).
- Around line 39-42: The blockquote section contains an extra blank line between
consecutive '>' lines which triggers markdownlint MD028; remove the empty line
so the two quoted paragraphs about `xml_presentation.content` and the
"**当前命令行为说明**:`xml_presentations.create`..." are consecutive blockquote lines
(or combine them into a single blockquote paragraph), ensuring no blank line
exists between the `>`-prefixed lines.
In `@skills/lark-slides/references/slide-templates.md`:
- Line 3: Update the documented command path to the correct plural form: replace
references to xml_presentation.slide.create with xml_presentation.slides create
(including the occurrence noted as "Also applies to: 6-6") so the command
matches the rest of the references and will be executable; ensure both instances
in slide-templates.md use "xml_presentation.slides create".
In `@skills/lark-slides/references/xml-format-guide.md`:
- Around line 222-252: The docs list <icon> and <chart> as valid <data> page
elements but this contradicts the SlideType in the XSD (SlideType only allows
shape/line/polyline/img/table/smartArt); update the xml-format-guide.md to align
with the XSD by either removing or marking <icon> and <chart> as unsupported by
SlideType, or explicitly document that they are non-SlideType extensions and
must not be emitted for SlideType-based XML; when keeping the <chart> docs,
ensure the required sub-elements listed (chartPlotArea, chartData) and optional
ones (chartTitle, chartSubTitle, chartStyle, chartLegend, chartTooltip) match
the XSD element names and constraints so the examples and prose reflect the
actual schema.
In `@skills/lark-slides/SKILL.md`:
- Around line 45-46: 示例中混用了资源名 xml_presentation.slide 和
xml_presentation.slides,导致 CLI 示例可能执行失败;请在 SKILL.md 中把所有示例统一为真实的 resource
name(使用 xml_presentation.slides),例如将 "lark-cli slides xml_presentation.slide
create --as user" 及其它出现的 xml_presentation.slide 改为
xml_presentation.slides,并同步更新快速开始、API Resources 和参考文档中的所有相同示例以保持一致性。
---
Nitpick comments:
In `@shortcuts/slides/slides_create_test.go`:
- Around line 100-106: The test uses unsafe type assertions on the parsed map
(grant, and grant["message"].(string)) which can panic if fields are missing or
types change; update the test to check the type assertions with the comma-ok
pattern before using values (e.g., assert grant is a map[string]interface{} and
that msg, ok := grant["message"].(string) is true), and call t.Fatalf with
explicit messages when the type/key is missing or unexpected; update the
corresponding checks that compare grant["status"] to
common.PermissionGrantGranted to also verify the status value exists and is the
expected type before comparing.
🪄 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: d30001b0-5325-420e-b773-1661bb939919
📒 Files selected for processing (20)
README.mdREADME.zh.mdinternal/registry/service_descriptions.jsonshortcuts/common/permission_grant.goshortcuts/register.goshortcuts/slides/shortcuts.goshortcuts/slides/slides_create.goshortcuts/slides/slides_create_test.goskills/lark-slides/SKILL.mdskills/lark-slides/references/examples.mdskills/lark-slides/references/lark-slides-create.mdskills/lark-slides/references/lark-slides-xml-presentation-slides-create.mdskills/lark-slides/references/lark-slides-xml-presentation-slides-delete.mdskills/lark-slides/references/lark-slides-xml-presentations-create.mdskills/lark-slides/references/lark-slides-xml-presentations-get.mdskills/lark-slides/references/slide-templates.mdskills/lark-slides/references/slides_demo.xmlskills/lark-slides/references/slides_xml_schema_definition.xmlskills/lark-slides/references/xml-format-guide.mdskills/lark-slides/references/xml-schema-quick-ref.md
skills/lark-slides/references/lark-slides-xml-presentations-create.md
Outdated
Show resolved
Hide resolved
skills/lark-slides/references/lark-slides-xml-presentations-create.md
Outdated
Show resolved
Hide resolved
1887197 to
6e66e73
Compare
|
Tip: Greploop — Automatically fix all review issues by running Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal. |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
skills/lark-slides/SKILL.md (1)
45-46:⚠️ Potential issue | 🟠 Major统一
xml_presentation.slide与xml_presentation.slides的资源名,避免示例不可执行。Line 45、Line 94、Line 255、Line 276 与参考文档命名(Line 331-332)存在单复数混用,会导致用户按文档执行时失败。请全文件统一为真实 CLI resource name。
Proposed patch
-lark-cli slides xml_presentation.slide create \ +lark-cli slides xml_presentation.slides create \ @@ - · xml_presentation.slide.create 逐页添加 slide + · xml_presentation.slides.create 逐页添加 slide @@ -### xml_presentation.slide +### xml_presentation.slides @@ - - `create` — 在指定 xml 演示文稿下创建页面 - - `delete` — 删除指定 xml 演示文稿下的页面 + - `create` — 在指定 xml 演示文稿下创建页面 + - `delete` — 删除指定 xml 演示文稿下的页面 @@ -| `xml_presentation.slide.create` | `slides:presentation:update` 或 `slides:presentation:write_only` | -| `xml_presentation.slide.delete` | `slides:presentation:update` 或 `slides:presentation:write_only` | +| `xml_presentation.slides.create` | `slides:presentation:update` 或 `slides:presentation:write_only` | +| `xml_presentation.slides.delete` | `slides:presentation:update` 或 `slides:presentation:write_only` |Also applies to: 94-95, 255-258, 276-277, 331-332
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-slides/SKILL.md` around lines 45 - 46, The examples use inconsistent resource names "xml_presentation.slide" and "xml_presentation.slides" which breaks the CLI examples; update every example occurrence (including the command lines shown around the places referenced) to the correct, single canonical resource name used by the CLI (choose either xml_presentation.slide or xml_presentation.slides to match the actual CLI) so all examples are consistent—search for all appearances of xml_presentation.slide and xml_presentation.slides (notably the example command starting with "lark-cli slides xml_presentation.slide create \\", and the other occurrences around the referenced lines) and replace them with the chosen canonical resource name throughout the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/lark-slides/SKILL.md`:
- Line 81: Three fenced code blocks in SKILL.md (the blocks containing "Step 1:
需求澄清 & 读取知识", "[PPT 标题] — [定位描述],面向 [目标受众]" and "Wiki Space (知识空间)") lack
language identifiers and trigger markdownlint MD040; update each opening
triple-backtick to include a language tag (e.g., change ``` to ```text) so the
blocks become fenced with a language specifier, leaving the block contents
unchanged.
---
Duplicate comments:
In `@skills/lark-slides/SKILL.md`:
- Around line 45-46: The examples use inconsistent resource names
"xml_presentation.slide" and "xml_presentation.slides" which breaks the CLI
examples; update every example occurrence (including the command lines shown
around the places referenced) to the correct, single canonical resource name
used by the CLI (choose either xml_presentation.slide or xml_presentation.slides
to match the actual CLI) so all examples are consistent—search for all
appearances of xml_presentation.slide and xml_presentation.slides (notably the
example command starting with "lark-cli slides xml_presentation.slide create
\\", and the other occurrences around the referenced lines) and replace them
with the chosen canonical resource name throughout the file.
🪄 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: 4189ee7b-ba8f-479f-a461-8b9b4857ab34
📒 Files selected for processing (1)
skills/lark-slides/SKILL.md
c5ef8d6 to
bc55b89
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (5)
skills/lark-slides/references/lark-slides-xml-presentations-create.md (2)
39-41:⚠️ Potential issue | 🟡 MinorRemove the blank line inside the blockquote (MD028).
Keep these two quoted lines consecutive to satisfy markdownlint.
🧹 Proposed formatting fix
> 常见新建场景只需要传 `xml_presentation.content`,而且建议内容保持为空白 PPT 模板。XML 协议本身以 [slides_xml_schema_definition.xml](slides_xml_schema_definition.xml) 为准。 - > **当前命令行为说明**:`xml_presentations.create` 当前只适合创建空白 PPT,通常只支持指定标题和长宽。页面内容不要在这里一次性传入,后续 slide 请使用 [xml_presentation.slides create](lark-slides-xml-presentation-slides-create.md) 逐页添加。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-slides/references/lark-slides-xml-presentations-create.md` around lines 39 - 41, The blockquote contains an extra blank line triggering markdownlint MD028; edit the quoted section so the two lines starting with "常见新建场景只需要传 `xml_presentation.content`..." and "**当前命令行为说明**:`xml_presentations.create`..." are consecutive with no empty line between them, keeping references to slides_xml_schema_definition.xml, xml_presentation.content, xml_presentations.create and xml_presentation.slides create unchanged.
21-27:⚠️ Potential issue | 🟠 MajorRequest example likely mixes in response-only fields.
presentation_idandrevision_idin create input conflict with the surrounding guidance and can cause incorrect payload construction.🛠️ Proposed doc correction
{ "xml_presentation": { - "content": "<presentation xmlns=\"http://www.larkoffice.com/sml/2.0\" width=\"960\" height=\"540\"><title>项目汇报</title></presentation>", - "presentation_id": "slides_example_presentation_id", - "revision_id": 1 + "content": "<presentation xmlns=\"http://www.larkoffice.com/sml/2.0\" width=\"960\" height=\"540\"><title>项目汇报</title></presentation>" } }| 字段 | 类型 | 必需 | 说明 | |------|------|------|------| | `xml_presentation.content` | string | 否 | 演示文稿的 XML 内容 | -| `xml_presentation.presentation_id` | string | 否 | 演示文稿 ID | -| `xml_presentation.revision_id` | integer | 否 | 演示文稿版本号 |Also applies to: 33-37
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-slides/references/lark-slides-xml-presentations-create.md` around lines 21 - 27, The example create request incorrectly includes response-only fields; remove "presentation_id" and "revision_id" from the create payload so only the "xml_presentation.content" (and any allowed input-only fields) are sent—update the JSON in the lark-slides XML create example to include just the "xml_presentation.content" (e.g., "<presentation ...>...</presentation>") and ensure the same fix is applied to the duplicate example at lines 33-37; reference the keys "presentation_id", "revision_id", and "xml_presentation.content" when locating the change.skills/lark-slides/references/examples.md (1)
3-3:⚠️ Potential issue | 🟡 MinorUse “与” instead of “和” here for more natural wording.
Line 3 currently reads a bit stiff in Chinese technical docs.
📝 Proposed wording fix
-本文档提供和 CLI schema 一致的调用示例,XML 内容均遵循 [slides_xml_schema_definition.xml](slides_xml_schema_definition.xml)。 +本文档提供与 CLI schema 一致的调用示例,XML 内容均遵循 [slides_xml_schema_definition.xml](slides_xml_schema_definition.xml)。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-slides/references/examples.md` at line 3, Replace the conjunction "和" with "与" in the sentence "本文档提供和 CLI schema 一致的调用示例,XML 内容均遵循 [slides_xml_schema_definition.xml](slides_xml_schema_definition.xml)。" so it reads "本文档提供与 CLI schema 一致的调用示例,XML 内容均遵循 [slides_xml_schema_definition.xml](slides_xml_schema_definition.xml)。" to achieve more natural Chinese phrasing.shortcuts/slides/slides_create.go (1)
65-68:⚠️ Potential issue | 🟡 MinorReturn the effective title in output, not the raw flag value.
When
--titleis empty, XML usesUntitled, but output currently returns an emptytitle.💡 Proposed fix
- result := map[string]interface{}{ + effectiveTitle := title + if xmlEscape(title) == "" { + effectiveTitle = "Untitled" + } + + result := map[string]interface{}{ "xml_presentation_id": presentationID, - "title": title, + "title": effectiveTitle, }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@shortcuts/slides/slides_create.go` around lines 65 - 68, The output currently uses the raw flag variable title (which may be empty) when building result; change it to return the effective title actually used in the XML (falling back to the XML default "Untitled" or the title value read from the generated presentation). After creating the presentation (where presentationID is set), obtain the actual title (e.g. read the title from the created XML/presentation object or compute effectiveTitle := title; if effectiveTitle == "" { effectiveTitle = "Untitled" }) and put that effectiveTitle into the result map in place of title so the "title" field reflects what is in the XML.skills/lark-slides/SKILL.md (1)
45-46:⚠️ Potential issue | 🟠 MajorUnify resource name to
xml_presentation.slideseverywhere.This file still mixes
xml_presentation.slideandxml_presentation.slides; copied commands can fail as-is.🔧 Suggested normalization
-lark-cli slides xml_presentation.slide create \ +lark-cli slides xml_presentation.slides create \ @@ - · xml_presentation.slide.create 逐页添加 slide + · xml_presentation.slides.create 逐页添加 slide @@ - - 有问题 → 用 xml_presentation.slide.delete 删除问题页,重新创建 + - 有问题 → 用 xml_presentation.slides.delete 删除问题页,重新创建 @@ -lark-cli slides xml_presentation.slide create \ +lark-cli slides xml_presentation.slides create \ @@ -### xml_presentation.slide +### xml_presentation.slides @@ -2. **创建流程必须分两步**:`slides +create`(或 `xml_presentations.create`)只建空白 PPT,页面内容用 `xml_presentation.slide.create` 逐页添加 +2. **创建流程必须分两步**:`slides +create`(或 `xml_presentations.create`)只建空白 PPT,页面内容用 `xml_presentation.slides.create` 逐页添加 @@ -| `xml_presentation.slide.create` | `slides:presentation:update` 或 `slides:presentation:write_only` | -| `xml_presentation.slide.delete` | `slides:presentation:update` 或 `slides:presentation:write_only` | +| `xml_presentation.slides.create` | `slides:presentation:update` 或 `slides:presentation:write_only` | +| `xml_presentation.slides.delete` | `slides:presentation:update` 或 `slides:presentation:write_only` |Also applies to: 94-95, 102-103, 111-112, 255-258, 263-264, 276-277
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-slides/SKILL.md` around lines 45 - 46, Replace all occurrences of the singular resource name "xml_presentation.slide" with the unified plural "xml_presentation.slides" in this file; specifically update command lines like "lark-cli slides xml_presentation.slide create --as user" and any other commands or examples that use "xml_presentation.slide" (e.g., the other instances noted) so every CLI invocation consistently uses "xml_presentation.slides".
🧹 Nitpick comments (1)
skills/lark-slides/references/lark-slides-xml-presentation-slides-create.md (1)
169-169: Polish phrasing for clearer Chinese readability.Line 169 can read more naturally with “是否为完整的
<slide>元素”.📝 Suggested wording tweak
-| 400 | XML 格式错误 | 检查 `slide.content` 是否是完整 `<slide>` 元素 | +| 400 | XML 格式错误 | 检查 `slide.content` 是否为完整的 `<slide>` 元素 |🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-slides/references/lark-slides-xml-presentation-slides-create.md` at line 169, Update the table cell text in the row that currently reads "检查 `slide.content` 是否是完整 `<slide>` 元素" to the clearer phrasing "检查 `slide.content` 是否为完整的 `<slide>` 元素" so the Chinese reads naturally; locate the string in the markdown where the 400 / XML 格式错误 row is defined (the table entry containing `slide.content`) and replace the wording accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@shortcuts/slides/slides_create.go`:
- Around line 65-68: The output currently uses the raw flag variable title
(which may be empty) when building result; change it to return the effective
title actually used in the XML (falling back to the XML default "Untitled" or
the title value read from the generated presentation). After creating the
presentation (where presentationID is set), obtain the actual title (e.g. read
the title from the created XML/presentation object or compute effectiveTitle :=
title; if effectiveTitle == "" { effectiveTitle = "Untitled" }) and put that
effectiveTitle into the result map in place of title so the "title" field
reflects what is in the XML.
In `@skills/lark-slides/references/examples.md`:
- Line 3: Replace the conjunction "和" with "与" in the sentence "本文档提供和 CLI
schema 一致的调用示例,XML 内容均遵循
[slides_xml_schema_definition.xml](slides_xml_schema_definition.xml)。" so it
reads "本文档提供与 CLI schema 一致的调用示例,XML 内容均遵循
[slides_xml_schema_definition.xml](slides_xml_schema_definition.xml)。" to
achieve more natural Chinese phrasing.
In `@skills/lark-slides/references/lark-slides-xml-presentations-create.md`:
- Around line 39-41: The blockquote contains an extra blank line triggering
markdownlint MD028; edit the quoted section so the two lines starting with
"常见新建场景只需要传 `xml_presentation.content`..." and
"**当前命令行为说明**:`xml_presentations.create`..." are consecutive with no empty line
between them, keeping references to slides_xml_schema_definition.xml,
xml_presentation.content, xml_presentations.create and xml_presentation.slides
create unchanged.
- Around line 21-27: The example create request incorrectly includes
response-only fields; remove "presentation_id" and "revision_id" from the create
payload so only the "xml_presentation.content" (and any allowed input-only
fields) are sent—update the JSON in the lark-slides XML create example to
include just the "xml_presentation.content" (e.g., "<presentation
...>...</presentation>") and ensure the same fix is applied to the duplicate
example at lines 33-37; reference the keys "presentation_id", "revision_id", and
"xml_presentation.content" when locating the change.
In `@skills/lark-slides/SKILL.md`:
- Around line 45-46: Replace all occurrences of the singular resource name
"xml_presentation.slide" with the unified plural "xml_presentation.slides" in
this file; specifically update command lines like "lark-cli slides
xml_presentation.slide create --as user" and any other commands or examples that
use "xml_presentation.slide" (e.g., the other instances noted) so every CLI
invocation consistently uses "xml_presentation.slides".
---
Nitpick comments:
In `@skills/lark-slides/references/lark-slides-xml-presentation-slides-create.md`:
- Line 169: Update the table cell text in the row that currently reads "检查
`slide.content` 是否是完整 `<slide>` 元素" to the clearer phrasing "检查 `slide.content`
是否为完整的 `<slide>` 元素" so the Chinese reads naturally; locate the string in the
markdown where the 400 / XML 格式错误 row is defined (the table entry containing
`slide.content`) and replace the wording accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 65c7887d-fdff-40c4-b0e8-013c20a5959f
📒 Files selected for processing (20)
README.mdREADME.zh.mdinternal/registry/service_descriptions.jsonshortcuts/common/permission_grant.goshortcuts/register.goshortcuts/slides/shortcuts.goshortcuts/slides/slides_create.goshortcuts/slides/slides_create_test.goskills/lark-slides/SKILL.mdskills/lark-slides/references/examples.mdskills/lark-slides/references/lark-slides-create.mdskills/lark-slides/references/lark-slides-xml-presentation-slides-create.mdskills/lark-slides/references/lark-slides-xml-presentation-slides-delete.mdskills/lark-slides/references/lark-slides-xml-presentations-create.mdskills/lark-slides/references/lark-slides-xml-presentations-get.mdskills/lark-slides/references/slide-templates.mdskills/lark-slides/references/slides_demo.xmlskills/lark-slides/references/slides_xml_schema_definition.xmlskills/lark-slides/references/xml-format-guide.mdskills/lark-slides/references/xml-schema-quick-ref.md
✅ Files skipped from review due to trivial changes (9)
- internal/registry/service_descriptions.json
- skills/lark-slides/references/slides_demo.xml
- skills/lark-slides/references/lark-slides-xml-presentations-get.md
- skills/lark-slides/references/lark-slides-xml-presentation-slides-delete.md
- skills/lark-slides/references/slide-templates.md
- shortcuts/slides/slides_create_test.go
- skills/lark-slides/references/xml-schema-quick-ref.md
- skills/lark-slides/references/xml-format-guide.md
- shortcuts/register.go
🚧 Files skipped from review as they are similar to previous changes (3)
- shortcuts/slides/shortcuts.go
- README.md
- skills/lark-slides/references/lark-slides-create.md
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@shortcuts/slides/slides_create_test.go`:
- Around line 102-107: The test uses unchecked type assertions on the
permission_grant map which can panic if the response shape changes; update the
checks around grant, grant["status"], and grant["message"] in
slides_create_test.go to use safe type assertions (ok idiom) and explicit
presence/type validation before comparing values (e.g., assert grant is
map[string]interface{}, assert status is string before comparing to
common.PermissionGrantGranted, and assert message is string before using
strings.Contains), and add clear t.Fatalf messages on missing/wrong types; apply
the same hardening to the other occurrence referenced at lines 139-142.
🪄 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: b9ef7c07-6829-492c-830b-074a6f1dfca2
📒 Files selected for processing (1)
shortcuts/slides/slides_create_test.go
4cd025e to
cb6939d
Compare
skills/lark-slides/references/lark-slides-xml-presentations-create.md
Outdated
Show resolved
Hide resolved
8a15b7c to
4a49d58
Compare
…tion Add `slides +create` shortcut for creating Lark Slides presentations, with optional `--slides` flag to create and add slide pages in one step. ## Command Interface ``` lark-cli slides +create [flags] Flags: --title string presentation title (default "Untitled") --slides string slide content JSON array, each element is a <slide> XML string (max 10) --as string identity: user | bot | auto (default "user") --dry-run print request without executing ``` ## Usage ```bash # Create blank presentation lark-cli slides +create --title "My PPT" # One-step: create + add slides lark-cli slides +create --title "My PPT" --slides '[ "<slide xmlns=\"http://www.larkoffice.com/sml/2.0\"><data>...</data></slide>", "<slide xmlns=\"http://www.larkoffice.com/sml/2.0\"><data>...</data></slide>" ]' ``` ## Output ```json { "xml_presentation_id": "pres_abc", "title": "My PPT", "revision_id": 1, "slide_ids": ["slide_001", "slide_002"], "slides_added": 2, "permission_grant": { "status": "granted", ... } } ``` - `slide_ids` / `slides_added`: only present when --slides is provided - `permission_grant`: only present in --as bot mode ## Design - --slides accepts a JSON array of XML strings; CLI wraps each into `{"slide":{"content":"..."}}` and calls the slide create API sequentially - Max 10 slides per create; for more, use xml_presentation.slide.create - On partial failure: stops at first error, reports presentation ID and number of slides added, does not roll back - Bot mode auto-grants current CLI user full_access on the new presentation - Scopes: slides:presentation:create, slides:presentation:write_only ## Changes - shortcuts/slides/: new shortcut package with SlidesCreate implementation and 14 unit tests (94% coverage) - shortcuts/register.go: register slides shortcuts - shortcuts/common/permission_grant.go: add "slides" resource type - skills/lark-slides/: full skill documentation (SKILL.md, XML schema, templates, examples, reference docs) - README: add Slides to product coverage
4a49d58 to
9eddf70
Compare
Summary
Add Lark Slides support with a new
slides +createshortcut and the initiallark-slidesskill documentation/reference set. This lets agents create an empty presentation from the CLI and, in bot mode, automatically grant the current CLI user full access to the new presentation.Changes
slides +createshortcut, register it, and auto-grant current-user drive permission after bot-created presentationsskills/lark-slidesdocs, examples, schema references, and README updatesTest Plan
go test ./shortcuts/slides/...)lark xxxcommand works as expectedRelated Issues
Summary by CodeRabbit
New Features
Documentation
Tests