fix: add url to markdown +create output#753
Conversation
Change-Id: I4fa870415bbad76f721f8aa170180e83fd20281b
📝 WalkthroughWalkthroughThe PR adds URL field support to the Markdown create shortcut. The execute path now constructs a resource URL using file token and brand, and the pretty-print helper displays it when present. Test assertions validate URL inclusion in both JSON and formatted outputs. ChangesURL Field for Markdown Create
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
🧹 Nitpick comments (1)
shortcuts/markdown/markdown_test.go (1)
576-589: ⚡ Quick win
TestMarkdownCreateMultipartUploadSuccesshas no URL assertion for the new field.The multipart upload path also produces a
urlfield (tokenbox_md_multipart→https://www.feishu.cn/file/box_md_multipart), but the test doesn't assert it. The URL logic is upload-method-agnostic, so the risk is low, but adding the assertion would complete coverage of the new behavior.✅ Suggested addition
if !strings.Contains(stdout.String(), `"file_token": "box_md_multipart"`) { t.Fatalf("stdout missing multipart file_token: %s", stdout.String()) } +if !strings.Contains(stdout.String(), `"url": "https://www.feishu.cn/file/box_md_multipart"`) { + t.Fatalf("stdout missing url: %s", stdout.String()) +}🤖 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/markdown/markdown_test.go` around lines 576 - 589, Update the TestMarkdownCreateMultipartUploadSuccess test to also assert the generated URL for the multipart token; after the existing check that stdout contains `"file_token": "box_md_multipart"`, add an assertion that stdout (captured by stdout used in mountAndRunMarkdown) contains the expected URL `https://www.feishu.cn/file/box_md_multipart` so the upload URL logic is covered alongside the uploadPartStub and file_token checks.
🤖 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 `@shortcuts/markdown/markdown_test.go`:
- Around line 576-589: Update the TestMarkdownCreateMultipartUploadSuccess test
to also assert the generated URL for the multipart token; after the existing
check that stdout contains `"file_token": "box_md_multipart"`, add an assertion
that stdout (captured by stdout used in mountAndRunMarkdown) contains the
expected URL `https://www.feishu.cn/file/box_md_multipart` so the upload URL
logic is covered alongside the uploadPartStub and file_token checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 44614eb8-66b1-4426-b452-435c416f13a1
📒 Files selected for processing (3)
shortcuts/markdown/helpers.goshortcuts/markdown/markdown_create.goshortcuts/markdown/markdown_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #753 +/- ##
=======================================
Coverage 65.08% 65.08%
=======================================
Files 503 503
Lines 46577 46581 +4
=======================================
+ Hits 30314 30318 +4
Misses 13623 13623
Partials 2640 2640 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@81873fcf399cf75dbd9c63d3ccce4eb1ff285f04🧩 Skill updatenpx skills add larksuite/cli#fix/markdown-create-url-output -y -g |
Change-Id: I4fa870415bbad76f721f8aa170180e83fd20281b
Change-Id: I4fa870415bbad76f721f8aa170180e83fd20281b
Summary
This change makes markdown +create return a user-facing url in its success output, matching the behavior of drive +upload. It also keeps the pretty-format output aligned so agents and humans can read the same link consistently.
Changes
Test Plan
Related Issues
Summary by CodeRabbit
New Features
Tests