fix: issue#1935 & whiteboard shortcut reformat#1980
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe whiteboard CLI adds a visible ChangesWhiteboard export
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant WhiteboardExport
participant wbExportOutputType
participant FeishuWhiteboardAPI
participant saveOutputFile
CLI->>WhiteboardExport: invoke +export
WhiteboardExport->>wbExportOutputType: normalize output flags
wbExportOutputType-->>WhiteboardExport: return output type
WhiteboardExport->>FeishuWhiteboardAPI: request whiteboard export
FeishuWhiteboardAPI-->>WhiteboardExport: return bytes and Content-Type
WhiteboardExport->>saveOutputFile: save using detected extension
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@8e79286d75f5b12987eb172689bcbc3ac90f460b🧩 Skill updatenpx skills add larksuite/cli#fix/whitebaord_export -y -g |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1980 +/- ##
==========================================
+ Coverage 75.00% 75.04% +0.04%
==========================================
Files 900 901 +1
Lines 95187 95520 +333
==========================================
+ Hits 71395 71686 +291
- Misses 18311 18332 +21
- Partials 5481 5502 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
shortcuts/whiteboard/whiteboard_query.go (1)
213-217: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicated validation-error text drifts from
wbExportOutputTypeError.This default branch hand-writes the same "must be one of..." messages that
wbExportOutputTypeError(Lines 150-161) already builds, and the two have already diverged slightly (e.g. "invalid --output_as flag, must be one of..." here vs. "--output_as flag must be one of..." in the typed error). Reuse the single source of truth so dry-run output and the actual validation error can't drift further.♻️ Proposed fix
default: - if outputTypeParam == "--output_as" { - return common.NewDryRunAPI().Desc("invalid --output_as flag, must be one of: image | svg | code | raw") - } - return common.NewDryRunAPI().Desc("invalid --output-type flag, must be one of: preview | svg | source | raw") + return common.NewDryRunAPI().Desc(wbExportOutputTypeError(outputTypeParam).Error()) }🤖 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 `@shortcuts/whiteboard/whiteboard_query.go` around lines 213 - 217, Update the default branch in the output-type validation flow to reuse wbExportOutputTypeError for dry-run descriptions instead of hand-written error text. Preserve the distinct handling for --output_as versus --output-type while deriving both messages from that shared error builder, keeping dry-run output aligned with the actual validation error.
🤖 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-whiteboard/SKILL.md`:
- Line 27: Update the export command entry in the Lark whiteboard skill
documentation to present preview and svg as separate --output-type alternatives,
using distinct commands or equivalent wording; do not show preview/svg as a
single value.
---
Nitpick comments:
In `@shortcuts/whiteboard/whiteboard_query.go`:
- Around line 213-217: Update the default branch in the output-type validation
flow to reuse wbExportOutputTypeError for dry-run descriptions instead of
hand-written error text. Preserve the distinct handling for --output_as versus
--output-type while deriving both messages from that shared error builder,
keeping dry-run output aligned with the actual validation error.
🪄 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: 860d8b1b-bf64-45a4-8fb0-b4d0fb26e7fb
📒 Files selected for processing (8)
shortcuts/whiteboard/shortcuts.goshortcuts/whiteboard/whiteboard_query.goshortcuts/whiteboard/whiteboard_query_test.goshortcuts/whiteboard/whiteboard_update_test.goskills/lark-whiteboard/SKILL.mdskills/lark-whiteboard/references/lark-whiteboard-export.mdskills/lark-whiteboard/references/lark-whiteboard-workflow.mdskills/lark-whiteboard/routes/svg.md
1f19a08 to
8e79286
Compare
Summary
Fix whiteboard preview exports so saved filenames match the image format returned by the API, instead of always forcing
.png. This also promoteswhiteboard +exportas the canonical shortcut while keeping the oldwhiteboard +queryand--output_asforms executable for backward compatibility.Changes
whiteboard +exportshortcut and keepwhiteboard +queryas a hidden backward-compatible alias.--output-typewith the new valuespreview,svg,source, andraw; keep hidden--output_ascompatibility forimage,svg,code, andraw.Content-Type, so JPEG responses are saved as.jpgrather than.png.+export --output-type ...and stop recommending the hidden legacy command.Test Plan
whiteboard +export --output-type previewsavedwb-preview-new.jpg.whiteboard +query --output_as imagesavedwb-preview-old.jpg.whiteboard +export --output-type rawandwhiteboard +query --output_as rawboth returned nodes successfully.Related Issues
Summary by CodeRabbit
New Features
whiteboard +exportcommand for exporting boards as previews, SVG, source code, or raw data.--output-typeoptions with improved output handling, including image extensions based on the returned format.Documentation
+export.Bug Fixes
+querycommand and--output_asoption.