Skip to content

fix: add url to markdown +create output#753

Merged
fangshuyu-768 merged 1 commit into
mainfrom
fix/markdown-create-url-output
May 6, 2026
Merged

fix: add url to markdown +create output#753
fangshuyu-768 merged 1 commit into
mainfrom
fix/markdown-create-url-output

Conversation

@wittam-01

@wittam-01 wittam-01 commented May 6, 2026

Copy link
Copy Markdown
Collaborator

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

  • Add top-level url to markdown +create output using the same Drive file URL fallback pattern as drive +upload
  • Update markdown shortcut tests to verify the new url field in both JSON and pretty output

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark xxx command works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Markdown file creation now includes a resource URL in the output for easier access to created files.
  • Tests

    • Added test coverage to verify URL output in Markdown creation operations.

Change-Id: I4fa870415bbad76f721f8aa170180e83fd20281b
@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

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

Changes

URL Field for Markdown Create

Layer / File(s) Summary
Core Implementation
shortcuts/markdown/markdown_create.go
Execute path builds a resource URL via common.BuildResourceURL from file token and brand, then appends it to the output payload as the "url" field.
Display Logic
shortcuts/markdown/helpers.go
Pretty-print helper now conditionally outputs the URL field when present in the data as "url: {value}".
Tests
shortcuts/markdown/markdown_test.go
Test assertions added to validate URL field presence in stdout for both JSON and pretty-formatted outputs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

size/S, domain/ccm

Suggested reviewers

  • SunPeiYang996

Poem

🐰 A URL hops into view,
When markdown files are born anew,
Pretty-printed with pride so true,
Tests confirm what we now pursue! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a URL field to markdown +create output.
Description check ✅ Passed The description follows the template with all required sections complete: Summary, Changes, Test Plan, and Related Issues are all present and properly filled out.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/markdown-create-url-output

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

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

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

🧹 Nitpick comments (1)
shortcuts/markdown/markdown_test.go (1)

576-589: ⚡ Quick win

TestMarkdownCreateMultipartUploadSuccess has no URL assertion for the new field.

The multipart upload path also produces a url field (token box_md_multiparthttps://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

📥 Commits

Reviewing files that changed from the base of the PR and between a8f0784 and 81873fc.

📒 Files selected for processing (3)
  • shortcuts/markdown/helpers.go
  • shortcuts/markdown/markdown_create.go
  • shortcuts/markdown/markdown_test.go

@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.08%. Comparing base (0627541) to head (81873fc).
⚠️ Report is 1 commits behind head on main.

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.
📢 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 May 6, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#fix/markdown-create-url-output -y -g

@fangshuyu-768
fangshuyu-768 merged commit d317493 into main May 6, 2026
21 checks passed
@fangshuyu-768
fangshuyu-768 deleted the fix/markdown-create-url-output branch May 6, 2026 08:03
HomyeeKing pushed a commit to HomyeeKing/cli that referenced this pull request May 6, 2026
Change-Id: I4fa870415bbad76f721f8aa170180e83fd20281b
tuxedomm pushed a commit to zhumiaoxin/cli that referenced this pull request Jun 6, 2026
Change-Id: I4fa870415bbad76f721f8aa170180e83fd20281b
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.

2 participants