Skip to content

feat(slides): inline slides reference docs into help output - #2181

Merged
ethan-zhx merged 1 commit into
mainfrom
feat/help_info
Aug 11, 2026
Merged

feat(slides): inline slides reference docs into help output#2181
ethan-zhx merged 1 commit into
mainfrom
feat/help_info

Conversation

@ethan-zhx

@ethan-zhx ethan-zhx commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Move lark-cli slides help output from Go hardcoded blocks to declarative markdown in affordance/slides.md, using the new domain-level ## Skills section and per-command ### Skills blocks. This lets AI agents see actionable pointers to reference docs instead of searching blind.

Changes

  • Domain help (slides --help): the canonical > skill: lark-slides (SKILL.md) is shown first automatically; the ## Skills domain section adds a pointer to xml-schema-quick-ref.md as a display-only extra entry.
  • Shortcut help (+create, +add-slide, +delete-slide, +xml-get, +screenshot, +media-upload, +replace-slide, +update-slide, +history-list, +history-revert, +history-revert-status): each command's ### Skills block routes to its matching reference doc, with paths corrected to the refactored subdirectory structure (cli/, xml/, workflow/).
  • Deprecated +replace-pages and hidden alias +update: both route to the +update-slide replacement docs.
  • Dead code cleanup: removed appendSlidesDomainRoutingHints, slidesDocumentRoutes, slidesSkillReadPath, and the slidesSkillName/slidesXMLQuickReferencePath constants from cmd/service/affordance.go (replaced by writeDomainSkills). Removed the stale TestPrepareDomainHelp_SlidesIncludesDocumentRoutes test.

Test Plan

  • ./lark-cli slides --help shows Domain skills with both SKILL.md and xml-quick-ref
  • All 12 shortcut --help outputs show correct Related skills entries with resolved paths
  • All reference paths in affordance/slides.md resolve to existing files (no stale flat paths)

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Added slide-management capabilities for creating, adding, deleting, inspecting, updating, replacing, and screenshotting slides.
    • Added media upload, page replacement, and slide history actions, including listing and reverting changes.
    • Added a convenient +update alias for slide updates.
  • Documentation

    • Corrected and standardized links across slide-management documentation.
    • Added guidance for prerequisites and workflows involving slide history operations.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds the slides skill and documents affordances for slide lifecycle, XML inspection, screenshots, media uploads, editing, page replacement, and history operations. It also corrects related CLI and workflow documentation paths.

Changes

Slides documentation

Layer / File(s) Summary
Slides affordance declarations
affordance/slides.md
Adds the slides skill and affordances for slide creation, inspection, media upload, editing, page replacement, and history operations.
Skill reference paths
skills/lark-slides/SKILL.md
Updates workflow and CLI documentation links to use the corrected paths.
CLI and workflow links
skills/lark-slides/references/...
Corrects relative links for slide editing, replacement, update, XML validation, error handling, and migrated workflow documentation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: fangshuyu-768

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes moving slide reference documentation into help output.
Description check ✅ Passed The description includes complete Summary, Changes, Test Plan, and Related Issues sections with specific verification details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch feat/help_info
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/help_info

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 added the size/L Large or sensitive change across domains or core paths label Aug 4, 2026

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

🧹 Nitpick comments (3)
cmd/service/affordance.go (1)

269-278: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename the shared route renderer and reuse it for the domain block.

PrepareMethodHelp at Line 343 calls appendSlidesShortcutReferenceRoutes, so the function is no longer shortcut-specific. appendSlidesDomainRoutingHints at Lines 229-232 also re-implements the same "Slides document routes:" header and indented list. Rename the helper to appendSlidesDocumentRoutes and call it from the domain path so one function owns the block format.

♻️ Proposed consolidation
-func appendSlidesShortcutReferenceRoutes(b *strings.Builder, routes []string) {
+func appendSlidesDocumentRoutes(b *strings.Builder, routes []string) {
 	if len(routes) == 0 {
 		return
 	}
 	b.WriteString("\n\nSlides document routes:")
 	for _, route := range routes {
 		b.WriteString("\n  ")
 		b.WriteString(route)
 	}
 }

Then reuse it in appendSlidesDomainRoutingHints:

 	routes := slidesDocumentRoutes(skillFS, []string{
 		"lark-slides/SKILL.md",
 		slidesXMLQuickReferencePath,
 	})
-	if len(routes) == 0 {
-		return
-	}
-	b.WriteString("\n\nSlides document routes:")
-	for _, route := range routes {
-		fmt.Fprintf(b, "\n  %s", route)
-	}
+	appendSlidesDocumentRoutes(b, routes)
 }
🤖 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 `@cmd/service/affordance.go` around lines 269 - 278, Rename
appendSlidesShortcutReferenceRoutes to appendSlidesDocumentRoutes, update the
PrepareMethodHelp call to use the new name, and replace the duplicated “Slides
document routes:” rendering in appendSlidesDomainRoutingHints with this shared
helper.
cmd/service/affordance_test.go (2)

393-401: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the exact route count so the table catches added routes.

The subtest builds skillFS from slidesShortcutReferencePaths[command], which is the same map the table is meant to pin. The assertion only checks containment, so an extra path added to the production map produces an extra entry in got and the test still passes. Compare the length as well, as TestSlidesScreenshotHelpDoesNotIncludeXMLQuickReference already does at Lines 484-486.

💚 Proposed assertion
 			got, ok := readSlidesShortcutReferenceRoutes(sc, skillFS)
 			if !ok || len(got) == 0 {
 				t.Fatalf("shortcut %q has no mapped reference", command)
 			}
+			if len(got) != len(routes) {
+				t.Fatalf("shortcut %q routes = %#v, want exactly %#v", command, got, routes)
+			}
 			for _, route := range routes {
 				if !containsString(got, route) {
 					t.Fatalf("shortcut %q routes = %#v, want %q", command, got, route)
 				}
 			}
🤖 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 `@cmd/service/affordance_test.go` around lines 393 - 401, Update the subtest
around readSlidesShortcutReferenceRoutes to assert that len(got) equals
len(routes) before checking route containment, matching the exact-count
validation used by TestSlidesScreenshotHelpDoesNotIncludeXMLQuickReference. Keep
the existing non-empty and per-route assertions.

Source: Coding guidelines


304-315: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Stub affordanceLookup so the reference-only branch is actually pinned.

This test leaves the package-level affordanceLookup at its real implementation and still calls cmdmeta.SetAffordanceRef(sc, "slides", "+xml-get"). If an overlay exists for that service/method pair, hasAffordance becomes true and PrepareShortcutHelp no longer takes the !hasAffordance && hasReferenceRoutes path that this test is named for. Reverting the new allowance in PrepareShortcutHelp would then not fail this test. Force the no-affordance state, as the sibling tests at Lines 116-120 and Lines 187-194 already do.

As per coding guidelines: "contract tests must assert the changed field or behavior directly so reverting the implementation causes failure".

💚 Proposed test hardening
 func TestPrepareShortcutHelp_SlidesReferenceRouteWithoutAffordance(t *testing.T) {
+	orig := affordanceLookup
+	t.Cleanup(func() { affordanceLookup = orig })
+	affordanceLookup = func(_, _ string) (json.RawMessage, bool) { return nil, false }
+
 	sc := &cobra.Command{Use: "+xml-get", Short: "Fetch presentation XML"}
 	cmdmeta.SetSource(sc, cmdmeta.SourceShortcut, false)
 	cmdmeta.SetDomain(sc, "slides")
 	cmdmeta.SetAffordanceRef(sc, "slides", "+xml-get")
 	cmdutil.SetRisk(sc, "read")
🤖 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 `@cmd/service/affordance_test.go` around lines 304 - 315, Update
TestPrepareShortcutHelp_SlidesReferenceRouteWithoutAffordance to stub the
package-level affordanceLookup, forcing the slides/+xml-get lookup to report no
affordance before calling PrepareShortcutHelp. Follow the stubbing pattern used
by the sibling tests around the existing affordanceLookup setup, and assert the
reference-only behavior so reverting the PrepareShortcutHelp allowance causes
this test to fail.

Source: Coding guidelines

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

Nitpick comments:
In `@cmd/service/affordance_test.go`:
- Around line 393-401: Update the subtest around
readSlidesShortcutReferenceRoutes to assert that len(got) equals len(routes)
before checking route containment, matching the exact-count validation used by
TestSlidesScreenshotHelpDoesNotIncludeXMLQuickReference. Keep the existing
non-empty and per-route assertions.
- Around line 304-315: Update
TestPrepareShortcutHelp_SlidesReferenceRouteWithoutAffordance to stub the
package-level affordanceLookup, forcing the slides/+xml-get lookup to report no
affordance before calling PrepareShortcutHelp. Follow the stubbing pattern used
by the sibling tests around the existing affordanceLookup setup, and assert the
reference-only behavior so reverting the PrepareShortcutHelp allowance causes
this test to fail.

In `@cmd/service/affordance.go`:
- Around line 269-278: Rename appendSlidesShortcutReferenceRoutes to
appendSlidesDocumentRoutes, update the PrepareMethodHelp call to use the new
name, and replace the duplicated “Slides document routes:” rendering in
appendSlidesDomainRoutingHints with this shared helper.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0958d71e-0a45-459d-a37a-677a6f0eefb1

📥 Commits

Reviewing files that changed from the base of the PR and between 3b66d47 and e31882c.

📒 Files selected for processing (2)
  • cmd/service/affordance.go
  • cmd/service/affordance_test.go

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/help_info -y -g

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.52%. Comparing base (115357d) to head (3fb5c6f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2181   +/-   ##
=======================================
  Coverage   76.51%   76.52%           
=======================================
  Files        1019     1019           
  Lines      112614   112614           
=======================================
+ Hits        86172    86176    +4     
+ Misses      19873    19869    -4     
  Partials     6569     6569           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@github-actions github-actions Bot added size/S Low-risk docs, CI, test, or chore only changes and removed size/L Large or sensitive change across domains or core paths labels Aug 11, 2026

@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 `@affordance/slides.md`:
- Around line 59-64: Add a deprecation note to the +replace-pages section in
affordance/slides.md stating that new requests must use +update-slide while
+replace-pages remains available for compatibility.
🪄 Autofix

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 Plus

Run ID: 2cab8df1-090c-4fd6-87ae-5ca33ad4c3cb

📥 Commits

Reviewing files that changed from the base of the PR and between a80c810 and 75b3209.

📒 Files selected for processing (1)
  • affordance/slides.md

Comment thread affordance/slides.md
@github-actions github-actions Bot added size/M Single-domain feat or fix with limited business impact and removed size/S Low-risk docs, CI, test, or chore only changes labels Aug 11, 2026

@fangshuyu-768 fangshuyu-768 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the updated Slides affordance routing and source coverage. The focused tests and available CI checks pass.

@ethan-zhx
ethan-zhx merged commit 7436a53 into main Aug 11, 2026
28 checks passed
@ethan-zhx
ethan-zhx deleted the feat/help_info branch August 11, 2026 11:29
@liangshuo-1 liangshuo-1 mentioned this pull request Aug 11, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants