Skip to content

fix: issue#1935 & whiteboard shortcut reformat#1980

Merged
liangshuo-1 merged 3 commits into
mainfrom
fix/whitebaord_export
Jul 22, 2026
Merged

fix: issue#1935 & whiteboard shortcut reformat#1980
liangshuo-1 merged 3 commits into
mainfrom
fix/whitebaord_export

Conversation

@syh-cpdsss

@syh-cpdsss syh-cpdsss commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix whiteboard preview exports so saved filenames match the image format returned by the API, instead of always forcing .png. This also promotes whiteboard +export as the canonical shortcut while keeping the old whiteboard +query and --output_as forms executable for backward compatibility.

Changes

  • Add the visible whiteboard +export shortcut and keep whiteboard +query as a hidden backward-compatible alias.
  • Rename the public output flag to --output-type with the new values preview, svg, source, and raw; keep hidden --output_as compatibility for image, svg, code, and raw.
  • Detect the preview image extension from the download response Content-Type, so JPEG responses are saved as .jpg rather than .png.
  • Update the whiteboard skill documentation to use +export --output-type ... and stop recommending the hidden legacy command.
  • Add tests for the new command contract, hidden compatibility flags, legacy behavior, and JPEG preview filename handling.

Test Plan

  • Unit test pass
  • Manual verification:
    • whiteboard +export --output-type preview saved wb-preview-new.jpg.
    • whiteboard +query --output_as image saved wb-preview-old.jpg.
    • Both saved files were detected as JPEG images.
    • whiteboard +export --output-type raw and whiteboard +query --output_as raw both returned nodes successfully.

Related Issues

Summary by CodeRabbit

  • New Features

    • Added the visible whiteboard +export command for exporting boards as previews, SVG, source code, or raw data.
    • Added --output-type options with improved output handling, including image extensions based on the returned format.
  • Documentation

    • Updated whiteboard guidance, workflows, examples, and command references to use +export.
    • Clarified export formats, output requirements, and SVG limitations.
  • Bug Fixes

    • Preserved compatibility with the legacy hidden +query command and --output_as option.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bf1f6475-2e79-43ef-8c3c-c563d5d5a8a6

📥 Commits

Reviewing files that changed from the base of the PR and between 597971a and 1f19a08.

📒 Files selected for processing (2)
  • shortcuts/whiteboard/whiteboard_export.go
  • shortcuts/whiteboard/whiteboard_export_test.go

📝 Walkthrough

Walkthrough

The whiteboard CLI adds a visible +export shortcut with preview, SVG, source, and raw output types, while retaining hidden +query compatibility. Preview files now use response content types for extensions, with updated validation, tests, and documentation.

Changes

Whiteboard export

Layer / File(s) Summary
Export contract and shortcut wiring
shortcuts/whiteboard/whiteboard_export.go, shortcuts/whiteboard/shortcuts.go
Adds shared output-type constants, flag normalization, validation, visible +export registration, and hidden legacy +query support.
Export routing and preview file handling
shortcuts/whiteboard/whiteboard_export.go
Routes exports by normalized type and derives preview filenames from response headers, including JPEG handling.
Registration and behavior validation
shortcuts/whiteboard/whiteboard_export_test.go, shortcuts/whiteboard/whiteboard_update_test.go
Tests output validation, alias conflicts, shortcut visibility, registration, and content-type-based preview extensions.
Export workflow documentation
skills/lark-whiteboard/*
Updates command guidance, reference examples, workflow instructions, and SVG warning formatting for +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
Loading

Possibly related PRs

  • larksuite/cli#382: Introduced the earlier +query shortcut and related shortcut registration changes.

Suggested labels: feature

Suggested reviewers: fangshuyu-768

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The SVG markdown formatting tweak in skills/lark-whiteboard/routes/svg.md is unrelated to #1935 and the export filename fix. Move the SVG formatting cleanup to a separate PR unless it is required by a linked issue.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is clearly related to the main changes: issue 1935 and the whiteboard shortcut/export update.
Description check ✅ Passed The description follows the template with Summary, Changes, Test Plan, and Related Issues sections filled in.
Linked Issues check ✅ Passed The preview export now derives the saved extension from Content-Type, which fixes JPEG responses and satisfies #1935.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/whitebaord_export

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 commented Jul 21, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#fix/whitebaord_export -y -g

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.98039% with 98 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.04%. Comparing base (577ff03) to head (8e79286).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/whiteboard/whiteboard_export.go 75.92% 72 Missing and 26 partials ⚠️
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.
📢 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 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

🧹 Nitpick comments (1)
shortcuts/whiteboard/whiteboard_query.go (1)

213-217: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated 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

📥 Commits

Reviewing files that changed from the base of the PR and between c876841 and 597971a.

📒 Files selected for processing (8)
  • shortcuts/whiteboard/shortcuts.go
  • shortcuts/whiteboard/whiteboard_query.go
  • shortcuts/whiteboard/whiteboard_query_test.go
  • shortcuts/whiteboard/whiteboard_update_test.go
  • skills/lark-whiteboard/SKILL.md
  • skills/lark-whiteboard/references/lark-whiteboard-export.md
  • skills/lark-whiteboard/references/lark-whiteboard-workflow.md
  • skills/lark-whiteboard/routes/svg.md

Comment thread skills/lark-whiteboard/SKILL.md Outdated
zkh-bytedance
zkh-bytedance previously approved these changes Jul 21, 2026
zkh-bytedance
zkh-bytedance previously approved these changes Jul 21, 2026
@syh-cpdsss
syh-cpdsss force-pushed the fix/whitebaord_export branch from 1f19a08 to 8e79286 Compare July 21, 2026 13:22
@github-actions github-actions Bot added size/XL Architecture-level or global-impact change and removed size/L Large or sensitive change across domains or core paths labels Jul 21, 2026
@liangshuo-1
liangshuo-1 merged commit bb246b5 into main Jul 22, 2026
70 of 81 checks passed
@liangshuo-1
liangshuo-1 deleted the fix/whitebaord_export branch July 22, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Architecture-level or global-impact change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

whiteboard +query --output_as image saves JPEG bytes with PNG extension

3 participants