Skip to content

fix(slides): support CSV multi-value for --slide-id in screenshot#2047

Merged
BD-ZERO merged 2 commits into
mainfrom
fix/slides-screenshot-slide-id-csv
Jul 24, 2026
Merged

fix(slides): support CSV multi-value for --slide-id in screenshot#2047
BD-ZERO merged 2 commits into
mainfrom
fix/slides-screenshot-slide-id-csv

Conversation

@BD-ZERO

@BD-ZERO BD-ZERO commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

--slide-id used the cobra StringArray flag type, which only accepts repeated flags and does not split comma-separated values, unlike --slide-number (int_array -> cobra IntSlice) which already supported CSV input. This made the two selector flags inconsistent.

Switch --slide-id to the string_slice flag type (cobra StringSlice), which natively supports both comma-separated and repeated values, and update the flag readers from StrArray to StrSlice. normalizeSlideIDs already trims/dedupes/filters blanks, and
validateSlidesScreenshotSelectorLimit already caps the combined selector count, so both continue to apply unchanged to CSV input.

Add tests covering --slide-id CSV parsing, whitespace/duplicate normalization, and the >10 selector limit via CSV, mirroring the existing --slide-number coverage.

Summary

Changes

  • Change 1
  • Change 2

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected

Related Issues

  • None

Summary by CodeRabbit

Summary

  • Bug Fixes
    • Improved --slide-id handling for the Slides Screenshot shortcut when provided as a comma-separated list.
    • Slide ID lists are now normalized by trimming whitespace, removing empty entries, and deduplicating while preserving order.
    • When more than 10 slide IDs are provided, screenshot requests now fail with a clear “request at most 10 pages at a time” validation message.
    • Validation now prevents combining --content with --slide-number (conflict message unchanged).

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jul 24, 2026
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.14%. Comparing base (4807283) to head (f53ec07).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/slides/slides_screenshot.go 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2047      +/-   ##
==========================================
+ Coverage   75.13%   75.14%   +0.01%     
==========================================
  Files         905      911       +6     
  Lines       96135    96322     +187     
==========================================
+ Hits        72229    72385     +156     
- Misses      18348    18370      +22     
- Partials     5558     5567       +9     

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

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#fix/slides-screenshot-slide-id-csv -y -g

@coderabbitai

coderabbitai Bot commented Jul 24, 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 SlidesScreenshot shortcut now parses --slide-id as a string slice, enabling comma-separated slide selectors. Validation, dry-run, execution, and render paths normalize these values, with tests covering output generation, normalization, limits, and selector conflicts.

Changes

SlidesScreenshot CSV selectors

Layer / File(s) Summary
Selector declaration and execution handling
shortcuts/slides/slides_screenshot.go
The --slide-id flag uses string_slice values across validation, dry-run, execution, and rendering conflict checks.
CSV selector and output validation
shortcuts/slides/slides_screenshot_test.go
Tests cover CSV parsing, trimming, empty-value removal, deduplication, screenshot output, the ten-slide limit, and selector conflicts.

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

Possibly related PRs

  • larksuite/cli#1358: Introduced the SlidesScreenshot shortcut and its slide selector and screenshot request handling.

Suggested reviewers: fangshuyu-768

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: enabling CSV multi-value support for --slide-id in the screenshot shortcut.
Description check ✅ Passed The description covers the motivation, main changes, testing intent, and related issues, even though the template isn't fully structured.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/slides-screenshot-slide-id-csv

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.

@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 `@shortcuts/slides/slides_screenshot_test.go`:
- Around line 191-247: Isolate configuration state in each affected test by
setting LARKSUITE_CLI_CONFIG_DIR to t.TempDir() before creating the factory:
TestSlidesScreenshotListBySlideIDCSV (lines 191-247), the test spanning lines
249-298, and the test spanning lines 300-319 in
shortcuts/slides/slides_screenshot_test.go.
🪄 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 Plus

Run ID: 6f4728fe-a443-4a73-b24d-ec908055e736

📥 Commits

Reviewing files that changed from the base of the PR and between 4807283 and 49ee08a.

📒 Files selected for processing (2)
  • shortcuts/slides/slides_screenshot.go
  • shortcuts/slides/slides_screenshot_test.go

Comment thread shortcuts/slides/slides_screenshot_test.go
@BD-ZERO
BD-ZERO force-pushed the fix/slides-screenshot-slide-id-csv branch 4 times, most recently from 8706904 to 6152630 Compare July 24, 2026 09:01

@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 `@shortcuts/slides/slides_screenshot.go`:
- Line 48: Update the help text for the "slide-id" flag to use “comma-separated”
instead of “comma-separate,” while preserving the existing description and page
limit.
🪄 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 Plus

Run ID: 613a6322-39ac-40ab-8128-2335536b4a86

📥 Commits

Reviewing files that changed from the base of the PR and between 8706904 and 6152630.

📒 Files selected for processing (2)
  • shortcuts/slides/slides_screenshot.go
  • shortcuts/slides/slides_screenshot_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • shortcuts/slides/slides_screenshot_test.go

Comment thread shortcuts/slides/slides_screenshot.go Outdated
--slide-id used the cobra StringArray flag type, which only accepts
repeated flags and does not split comma-separated values, unlike
--slide-number (int_array -> cobra IntSlice) which already supported
CSV input. This made the two selector flags inconsistent.

Switch --slide-id to the string_slice flag type (cobra StringSlice),
which natively supports both comma-separated and repeated values, and
update the flag readers from StrArray to StrSlice. normalizeSlideIDs
already trims/dedupes/filters blanks, and
validateSlidesScreenshotSelectorLimit already caps the combined
selector count, so both continue to apply unchanged to CSV input.

Add tests covering --slide-id CSV parsing, whitespace/duplicate
normalization, and the >10 selector limit via CSV, mirroring the
existing --slide-number coverage.
@BD-ZERO
BD-ZERO force-pushed the fix/slides-screenshot-slide-id-csv branch from 6152630 to 6f46877 Compare July 24, 2026 09:15
@BD-ZERO BD-ZERO assigned BD-ZERO and unassigned BD-ZERO Jul 24, 2026
Comment thread shortcuts/slides/slides_screenshot_test.go
Comment thread shortcuts/slides/slides_screenshot.go Outdated
- Fix "comma-separate" -> "comma-separated" wording in the --slide-id
  flag description (CodeRabbit).
- Set LARKSUITE_CLI_CONFIG_DIR to t.TempDir() in the new screenshot
  tests, per the AGENTS.md testing convention, so local configuration
  state cannot leak into or be modified by the suite.
- Add a dry-run E2E test (tests/cli_e2e/slides) that pins --slide-id
  CSV parsing through the built CLI binary and asserts the emitted
  slide_ids request body, per the AGENTS.md dry-run E2E requirement
  for shortcut flag/param changes.
- Update the lark-slides skill reference to document that --slide-id
  and --slide-number both accept comma-separated values, not just
  repeated flags, so agents can discover the new syntax.
@BD-ZERO
BD-ZERO merged commit f77b7ee into main Jul 24, 2026
27 checks passed
@BD-ZERO
BD-ZERO deleted the fix/slides-screenshot-slide-id-csv branch July 24, 2026 10:32
@liangshuo-1 liangshuo-1 mentioned this pull request Jul 24, 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