fix(slides): support CSV multi-value for --slide-id in screenshot#2047
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@f53ec07af1e8ebc27e4346de55a37c79c1a1eabf🧩 Skill updatenpx skills add larksuite/cli#fix/slides-screenshot-slide-id-csv -y -g |
|
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:
📝 WalkthroughWalkthroughThe ChangesSlidesScreenshot CSV selectors
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
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: 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
📒 Files selected for processing (2)
shortcuts/slides/slides_screenshot.goshortcuts/slides/slides_screenshot_test.go
8706904 to
6152630
Compare
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
shortcuts/slides/slides_screenshot.goshortcuts/slides/slides_screenshot_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- shortcuts/slides/slides_screenshot_test.go
--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.
6152630 to
6f46877
Compare
- 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.
--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
Test Plan
lark-cli <domain> <command>flow works as expectedRelated Issues
Summary by CodeRabbit
Summary
--slide-idhandling for the Slides Screenshot shortcut when provided as a comma-separated list.--contentwith--slide-number(conflict message unchanged).